slControl API

LogoutChangelog (26.08.2024)Legal notesBasic usageRequest EmulatorTroubleshooting
Global
Get list of accessible customersGet lookup tables for settingsGet lookup tables for devicesGet lookup tables for operationModeGet lookup tables for gatewaysGet lookup tables for jobsGet lookup tables for alerts
Customers
Get customer configurationUpdate customer configurationGet mesh network
Groups
Get group tree
Lamp switches
Get lamp switchesUpdate lamp switches
Luminaire points
Get luminaire pointsUpdate luminaire pointsCreate luminaire pointsDelete luminaire points
Devices
Get devicesGet device dataGet device stateUpdate device dataUpdate device operation stateGet operation modeUpdate operation modeDelete deviceDelete devices
Devices - Statistics/Logs
Get radar dataGet motion dataGet device energyGet environmental data
Gateways
Get gatewaysGet gateway dataCreate gatewaysDelete a gateway
Jobs
Get jobs state of a deviceGet job state by slcID
Alerts
Get alertsCreate alertsUpdate alerts

Basic usage

Some basic rules that apply for all requests to our API.

Request URL

https://esaveag.com/slcontrol/api/API endpoint/URL parameters

Do not forget the Slash after API endpoint even if you do not use any URL parameters.

API endpoint

We have several API endpoints you can communicate with. Watch out that you are using the correct one as documented.

API endpoint names are case sensitive.

URL parameters

To control your result you may/must use parameters.

The first parameter always has the prefix ?, all others the prefix &. Eg. ?param1=value1&param2=value2

Do not use any parameter more than once in the same URL.

URL parameter names and values are case sensitive.

Do not forget to properly URL-encode your URL parameters.

Request method

Make sure you are using the correct HTTP request method as documented.

GET | POST | PUT | DELETE

Request headers

There are two HTTP headers required in all requests to get authorization by the server.

Additional HTTP headers may be optionally available or even required.

GET /slcontrol/api/lightRadar/?limit=10&serial=0478303&format=json HTTP/1.1
Host: esaveag.com
X-PUBLIC-KEY: 90a236c3cae7f726a1a993460fe03c0b
X-SIGNATURE: df11689d8c690c10d72bbfad1d2afe46

X-PUBLIC-KEY

You will receive a public key by an esave-Administrator. Just add it as given.

X-SIGNATURE

You will also receive your private key. You need this key to calculate the X-Signature. It is a simple MD5-Hash (Text-mode, not binary mode) as the following pseudo-code shows:

MD5( api/API endpoint/BASE64_ENCODED_STRINGae6ec807800829494c6621ad96f3437a ) 

Do not forget the Slash after API endpoint even if you do not use any URL parameters.

Do not include any URL parameters for calculation of the hash.

BASE64_ENCODED_STRING

The content of the message must be base64 encoded for the calculation of the X-Signature.

Required for POST and PUT Requests only.

HTTP Response codes

You should receive one of the following response codes if you are addressing our API correctly.

HTTP/1.1 200 OK
HTTP/1.1 201 Created
HTTP/1.1 204 No Content

401 - Unauthorized

If you are receiving the following HTTP status code, there probably is something wrong with your hash calculation or you are trying to access something you are not allowed to. Ask esave for help if you cannot figure the problem out by yourself.

HTTP/1.1 401 Unauthorized

400 - Bad Request

If you are receiving the follwoing HTTP status code, your request is either completely fucked up or you are trying to do something you really must not do.

HTTP/1.1 400 Bad Request

If we can identify what is going wrong, you will receive a JSON error that looks like this:

{"error":1001}

You will find the description for such error codes within the documentation for the API Endpoint you are trying to access.

We do not look for all possible errors. We stop parsing as soon as we encounter any grave error.

Data formats/encodings

Charset of content of requests and responses must be UTF-8.

Requests

Content format is JSON and data must be properly JSON-encoded.

URL-Parameter values must be URL-encoded.

Responses

Default Content format is JSON.

Content format may be XML if requested by using the approriate URL Parameter.

Root node of XML is always named slControl.

Dates

Date format is ISO if not declared otherwise.

Dates ar local time if not stated/requested otherwise.

Identifiers

Usually, anything is identified by its respective slcID (slControl system ID). But there are, as always, some exceptions.

Expect to handle the following Identifiers, also:

slcDeviceAddress - field communication address of a device/lamp
slcWirelessID - field communication address of a gateway
slcHardwareID - hardware id of a gateway