Each sensor has the following default fields:
| Field Name | Information |
|---|---|
| value | The numerical data for the sensor. Required. |
| lat | The latitude of the sensor. Required. |
| lng | The longitude of the sensor. Required. |
| message | The string message for the sensor. Not Required. |
Each pieces of sensor field data has the following sub-fields:
| Sub-Field Name | Information |
|---|---|
| name | The unique identifier for the field. It is required when creating/updating a field and cannot be changed. |
| longName | The display name for the field. |
| type | Can be “NUMBER” or “STRING”. It is required when creating/updating a field. |
| required | Is a boolean field. If true, data sent to a sensor must include this field or an error will result. Optional. |
| units | Is a string. Optional. |
| index | The numerical identifier of the field. Automatically populated. |
| value | The last value sent to the field. Automatically populated. |
| lastUpdate | The time stamp of the last value sent to the field. Automatically populated. |
To query all sensor fields for a specific sensor:
| URL | https://smartstreets.sensetecnic.com/wotkit/api/sensors/{sensorname}/fields |
| Privacy | Public or Private |
| Format | json |
| Method | GET |
| Returns | Appropriate HTTP status code; OK 200 - if successful |
To query a single sensor field for a specific sensor:
| URL | https://smartstreets.sensetecnic.com/wotkit/api/sensors/{sensorname}/fields/{fieldName} |
| Privacy | Public or Private |
| Format | json |
| Method | GET |
| Returns | Appropriate HTTP status code; OK 200 - if successful |
You can update an existing sensor field or add a new sensor field by performing a PUT and including the field name in the URL. The field information is supplied in a JSON format.
If the sensor already has a field with the given “fieldname”, it will be updated with new information. Otherwise, a new field will be created.
To update/add a sensor field:
| URL | https://smartstreets.sensetecnic.com/wotkit/api/sensors/{sensorname}/fields/{fieldname} |
| Privacy | Private |
| Format | json |
| Method | PUT |
| Returns | HTTP status code; No Content 204 if successful |
For instance, to create a new field called “test-field”:
example
curl --user {id}:{password} --request PUT
--header "Content-Type: application/json" --data-binary @field-data.txt
'https://smartstreets.sensetecnic.com/wotkit/api/sensors/test-sensor/fields/test-field'
The file field-data.txt could contain the following. (This is the minimal information needed to create a new field.)
{
"name":"test-field",
"type":"STRING"
}
To then update “test-field” sub-fields, the same curl command would be used, and ‘’field-data.txt’’ could now contain the following.
{
"name":"test-field",
"type":"NUMBER",
"longName":"Test Field",
"required":true,
"units":"mm"
}
You can delete an existing sensor field by performing a DELETE and including the field name in the URL.
None of the existing default fields (lat, lng, value, message) can be deleted.
To delete a sensor field:
| URL | https://smartstreets.sensetecnic.com/wotkit/api/sensors/{sensorname}/fields/{fieldname} |
| Privacy | Private |
| Format | n/a |
| Method | DELETE |
| Returns | HTTP status code; No Content 204 if successful |