Web Service Explotation Manual

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 typeGET
URLhttp://visor.ag-zoom.com/oauth/v2/token
URL Paramsgrant_typepassword
 client_id[WS_client_id]
 client_secret[WS_client_secret]
 username[user_id]
 password[User_password]
Header ParamsNot applies

 

 Expected answer

 

{ 
 "access_token": "ZWRlNDg4MzM0YTc5YjY2OTBjZTI0ZmI4ZTAzYmZhMDRiMzBiZDY1NDBkOTFiYWExOTU0NzZkZjVlZThkZWNiNA", 
 "expires_in":3600, 
 "token_type": "bearer", 
 "scope": null, 
 "refresh_token": "Y2ExZDU3MTJiM2FiMjA5NTEyNzI0NGQ0MDYwNjFkYzQ0YjViMzQyMjBkZTBhNjQ4NGUxZGZjOWVkMmY4Njk3ZA" 
}

 

 Postman screenshot

 

Get User Devices

Connection typeGET
URLhttp://visor.ag-zoom.com/api/userdevices
URL ParamsNot applies
Header ParamsAuthorizationBearer [access_token]

 

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 typeGET
URL        http://visor.ag-zoom.com/api/getsensordata/[deviceId]/mrid/[startMrid](/[endMrid])
URLhttp://visor.ag-zoom.com/api/getsensordata/[deviceId]/date/[startDate](/[endDate])
URL ParamsNot applies
URL InfoInformation can be retrieved by mrid or by date, choose URL you need. endMrid and endDate are optional parameters. If no end value is indicated, information will be retrieved from startDate on.
Header ParamsAuthorizationBearer [access_token]

 

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_grantInvalid username and password combination

 

Function answers:

 
{ 
 "status":"1", 
 "systemDate":"20170922163742", 
 "error":"1", 
 "errorMsg":"Action not allowed" 
}
Action not allowedError nº: 1 You can’t request this action.
Origin not allowedError nº: 2 This method can’t be requested from a WS Client.
Method not allowedError nº: 3 You has not permissions to access this method.
Client data not allowedError nº: 4 You has no permissions to access this particular element information.
Device not foundError nº: 5 The requested device has not been found.
Widgets not foundError nº: 6 The requested device has not widgets available.