+
Get started
+
+ The following API is provided by the Eco saver developer team. It allows you to get Location and
+ Sensor and Sensor Data from the Eco saver database.
+
+
+ To use this API, you need an API key.
+
+
+
Get all location
+
+ To get Location of sensors you need to make a GET call to the following url :
+ https://api.teeseng.uk/api/v0/location
+
+
+ Return Response :
+ {"status":"200"}
+
+
+
QUERY PARAMETERS
+
+
+
+ Field |
+ Type |
+ Description |
+
+
+
+
+ Authorization |
+ JSON |
+ Your API key. |
+ (Required) Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: {provide your
+ API key here}" |
+
+
+
+
+
+
Get location by ID
+
+ To get Location you need to make a GET call to the following url :
+ https://api.teeseng.uk/api/v0/location/{id}
+
+
+ Return Response :
+ {"status":"200"}
+
+
+
QUERY PARAMETERS
+
+
+
+ Field |
+ Type |
+ Description |
+
+
+
+
+ Authorization |
+ JSON |
+ (Required) Your API key. |
+ Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: {provide your
+ API key here}" |
+
+
+
+
+
+
Add Location (Only for system or admin API key)
+
+ To add an Location you need to make a POST call to the following url :
+ https://api.teeseng.uk/api/v0/location/new
+
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/new -H "Content-Type: application/json" -X POST -d '{"name": "SAMPLE", "added_by": "system" , "description": "test"}'
+
+
+ Return Response :
+ {"status":"200"}
+
+
+
QUERY PARAMETERS
+
+
+
+ Field |
+ Type |
+ Description |
+
+
+
+
+ Authorization |
+ JSON |
+ Your API key. |
+ (Required) Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: {provide your
+ API key here}" |
+
+
+
+ Location name |
+ JSON |
+ Location name. |
+ (Required) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"name":"Location name"}' |
+
+
+
+ Added by |
+ JSON |
+ System or Admin |
+ (Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"added_by":"system"}' |
+
+
+
+ Description |
+ JSON |
+ Description of Location |
+ (Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"description":"test"}' |
+
+
+
+
+
+
Update Location (Only for system or admin API key)
+
+ To update an Location you need to make a PUT call to the following url :
+ https://api.teeseng.uk/api/v0/location/update
+
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/update -H "Content-Type: application/json" -X POST -d '{"id": "7" , "name": "SAMPLE", "added_by": "system" , "description": "test"}'
+
+
+ Return Response :
+ {"status":"200","message":"Location 7 updated"}
+
+
+
QUERY PARAMETERS
+
+
+
+ Field |
+ Type |
+ Description |
+
+
+
+
+ Authorization |
+ JSON |
+ Your API key. |
+ (Required) example: curl https://api.teeseng.uk/api/v0/location/update -H "Authorization: {provide your
+ API key here}" |
+
+
+
+ ID |
+ JSON |
+ Location ID |
+ (Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/update -H "Authorization: provide
+ your API key here" -d '{"id": "7"}' |
+
+
+
+ Location name |
+ JSON |
+ Location name. |
+ (Optional) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"name":"Location name"}' |
+
+
+
+ Added by |
+ JSON |
+ System or Admin |
+ (Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"added_by":"system"}' |
+
+
+
+ Description |
+ JSON |
+ Description of Location |
+ (Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new -H "Authorization: provide
+ your API key here" -d '{"description":"test"}' |
+
+
+
+
+
+
Delete Location (Only for system or admin API key)
+
+ To delete an Location you need to make a DELETE call to the following url :
+ https://api.teeseng.uk/api/v0/location/delete
+
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/delete -H "Content-Type: application/json" -X POST -d '{"id": "7"}'
+
+
+
QUERY PARAMETERS
+
+
+
+ Field |
+ Type |
+ Description |
+
+
+
+
+ Authorization |
+ JSON |
+ Your API key. |
+ (Required) example: curl https://api.teeseng.uk/api/v0/location/delete -H "Authorization: {provide your
+ API key here}" |
+
+
+
+ ID |
+ JSON |
+ Location ID |
+ (Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/delete -H "Authorization: provide
+ your API key here" -d '{"id": "7"}' |
+
+
+
+
+
+
Errors
+
+ The Westeros API uses the following error codes:
+
+
+
+
+ Error Code |
+ Meaning |
+
+
+
+
+ X000 |
+
+ Some parameters are missing. This error appears when you don't pass every mandatory
+ parameters.
+ |
+
+
+ 403 |
+
+ Unknown or unvalid secret_key . This error appears if
+ you use an unknow API key or if your API key expired.
+ |
+
+
+ 500 |
+
+ Unvalid secret_key No API key was supplied. Invalid
+ request.
+ |
+
+
+ X003 |
+
+ Unknown or unvalid user token . This error appears if
+ you use an unknow user token or if the user token expired.
+ |
+
+
+
+