Senquip Cloud API Documentation¶
Senquip Support: support@senquip.com
The Senquip Cloud API allows 3rd party access to data collected by the Senquip Portal. The API is not intended to fully replace the Senquip Portal, which can still be used to view and configure device information.
Note
Access to the Senquip Cloud API requires a Hosted plan for each device.
Versioning¶
API releases follow the version numbering system: MAJOR.MINOR.PATCH
Authorization¶
The API is secured using HTTPS and OAuth 2.0 client_credentials
grant type.
The following authorization information is available once the account is setup on the Senquip system.
Token URL
Client ID
Client Secret
Endpoint URL
Authorization Flow¶
End application makes a request to the Token URL. In order to indicate that the app is authorized to make the request, the Authorization header for this request is set as
Basic BASE64(CLIENT_ID:CLIENT_SECRET)
, whereBASE64(CLIENT_ID:CLIENT_SECRET)
is the base64 representation of the Client ID and Client secret, concatenated with a colon.Test Command:
curl -i -H 'Content-Type: application/x-www-form-urlencoded' -X POST 'TOKEN URL' -d 'grant_type=client_credentials' -H 'Authorization: Basic BASE64(CLIENT_ID:CLIENT_SECRET)'
If the access token request is valid, the authorization server returns a JSON object with the following keys:
access_token – A valid access token.
expires_in – The length of time (in seconds) that the provided access token is valid for.
token_type – Set to “Bearer”.
The app uses the access token in the Authorization header when making requests to the Endpoint URL.
Test Command:
curl -X GET 'ENDPOINT URL' -H 'Content-Type: application/json' -H 'Authorization: TOKEN'
Endpoints¶
-
GET
/get-data/{query}
¶ get-data
Retrieves data for a given device by returning an array of datapoints for the provided Device ID. The number of datapoints returned, and a time range can be specified. If the ‘from’ and ‘to’ parameters are omitted, the latest ‘datapoints’ are returned.
- Parameters
deviceid (string) – Senquip Device ID for which data is requested.
- Query Parameters
datapoints (string) – Requested number of data entries to return. Optional - Default (1)
from (string) – Starting timestamp. Optional.
to (string) – Ending timestamp. Optional.
- Status Codes
200 OK – 200 response