This information describes how to explode agZOOM Web Service. Indicates how to call to the Web Service and enumerates the possible answers. All methods have a screenshot about Chrome postman plugin configuration.
Contents
Get token
Connection type | GET | |
URL | http://visor.ag-zoom.com/oauth/v2/token | |
URL Params | grant_type | password |
client_id | [WS_client_id] | |
client_secret | [WS_client_secret] | |
username | [user_id] | |
password | [User_password] | |
Header Params | Not applies |
Request example
http://visor.ag-zoom.com/oauth/v2/token?grant_type=password&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&username=USERNAME&password=PASSWORD
Expected answer
{
"access_token": "ZWRlNDg4MzM0YTc5YjY2OTBjZTI0ZmI4ZTAzYmZhMDRiMzBiZDY1NDBkOTFiYWExOTU0NzZkZjVlZThkZWNiNA",
"expires_in":3600,
"token_type": "bearer",
"scope": null,
"refresh_token": "Y2ExZDU3MTJiM2FiMjA5NTEyNzI0NGQ0MDYwNjFkYzQ0YjViMzQyMjBkZTBhNjQ4NGUxZGZjOWVkMmY4Njk3ZA"
}
Postman screenshot
Get User Devices
Connection type | GET | |
URL | http://visor.ag-zoom.com/api/userdevices | |
URL Params | Not applies | |
Header Params | Authorization | Bearer [access_token] |
Request example
https://visor.ag-zoom.com/api/userdevices
Expected answer
{
"status": "0",
"systemDate": "05-12-2017 11:59:02",
"costumers": [
{
"id": 999999,
"name": "CostumerName",
"fincas": [
{
"id": 999999,
"name": "fincasName",
"devices": [
{
"id": 99999,
"name": "deviceName",
"location": "30S 613576 4150858",
"alarmaNo": 93,
"messageNo": "0",
"batteryLoad": 84
},
{
"id": 99999,
"name": "deviceName",
"location": "30S 614459 4150912",
"alarmaNo": 89,
"messageNo": "0",
"batteryLoad": 80
},
{
}
]
}
Postman screenshot
Get Sensor Data
Connection type | GET | |
URL | http://visor.ag-zoom.com/api/getsensordata/[deviceId]/mrid/[startMrid](/[endMrid]) | |
URL | http://visor.ag-zoom.com/api/getsensordata/[deviceId]/date/[endDate](/[startDate]) | |
URL Params | Not applies | |
URL Info | Information can be retrieved by mrid or by date, choose URL you need. endMrid and startDate are optional parameters. If no end value is indicated, information will be retrieved from endDate on. endDate and startDate format must be: Y-m-d H:i:s | |
Valid date formats | If no end value is indicated, information will be retrieved from endDate on.
endDate and startDate format must be:
|
|
Header Params | Authorization | Bearer [access_token] |
Request example
https://visor.ag-zoom.com/api/getsensordata/4660/date/20240529000000/20240314000000
Expected answer
{
"status":"0",
"systemDate":"20170922163742",
"filter":"MRID",
"initialDate":"24/05/2017",
"finalDate":"30/05/2017",
"initialMRID":"121646",
"finalMRID":"121893",
"device":[
{
"id ":"425",
"costumer": "CostumerName",
"farm": "FarmName",
"name": "DeviceName",
"alias": "DeviceAlias",
"geolocation":"45.xxxxxxx,0.yyyyyyyy",
"sensors": [
{
"code": "5632",
"type": "VP-4",
"port": 5,
"depth": 30,
"variables": [
{
"id": "1",
"type": "Precipitación",
"data": "0.000000000000",
"unit": "Pluviometria",
"unit_default": "mm (milímetros)",
"date": "2017-05-24 00:00:00",
"mrid": "121646"
},
{... } ]
},
{... } ]
} ]
}
Postman screenshot
Errors
Token error
{
"error":"invalid_grant",
"error_description":"Invalid username and password combination"
}
Invalid_grant | Invalid username and password combination |
Function answers
{
"status":"1",
"systemDate":"20170922163742",
"error":"1",
"errorMsg":"Action not allowed"
}
Action not allowed | Error nº: 1 You can’t request this action. |
Origin not allowed | Error nº: 2 This method can’t be requested from a WS Client. |
Method not allowed | Error nº: 3 You has not permissions to access this method. |
Client data not allowed | Error nº: 4 You has no permissions to access this particular element information. |
Device not found | Error nº: 5 The requested device has not been found. |
Widgets not found | Error nº: 6 The requested device has not widgets available. |