Get Available Sensors API
Require Authentication
This API is used to get available sensors for the company based on combination of deviceID and token.
URL
api/sensors/list
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/sensors/list?q=sensor&o=sensorName
- q «contains keyword that want to be looked for. Keyword will search sensorName and sensorDeviceID field only»
- s «filter results by isAllocated. Value should be either "Y" or "N".»
- m «contains sensorstokenID that want to be looked for. If passed, value must exist in database. To get the sensorstokenID, please see Get Available Sensor Manufacturers.»
- o «used to sort data, contains field name. Available value: sensorsID, sensorName, sensorDeviceID, isAllocated. Default value: sensorName»
- 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": "", "previous_parameter": "", "start": 0, "total": 2, "lists": [ { "sensorsID": 479, "sensorstokenID": 3, "sensorCompany": "SmartsensorNew", "sensorDeviceID": "aaaaaaaaaaaaaaab", "firmwareVersion": "", "sensorName": "aaab", "isAllocated": "Y", "description": "", "companyID": 16, "createdDate": 1557290069, "updatedDate": 1599063517, "createdByUserID": 5, "updatedByUserID": 198, "connectivityType": "LORAWAN AS923", "simCardNumber": "", "connectivityProvider": "Actility", "sensorallocatedID": 3609, "projectpinID": 1758, "projectID": 152, "projectpinname": "Designworks Test device", "latest_sensorsdata": { "sensorsdataID": 21547633, "sensorallocation": { "projectpinID": 1758, "projectID": 152, "projectName": "Zone 2", "projectgroupID": 0, "groupName": "", "iconType": "pintype", "iconID": 2, "iconURL": "https://dashboard.superfy.com/assets/images/icons/default/appsize/enclosure.png", "customlocationID": 0, "locationName": "", "pinAddress1": "", "pinAddress2": "", "pinCity": "", "pinState": "", "pinCountry": "", "pinZipCode": "", "latitude": -6.159944542411, "longitude": 106.80634114891, "name": "Designworks Test device", "description": "", "serialNumber": "", "assetTag": [ { "pinstagsID": 65, "tags_text": "test tag param" }, { "pinstagsID": 69, "tags_text": "Ualla" } ], "manufacturerID": 0, "manufacturerName": "", "createdDate": 1614829167, "creatorUserID": 90, "pinType": { "pintypeID": 134, "pinTypeName": "bb test", "iconType": "system", "iconID": 2, "iconURL": "2", "pinTypeDescription": "", "pinTypeImageOriginalName": "", "pinTypeImageURL": "", "manufacturerID": 0, "manufacturerName": "0", "pinTypeCreatedDate": 1591353799, "pinTypeCreatedByUserID": 90, "pinTypeModifiedDate": 1614829214, "pinTypeModifiedByUserID": 90, "depthWhenEmpty_cm": 20, "distanceSensorToFillLine_cm": 2, "total_projectpins": 33 } }, "sensorEventID": "", "sensorDeviceID": "aaaaaaaaaaaaaaab", "firmwareVersion": "", "headerMethod": "heartbeat", "reason": "SAMPLE_PERIOD", "temperatureExist": "Y", "temperatureValue": 720, "temperatureOkay": "N", "accelerometer_x": 0, "accelerometer_y": 0, "accelerometer_z": -0.649999976158, "ultrasoundExist": "Y", "ultrasound": 59, "batteryLevel": 100, "signalStrengthExist": "Y", "signalStrength_rssi_dbm": -93, "signalStrength_bitErrorRate": 0, "laserDistance1": 112, "laserDistance2": 118, "averageDistance": 96, "laserAverageDistance": 115, "timestampdata": 1673881939, "configfilllevel": -465 }, "allocated_depthWhenEmpty_cm": "20", "allocated_distanceSensorToFillLine_cm": "2" }, { "sensorsID": 908, "sensorstokenID": 3, "sensorCompany": "SmartsensorNew", "sensorDeviceID": "aaaaaaaaaaaaaaac", "firmwareVersion": "", "sensorName": "aaac", "isAllocated": "Y", "description": "", "companyID": 16, "createdDate": 1557290069, "updatedDate": 1557290069, "createdByUserID": 5, "updatedByUserID": 5, "connectivityType": "", "simCardNumber": "", "connectivityProvider": "", "sensorallocatedID": 0, "projectpinID": 0, "projectID": 0, "projectpinname": "", "latest_sensorsdata": { "sensorsdataID": 12924721, "sensorallocation": null, "sensorEventID": "", "sensorDeviceID": "aaaaaaaaaaaaaaac", "firmwareVersion": "", "headerMethod": "heartbeat", "reason": "SAMPLE_PERIOD", "temperatureExist": "Y", "temperatureValue": 17, "temperatureOkay": "Y", "accelerometer_x": 0.039999999106, "accelerometer_y": 0, "accelerometer_z": -0.629999995232, "ultrasoundExist": "Y", "ultrasound": 76, "batteryLevel": 100, "signalStrengthExist": "Y", "signalStrength_rssi_dbm": -77, "signalStrength_bitErrorRate": 0, "laserDistance1": 134, "laserDistance2": 137, "averageDistance": 115, "laserAverageDistance": 135, "timestampdata": 1641536768, "configfilllevel": -25 }, "allocated_depthWhenEmpty_cm": null, "allocated_distanceSensorToFillLine_cm": null } ], "fillLevelSource": "laseravg" } }
Note:
"latest_sensorsdata" may have null value if there is no latest sensor data.
"currentPinAllocated", "latest_sensorsdata", and "sensorallocation" might be null if there is no data
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/sensors/list"+next_parameter or "api/sensors/list"+previous_parameter