Get Allocated Sensor History on a Piny API
Require Authentication
This API is used to get allocated sensor history on a pin for the company based on combination of deviceID and token.
URL
api/projects/sensors/:projectID/:projectpinID
Required parameter (in URL)
- :projectID «contains projectID. It must be put in the URL, e.g: api/projects/sensors/1/1. Value must exist. To get the projectID, please see Get Available Zones.»
- :projectpinID «contains projectpinID. It must be put in the URL, e.g: api/projects/sensors/1/1. Value must exist. To get the projectpinID, please see Get Available Pins on Map (Specific or All Zone).»
Required parameter (POST)
- deviceID
- token
Optional parameter (GET)
All optional parameters use GET method. So it should be embedded in the URL, e.g: api/projects/sensors/1/1?q=bin&o=allocationDate
- q «contains keyword that want to be looked for. Keyword will search name field only»
- s «contains sensorsID that want to be looked for. If passed, value must exist in database. To get the sensorsID, please see Get Available Sensors.»
- amin «contains minimum value for allocationDate that want to be looked for. This value should be an integer (unix time).»
- amax «contains maximum value for allocationDate that want to be looked for. This value should be an integer (unix time).»
- e «contains value for endDate that want to be looked for. This value should be an integer (unix time). To get current active sensor, set "e" parameter to "0"»
- emin «contains minimum value for endDate that want to be looked for. This value should be an integer (unix time).»
- emax «contains maximum value for endDate that want to be looked for. This value should be an integer (unix time).»
- dmin «contains minimum value for depthWhenEmpty_cm (height of container from bottom to fill line) that want to be looked for. This value should be an integer.»
- dmax «contains maximum value for depthWhenEmpty_cm (height of container from bottom to fill line) that want to be looked for. This value should be an integer.»
- fmin «contains minimum value for distanceSensorToFillLine_cm (distance of sensor from top of fill line) that want to be looked for. This value should be an integer.»
- fmax «contains maximum value for distanceSensorToFillLine_cm (distance of sensor from top of fill line) that want to be looked for. This value should be an integer.»
- o «used to sort data, contains field name. Available value: allocationDate, endDate, depthWhenEmpty_cm, distanceSensorToFillLine_cm. Default value: allocationDate»
- ot «used to sort data, contains sort type. Available value: asc, desc. Default value: asc»
- per_page «indicates how many data that will be displayed in each call. Value must be a number between 1 to 500. Default value: 500»
- offset «indicates the first data index that will be displayed in each call. Value must be a number with minimum value is 0. Default value: 0»
Example JSON Payload
{
"deviceID": "ABCD-EFGH-IJKL-MNOP",
"token": "bb602ab13b8090268cd6e3bb9dfa39e2"
}
Possible return HTTP status code
- 200
- 401
- 405
Return message
{
"status": "success",
"message": {
"current_parameter": "?offset=0",
"next_parameter": "?offset=0",
"previous_parameter": "?offset=0",
"start": 0,
"total": 4,
"lists": [{
"sensorallocatedID": 1,
"sensorsID": 1,
"sensorstokenID": 1,
"sensorCompany": "LX Group",
"sensorDeviceID": 1231,
"firmwareVersion": "1231",
"sensorName": "tes",
"description": "asdasd",
"allocationDate": 1462817660,
"depthWhenEmpty_cm": 100,
"distanceSensorToFillLine_cm": 0,
"endDate": 1463685439
}, {
"sensorallocatedID": 2,
"sensorsID": 1,
"sensorstokenID": 1,
"sensorCompany": "LX Group",
"sensorDeviceID": 1231,
"firmwareVersion": "1231",
"sensorName": "tes",
"description": "asdasd",
"allocationDate": 1463479639,
"depthWhenEmpty_cm": 100,
"distanceSensorToFillLine_cm": 10,
"endDate": 1463685439
}, {
"sensorallocatedID": 6,
"sensorsID": 1,
"sensorstokenID": 1,
"sensorCompany": "LX Group",
"sensorDeviceID": 1231,
"firmwareVersion": "1231",
"sensorName": "tes",
"description": "asdasd",
"allocationDate": 1463685089,
"depthWhenEmpty_cm": 100,
"distanceSensorToFillLine_cm": 10,
"endDate": 1463685521
}, {
"sensorallocatedID": 7,
"sensorsID": 1,
"sensorstokenID": 1,
"sensorCompany": "LX Group",
"sensorDeviceID": 1231,
"firmwareVersion": "1231",
"sensorName": "tes",
"description": "asdasd",
"allocationDate": 1463685570,
"depthWhenEmpty_cm": 100,
"distanceSensorToFillLine_cm": 10,
"endDate": 0
}]
}
}
Note: use "next_parameter" and "previous_parameter" to go to next or previous result page. Just combine it with the API URL, e.g: "api/projects/sensors"+next_parameter or "api/projects/sensors"+previous_parameter
If "endDate" is 0, it means that the sensor is allocated to that bin.