Superfy Platform API Documentation


Add New Sensor API

Require Authentication

This API is used to add new sensor for the company based on combination of deviceID and token.


URL

api/sensors/add

Required parameter (POST)

Optional parameter

Example JSON Payload

{
  "deviceID": "ABCD-EFGH-IJKL-MNOP",
  "token": "ccb9f30aff8a7960a5a1023654d0c7c5",
  "sensorstokenID": 3,
  "sensorName": "aaab",
  "sensorDeviceID": "aaaaaaaaaaaaaaab",
  "description": "sensor description",
  "firmwareVersion": "0.1.0",
  "connectivityType": "LORAWAN AS923",
  "simCardNumber": "",
  "connectivityProvider": "Actility"
}

Possible return HTTP status code

Return message, contains newly created asset category

{
  "status": "success",
  "message": {
    "sensorsID": 12001,
    "sensorstokenID": 3,
    "sensorCompany": "SmartsensorNew",
    "sensorDeviceID": "aaaaaaaaaaaaaaab",
    "firmwareVersion": "0.1.0",
    "sensorName": "aaab",
    "isAllocated": "N",
    "description": "sensor description",
    "heartbeatFrequency": 0,
    "companyID": 16,
    "createdDate": 1692363203,
    "updatedDate": 1692363203,
    "createdByUserID": 90,
    "updatedByUserID": 90,
    "connectivityType": "LORAWAN AS923",
    "simCardNumber": "",
    "connectivityProvider": "Actility",
    "encryption": "N",
    "latest_sensorsdata": {
      "sensorsdataID": 21547633,
      "sensorallocation": null,
      "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
    },
    "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