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.
|
API Keys
You can generate API Keys here:
Name | Public Key | Private Key | Key Type | Created |
---|---|---|---|---|
API Key | GR234-We34 | greR-234-fEG | Type | 2024-01-22 |
Get all sensor
To get sensors you need to make a GET call to the following url :
https://api.teeseng.uk/api/v0/sensor
Return Response :
{"status":"200"}
QUERY PARAMETERS
Field | Type | Description | |
---|---|---|---|
Authorization | JSON | Your API key. | (Required) Example: curl https://api.teeseng.uk/api/v0/sensor -H "Authorization: {provide your API key here}" |
Get sensor by ID
To get Sensor you need to make a GET call to the following url :
https://api.teeseng.uk/api/v0/sensor/{id}
Return Response :
{"status":"200"}
QUERY PARAMETERS
Field | Type | Description | |
---|---|---|---|
Authorization | JSON | (Required) Your API key. | Example: curl https://api.teeseng.uk/api/v0/sensor/{id} -H "Authorization: {provide your API key here}" |
Add Sensor (Only for system or admin API key)
To add a Sensor you need to make a POST call to the following url :
https://api.teeseng.uk/api/v0/sensor/new
Example :
curl https://api.teeseng.uk/api/v0/sensor/new -H "Content-Type: application/json" -X POST -d '{"sensorname": "test", "added_by": "system" , "mac_address": "99-6A-F8-7D-B4-94", "description": "test" , "location": "11"}'
Return Response :
{"status":"200"}
QUERY PARAMETERS
Field | Type | Description | |
---|---|---|---|
Authorization | JSON | Your API key. | (Required) Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: {provide your API key here}" |
Sensor name | JSON | Sesnsor name. | (Required) Location name. Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"sensorname": "test"}' |
Added by | JSON | System or Admin | (Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"added_by":"system"}' |
Mac Address | JSON | Mac Address | (Required) Mac Address Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"mac_address": "99-6A-F8-7D-B4-94"}' |
Description | JSON | Description of Sensor | (Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"description":"test"}' |
Mac Address | JSON | Mac Address | (Required) Mac Address Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"mac_address": "99-6A-F8-7D-B4-94"}' |
Location | JSON | Location | (Required) Location Example: curl https://api.teeseng.uk/api/v0/sensor/new -H "Authorization: provide your API key here" -d '{"location": "11"}' |
Update Sensor (Only for system or admin API key)
To update a Sensor you need to make a PUT call to the following url :
https://api.teeseng.uk/api/v0/sensor/update
Example :
curl https://api.teeseng.uk/api/v0/sensor/update -H "Content-Type: application/json" -X POST -d '{"id": "2" ,"sensorname": "test", "added_by": "system" , "mac_address": "99-6A-F8-7D-B4-94" , "description": "test123" , "location": "11" }'
Return Response :
{"status":"200","message":"Sensor 2 updated"}
QUERY PARAMETERS
Field | Type | Description | |
---|---|---|---|
Authorization | JSON | Your API key. | (Required) example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: {provide your API key here}" |
ID | JSON | Sensor ID | (Required) Sensor ID Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"id": "7"}' |
Sensor name | JSON | Sensor name. | (Optional) Sensor name. Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"sensorname": "test"}' |
Added by | JSON | System or Admin | (Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"added_by":"system"}' |
Mac Address | JSON | Mac Address | (Optional) Mac Address Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"mac_address": "99-6A-F8-7D-B4-94"}' |
Description | JSON | Description of Sensor | (Optional) Description of Sensor Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"description":"test"}' |
Location | JSON | Location of Sensor | (Optional) Location of Sensor Example: curl https://api.teeseng.uk/api/v0/sensor/update -H "Authorization: provide your API key here" -d '{"location": "11"}' |
Delete Sensor (Only for system or admin API key)
To delete a sensor you need to make a DELETE call to the following url :
https://api.teeseng.uk/api/v0/sensor/delete
Example :
curl https://api.teeseng.uk/api/v0/sensor/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/sensor/delete -H "Authorization: {provide your API key here}" |
ID | JSON | Sensor ID | (Required) Sensor ID Example: curl https://api.teeseng.uk/api/v0/sensor/delete -H "Authorization: provide your API key here" -d '{"id": "7"}' |