Decoder

Add sensor to decoder

post
POST decoders/:decoder_id/sensors/:sensor_type_id

Adds the supplied sensor and key to the associated decoder

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: Yes Description:

The decoders unique id

Parameter: sensor_type_id Type: String Required: Yes Description:

The sensor types id which is to be added to the decoder

Parameter: key Type: String Required: Yes Description:

The unique key which identifies this reading within the decoder

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object Description:

The current sensor types and their associated keys

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/decoders/:decoder_id/sensor/:sensor_type_id
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"key": "sensor-key"}'
$curl = curl_init();
$data = ["key" => "sensor-key"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders/:decoder_id/sensor/:sensor_type_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders/:decoder_id/sensor/:sensor_type_id");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"key\": \sensor-key\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
[
{
   "sensor_typeId": "qQ3",
    "key": "temp1"
 },..
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a device decoder

post
POST decoders

Creates the supplied decoder which is used for decoding data for a type of device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: name Type: String Required: Yes Description:

The decoders name

Parameter: description Type: String Required: Yes Description:

The decoders description

Parameter: type Type: String Required: Yes Description:

The device decoders type must be bluetooth, lorawan, serial or other

Parameter: loraWanMacVersion Type: String Required: No Description:

The LoraWAN Mac Version

Parameter: loraWanRevision Type: String Required: No Description:

The LoraWAN Regional parameters

Parameter: loraSupportClassB Type: Boolean Required: No Description:

LoraWAN Class Capabilities

Parameter: loraSupportClassC Type: Boolean Required: No Description:

LoraWAN Class Capabilities

Parameter: useRawPayload Type: Boolean Required: No Description:

Determines if the raw payload is provided for Things-Network and Sig-fox integrations

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created decoder

Field: id Type: String Description:

The decoders platform unique id

Field: name Type: String Description:

The decoders name

Field: description Type: String Description:

The decoders description

Field: type Type: String Description:

The decoders type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/decoders
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "decoder-name", "description": "decoder-description", "type": "decoder-type"}'
$curl = curl_init();
$data = ["name" => "decoder-name",  "description" => "decoder-description", "type" => "decoder-type"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"decoder-name\", \"description\": \"decoder-description\", \"type\": \"decoder-type\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
      "name": "decoder-name",
      "description": "decoder-description",
      "type": "decoder-type",
      "loraWanMacVersion": "1.0.3",
      "loraWanRevision": "A",
      "loraSupportClassB": 0,
      "loraSupportClassC": 0,
      "useRawPayload" : 0,
      "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "description": [
             "The description field is required."
         ]
     }
}

Delete sensor from decoder

delete
DELETE decoders/:decoder_id/sensors/:key

Deletes the supplied sensor based on the supplied key and decoder_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: Yes Description:

The decoders unique id

Parameter: key Type: String Required: Yes Description:

The sensor key to be removed

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object Description:

the current sensor types and their associated keys

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/decoders/:decoder_id/sensor/:key
-X DELETE
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders/:decoder_id/sensor/:key");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);     *
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders/:decoder_id/sensor/:key");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
{
   "sensor_typeId": "qQ3",
    "key": "temp1"
 },..
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "key": [
             "The key field is required."
         ]
     }
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a decoder

get
GET decoders/:decoder_id

Gets the specified decoder

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: Yes Description:

The decoder unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested decoder

Field: id Type: String Description:

The decoders platform unique id

Field: name Type: String Description:

The decoder's name

Field: description Type: String Description:

The decoder's description

Field: type Type: String Description:

The decoders type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/decoders/:decoder_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders/:decoder_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders/:decoder_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
  "name": "decoder-name",
  "description": "decoder-description",
  "type": "decoder-type",
  "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get all sensors for a decoder

get
GET decoders/:decoder_id/sensors

Get all the sensors for the supplied decoder

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: Yes Description:

The decoders unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

The decoders current senors

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/decoders/:decoder_id/sensors
-X GET \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders/:decoder_id/sensors");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders/:decoder_id/sensors");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
{
   "sensor_typeId": "qQ3",
    "key": "temp1"
 },..
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get all decoders

get
GET decoders

Get all decoders

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

decoders

Field: id Type: String Description:

The decoders platform unique id

Field: name Type: String Description:

The decoders name

Field: description Type: String Description:

The decoders description

Field: type Type: String Description:

The decoders type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/decoders
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/decoders");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/decoders");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
     {
      "name": "decoder-name",
      "description": "decoder-description",
      "type": "decoder-type",
      "id": "zQJtnXr75o"
       },
     ...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Device

Add an event marker

post
POST devices/:device_id/:event_marker_id/add-event-marker

Adds an event marker to the associated device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The id of the device to attach the event marker to

Parameter: event_marker_id Type: String Required: Yes Description:

The event marker type to be used

Parameter: comment Type: String Required: Yes Description:

Description of the event marker

Parameter: date_published Type: Datetime Required: No Description:

The date of the event if not set will set to current date time

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

newly event marker

Response Fields (SUCCESS 200)

Field Type Description
Field: id Type: String Description:

The event marker id

Field: comment Type: String Description:

The event comment

Field: created_at Type: String Description:

The datetime the device was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/:event_marker_id/add-event-marker \
-X POST \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json" \
-d '{"comment": "event-comment", "date_published": "2022-12-22 16:11:42"}'
$curl = curl_init();
$data = ["comment" => "event-comment",  "date_published" => "2022-12-22 16:11:42"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/:event_marker_id/add-event-marker");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/:event_marker_id/add-event-marker");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"comment\": \"event-comment\", \"date_published\": \"2022-12-22 16:11:42\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
     "comment": "event-comment",
     "date_published": "2022-12-22T16:45:06.000000Z",
     "updated_at": "2022-12-22T16:45:06.000000Z",
     "created_at": "2022-12-22T16:45:06.000000Z",
     "id": "event-marker-id"
    }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:F

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "comment": [
             "The comment field is required."
         ]
     }
}

404-Error-Response:

HTTP/1.1 404 Not Found

Add device readings

post
POST devices/:device_id/add-reading

Adds the supplied device readings for sensor parsing

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The id of the device the reading is being recorded against

Parameter: reading Type: Array Required: Yes Description:

The frame to be processed by the associated decoder

Parameter: readings Type: Array Required: No Description:

Array of sensor frames processed by the associated decoder, limited to 100 readings per submission

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/add-reading \
-X POST \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json" \
-d '{"readings": [{"latitude": 37.7749, "longitude": -122.4194, "temperature": 5, "humidity": 50, "co2": 400, "pm25": 10, "pm10": 20}]}'
$curl = curl_init();
$data = [
"readings" => [
[
"latitude" => 37.7749,
"longitude" => -122.4194,
"temperature" => 5,
"humidity" => 50,
"co2" => 400,
"pm25" => 10,
"pm10" => 20
]
]
];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/add-reading");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/add-reading");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json", "{\"readings\": [{\"latitude\": 37.7749, \"longitude\": -122.4194, \"temperature\": 5, \"humidity\": 50, \"co2\": 400, \"pm25\": 10, \"pm10\": 20}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a Bluetooth device

post
POST devices/:location_id/:decoder_id/bluetooth

Creates the supplied Bluetooth IoT Device, based on the associated device decoder and links to the supplied location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The id of the location the device is being added to

Parameter: decoder_id Type: String Required: Yes Description:

The id of the device decoder to be used for processing and sensor types

Parameter: mac_address Type: String Required: Yes Description:

The device macaddress.

Parameter: name Type: String Required: Yes Description:

The device name.

Parameter: comment Type: String Required: No Description:

The device comments.

Parameter: longitude Type: String Required: No Description:

The device longitude.

Parameter: latitude Type: String Required: No Description:

The device latitude.

Parameter: altitude Type: String Required: No Description:

The device altitude.

Parameter: parser_params Type: Json Required: No Description:

The device optional decoder parameters associated with this device.

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created device

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: mac_address Type: String Description:

The device's unique macaddress

Field: comment Type: String Description:

The device's comments

Field: longitude Type: Double Description:

The device's longitude

Field: latitude Type: Double Description:

The device's latitude

Field: altitude Type: Double Description:

The device's altitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: created_at Type: String Description:

The datetime the device was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:location_id/:decoder_id/bluetooth
-X POST \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json" \
-d '{"name": "device-name", "mac_address": "device-mac_address", "comment": "device-comment"}'
$curl = curl_init();
$data = ["name" => "device-name",  "mac_address" => "device-mac_address", "comment" => "device-comment"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:location_id/:decoder_id/bluetooth");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:location_id/:decoder_id/bluetooth");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"device-name\", \"mac_address\": \"device-mac_address\", \"comment\": \"device-comment\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
      "mac_address": "device-mac_address",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "altitude": "device-altitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "identifier": [
             "The identifier field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Device has already been claimed."
}

External data webhook Chirp Stack

post
POST devices/external-data-webhook/chirp-stack/:decoder_id

Allows the submission of JSON frame to a named device from Chirp Stack, new devices are auto allocated into an imported location

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer Authorization Token

Header: Accept Type: String Required: Yes Description:

Accept content type

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: No Description:

the optional Decoder ID can be used to map the device to a decoder.

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Core IoT Sensors which the updates apply to

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"Forbidden"

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 400)

Field Type Description
Field: message Type: String Description:

"Invalid JSON"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/external-data-webhook/chirp-stack
-X POST
-H "Content-type: application/json"
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-d '{"temp" : "23"}'
$curl = curl_init();
$data = ["temp" => "23"];
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/external-data-webhook/chirp-stack");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization:Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/external-data-webhook/chirp-stack");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"temp\" : \"23\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 Created
{
    "success": true,
    "data": [ "Device 1"],
    "message": "Sensor Data Uploaded"
}

Error Response Example

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "Forbidden."
}

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid JSON."
}

Get a device sensors

get
GET devices/:device_id:/sensors

Get a device sensors

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: searchKey Type: String Required: No Description:

Optional search terms to match sensors with similar names

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensors

Field: id Type: String Description:

The sensors unique id

Field: device_id Type: String Description:

The associated device id

Field: key Type: String Description:

The sensors unique key used for frame mapping

Field: name Type: String Description:

The sensors name

Field: slope Type: Numeric Description:

The slope to be applied to sensor values

Field: offset Type: Numeric Description:

The offset to be applied to sensor values

Field: retention_days Type: Int Description:

How long sensor data will be stored before being cleared down

Field: sensor_type_id Type: String Description:

The associated sensor type id

Field: created_at Type: String Description:

The datetime the sensor was created

Field: updated_at Type: String Description:

The datetime the sensor was last updated

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/sensor-data/latest
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/sensor-data/latest");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/sensor-data/latest");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
   {
      "id": "sensor-id",
      "device_id": "device-id",
      "key": "sensor-key",
      "name": "sensor-name",
      "slope": 1,
      "offset": 0,
      "retention_days": 90,
      "created_at": "2022-09-28T11:11:01.000000Z",
      "updated_at": "2022-09-28T11:11:01.000000Z",
      "sensor_type_id": "sensor-type-id"
      },..
  ]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

External data webhook Sigfox

post
POST devices/external-data-webhook/sigfox/:decoder_id

Allows the submission of JSON frame to a named device from Sigfox, new devices are auto allocated into an imported location

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer Authorization Token

Header: Accept Type: String Required: Yes Description:

Accept content type

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: No Description:

the optional Decoder ID can be used to map the device to a decoder.

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Core IoT Sensors which the updates apply to

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"Forbidden"

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 400)

Field Type Description
Field: message Type: String Description:

"Invalid JSON"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/external-data-webhook/sigfox
-X POST
-H "Content-type: application/json"
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-d '{"temp" : "23"}'
$curl = curl_init();
$data = ["temp" => "23"];
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/external-data-webhook/sigfox");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization:Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/external-data-webhook/sigfox");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"temp\" : \"23\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 Created
{
    "success": true,
    "data": [ "Device 1"],
    "message": "Sensor Data Uploaded"
}

Error Response Example

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "Forbidden."
}

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid JSON."
}

External data webhook Things Network

post
POST devices/external-data-webhook/things-network/:decoder_id

Allows the submission of JSON frame to a named device from The Things-network, new devices are auto allocated into an imported location

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer Authorization Token

Header: Accept Type: String Required: Yes Description:

Accept content type

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: No Description:

the optional Decoder ID can be used to map the device to a decoder.

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Core IoT Sensors which the updates apply to

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"Forbidden"

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 400)

Field Type Description
Field: message Type: String Description:

"Invalid JSON"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/external-data-webhook/things-network
-X POST
-H "Content-type: application/json"
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-d '{"temp" : "23"}'
$curl = curl_init();
$data = ["temp" => "23"];
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/external-data-webhook/things-network");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization:Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/external-data-webhook/things-network");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"temp\" : \"23\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 Created
{
    "success": true,
    "data": [ "Device 1"],
    "message": "Sensor Data Uploaded"
}

Error Response Example

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "Forbidden."
}

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid JSON."
}

Create a non LoRaWAN/Bluetooth device

post
POST devices/:location_id/:decoder_id/other

Creates the supplied Other IoT Device, based on the associated device decoder and links to the supplied location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The id of the location the device is being added to

Parameter: decoder_id Type: String Required: Yes Description:

The id of the device decoder to be used for processing and sensor types

Parameter: identifier Type: String Required: Yes Description:

The device unique identifier.

Parameter: name Type: String Required: Yes Description:

The device name.

Parameter: comment Type: String Required: No Description:

The device comments.

Parameter: longitude Type: String Required: No Description:

The device longitude.

Parameter: latitude Type: String Required: No Description:

The device latitude.

Parameter: altitude Type: String Required: No Description:

The device altitude.

Parameter: parser_params Type: Json Required: No Description:

The device optional decoder parameters associated with this device.

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created device

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: identifier Type: String Description:

The device's unique identifier

Field: comment Type: String Description:

The device's comments

Field: longitude Type: Double Description:

The device's longitude

Field: latitude Type: Double Description:

The device's latitude

Field: altitude Type: Double Description:

The device's altitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: created_at Type: String Description:

The datetime the device was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:location_id/:decoder_id/other
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "device-name", "identifier": "device-identifier", "comment": "device-comment"}'
$curl = curl_init();
$data = ["name" => "device-name",  "identifier" => "device-identifier", "comment" => "device-comment"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:location_id/:decoder_id/other");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:location_id/:decoder_id/other");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"device-name\", \"identifier\": \"device-identifier\", \"comment\": \"device-comment\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
      "identifier": "device-identifier",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "altitude": "device-altitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "identifier": [
             "The identifier field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Device has already been claimed."
}

Get sensor readings for the supplied device

get
GET devices/:device_id/sensor-data

Gets sensor readings for the supplied device_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The id of the device being requested

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: limit Type: Int Required: No Description:

Record limit max 1000 records

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/sensor-data
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/sensor-data");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/sensor-data");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
     "device" {
             "id": "device-id",
              "name": "device-name",
              "identifier": "device_identifier",
               "sensors": [
                 {
                     "id": "sensor-id",
                     "name": "sensor-name",
                     "array_key" "array-key",
                     "sensor_type": {
                         "name": "Temp"
                         "metric_units": "°C",
                         "imperial_units": "°F",
                         "default_units": "°C"
                     }
             }
             ]
     },
     "readings": [
             {
             "sensorreadingdate":"2022-05-14 00:00:00",
              "sensorreadingdate_local":"2022-05-14 01:00:00",
             "type":"value",
             "sensor_id":"sensor-id"}
         ]
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get sensor readings for the supplied device based on the aggregate type

get
GET devices/:device_id/sensor-data/aggregate/:type

Gets the aggregate sensor readings for the supplied device_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The id of the device being requested

Parameter: type Type: String Required: Yes Description:

The aggregate type must be one of the following first,min,max,ave,min_ave_max

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: granularity Type: String Required: No Description:

Record sample granularity should be in minute,half_minute,five_minutes,ten_minutes,quarter_hour,hour,half_hour,three_hours,six_hours,nine_hours,day,half_day,week,ten_days,two_weeks,month

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Field: sensor_id Type: String Description:

Associated sensor platform id

Field: name Type: String Description:

Sensor type

Field: reading_date Type: String Description:

The datetime the data was recorded

Field: value Type: Numeric Description:

The sensor value

Field: metric_units Type: String Description:

Metric unit type

Field: imperial_units Type: String Description:

Imperial unit type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/sensor-data/aggregate/:type
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/sensor-data/aggregate/:type");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/sensor-data/aggregate/:type");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "device" {
              "id": "device-id",
               "name": "device-name",
               "identifier": "device_identifier",
                "sensors": [
                  {
                      "id": "sensor-id",
                      "name": "sensor-name",
                      "array_key" "array-key",
                      "sensor_type": {
                          "name": "Temp"
                          "metric_units": "°C",
                          "imperial_units": "°F",
                          "default_units": "°C"
                      }
              }
             ]
      },
      "readings": [
              {
              "sensorreadingdate":"2022-05-14 00:00:00",
               "sensorreadingdate_local":"2022-05-14 01:00:00",
              "type":"value",
              "sensor_id":"sensor-id"}
          ]
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Gets the latest sensor readings for the supplied device

get
GET devices/:device_id/sensor-data/latest

Gets the most recent device sensor readings

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The id of the device being requested

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/sensor-data/latest
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/sensor-data/latest");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/sensor-data/latest");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
{
  "display_name": "Temperature",
  "sensorreadingdate": "2024-07-22 12:01:12",
  "value": 20,
  "display_significance": 1,
  "metric_units": "°C",
  "imperial_units": "°F",
  "default_units": "°C",
  "system_of_measure": "metric",
  "sensor_type_id": "sensor-type-id",
  "sensorTypeName": "Temperature",
  "deviceName": "MQTT",
  "array_key": "temp",
  "sensor_id": "sensor-id",
  "sensorreadingdate_local": "2024-07-22 13:01:12"
 }
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Delete a device

delete
DELETE devices/:device_id

Delete the specified Device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The device's unique id

Response Fields (SUCCESS 204)

Field Type Description
Field: 204 Type: String Description:

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Device"

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id \
-X DELETE \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 204 NO CONTENT

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Device."
}

External data webhook

post
POST devices/external-data-webhook/other/:deviceId

Allows the submission of JSON frame to a named device

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer Authorization Token

Header: Accept Type: String Required: Yes Description:

Accept content type

Parameter

Parameter Type Required Description
Parameter: deviceId Type: String Required: No Description:

Core IoT Device ID which the JSON applies to

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Core IoT Sensors which the updates apply to

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"Forbidden"

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 400)

Field Type Description
Field: message Type: String Description:

"Invalid JSON"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/external-data-webhook/other/:deviceId
-X POST
-H "Content-type: application/json"
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-d '{"temp" : "23"}'
$curl = curl_init();
$data = ["temp" => "23"];
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/external-data-webhook/other/:deviceId");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization:Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/external-data-webhook/other/:deviceId");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"temp\" : \"23\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 Created
{
    "success": true,
    "data": [ "Device 1"],
    "message": "Sensor Data Uploaded"
}

Error Response Example

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "Forbidden."
}

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid JSON."
}

External data webhook Aranet

post
POST devices/external-data-webhook/aranet/:decoder_id

Allows the submission of JSON frame to a named device from Aranet, new devices are auto allocated into an imported location

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer Authorization Token

Header: Accept Type: String Required: Yes Description:

Accept content type

Parameter

Parameter Type Required Description
Parameter: decoder_id Type: String Required: No Description:

the optional Decoder ID can be used to map the device to a decoder.

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Core IoT Sensors which the updates apply to

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"Forbidden"

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 400)

Field Type Description
Field: message Type: String Description:

"Invalid JSON"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/external-data-webhook/aranet
-X POST
-H "Content-type: application/json"
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-d '{"temp" : "23"}'
$curl = curl_init();
$data = ["temp" => "23"];
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/external-data-webhook/aranet");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization:Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/external-data-webhook/aranet");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"temp\" : \"23\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 Created
{
    "success": true,
    "data": [ "Device 1"],
    "message": "Sensor Data Uploaded"
}

Error Response Example

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "Forbidden."
}

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid JSON."
}

Get all devices

get
GET devices

Get all devices

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

devices

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: identifier Type: String Description:

The device's unique identifier or Device EUI if a LoRaWAN Device

Field: comment Type: String Description:

The device's comments

Field: longitude Type: String Description:

The device's longitude

Field: latitude Type: String Description:

The device's latitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: frame_logging Type: String Description:

Returns if device logging is enabled

Field: parameters Type: String Description:

Returns any bespoke device parameters used by the device decoder, for example for sensor calibration

Field: updated_at Type: String Description:

The datetime the location was created

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/devices
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
     {
      "identifier": "device-identifier",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "frame_logging" : "device-frame-logging",
      "parameters" : "device-parameters",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
     },
     ...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a device

get
GET devices/:device_id

Gets the specified device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The device's unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested device

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: identifier Type: String Description:

The device's unique identifier or Device EUI if a LoRaWAN Device

Field: comment Type: String Description:

The device's comments

Field: longitude Type: String Description:

The device's longitude

Field: latitude Type: String Description:

The device's latitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: frame_logging Type: String Description:

Returns if device logging is enabled

Field: parameters Type: String Description:

Returns any bespoke device parameters used by the device decoder, for example for sensor calibration

Field: updated_at Type: String Description:

The datetime the location was created

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Device"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "identifier": "device-identifier",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "frame_logging" : "device-frame-logging",
      "parameters" : "device-parameters",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Device."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a device from its identifier

get
GET devices/from-identifier/:device_identifier

Gets the specified device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_identifier Type: String Required: Yes Description:

The device's unique identifier, for LoRaWAN this is the device_eui, or Bluetooth the MACAddress

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested device

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: identifier Type: String Description:

The device's unique identifier or Device EUI if a LoRaWAN Device

Field: comment Type: String Description:

The device's comments

Field: longitude Type: String Description:

The device's longitude

Field: latitude Type: String Description:

The device's latitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: frame_logging Type: String Description:

Returns if device logging is enabled

Field: parameters Type: String Description:

Returns any bespoke device parameters used by the device decoder, for example for sensor calibration

Field: updated_at Type: String Description:

The datetime the location was created

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Device"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_identifier
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/from-identifier/:device_identifier");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/from-identifier/:device_identifier");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "identifier": "device-identifier",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "frame_logging" : "device-frame-logging",
      "parameters" : "device-parameters",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Device."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Update a device

put
PUT devices/:device_id

Updates the specified device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The device's platform unique id

Parameter: name Type: String Required: No Description:

The device's name

Parameter: comment Type: String Required: No Description:

The device's comments

Parameter: decoder_id Type: String Required: No Description:

The device decoder id

Parameter: location_id Type: String Required: No Description:

The location id

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Updated device

Field: altitude Type: Double Description:

The device's altitude

Response Fields (SUCCESS 200)

Field Type Description
Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: identifier Type: String Description:

The device's unique identifier or Device EUI if a LoRaWAN Device

Field: comment Type: String Description:

The device's comments

Field: longitude Type: Double Description:

The device's longitude

Field: latitude Type: Double Description:

The device's latitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: frame_logging Type: String Description:

Returns if device logging is enabled

Field: parameters Type: String Description:

Returns any bespoke device parameters used by the device decoder, for exmaple for sensor calibration

Field: updated_at Type: String Description:

The datetime the location was created

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Device"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

PUT

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id
-X PUT
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "device-name", "comment": "device-comment"}'
$curl = curl_init();
$data = ["name" => "device-name", "comment" => "device-comment"];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"name\": \"device-name\",\"comment\": \"device-comment\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "identifier": "device-identifier",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "altitude": "device-altitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "frame_logging" : "device-frame-logging",
      "parameters" : "device-parameters",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Device."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Disable frame logging

post
POST devices/:device_id/logging/disable

Disable Frame logging for the supplied device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The device id to enable logging

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/logging/disable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/logging/disable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/logging/disable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Enable frame logging

post
POST devices/:device_id/logging/enable

Enables Frame logging for the supplied device

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: device_id Type: String Required: Yes Description:

The device id to enable logging

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/logging/enable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/logging/enable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/logging/enable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a LoRaWAN device

post
POST devices/:location_id/:decoder_id/loRaWAN

Creates the supplied LoRaWAN IoT Device, based on the associated device decoder and links to the supplied location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The id of the location the device is being added to

Parameter: decoder_id Type: String Required: Yes Description:

The id of the device decoder to be used for processing and sensor types

Parameter: device_eui Type: String Required: Yes Description:

The device LoRaWAN EUI.

Parameter: app_key Type: String Required: Yes Description:

The device LoRaWAN Application Key.

Parameter: name Type: String Required: Yes Description:

The device name.

Parameter: comment Type: String Required: No Description:

The device comments.

Parameter: longitude Type: String Required: No Description:

The device longitude.

Parameter: latitude Type: String Required: No Description:

The device latitude.

Parameter: altitude Type: String Required: No Description:

The device altitude.

Parameter: parser_params Type: Json Required: No Description:

The device optional decoder parameters associated with this device.

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created device

Field: id Type: String Description:

The device's platform unique id

Field: name Type: String Description:

The device's name

Field: device_eui Type: String Description:

The device's unique LoRaWAN EUI

Field: app_key Type: String Description:

The device's Application Key

Field: comment Type: String Description:

The device's comments

Field: longitude Type: Double Description:

The device's longitude

Field: latitude Type: Double Description:

The device's latitude

Field: altitude Type: Double Description:

The device's altitude

Field: type Type: String Description:

The device type

Field: decoder_id Type: String Description:

The associated device decoder

Field: gateway_id Type: String Description:

The associated gateway

Field: location_id Type: String Description:

The associated location

Field: created_at Type: String Description:

The datetime the device was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:location_id/:decoder_id/loRaWAN
-X POST \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json" \
-d '{"name": "device-name", "device_eui": "device-device_eui", "comment": "device-comment"}'
$curl = curl_init();
$data = ["name" => "device-name",  "device_eui" => "device-device_eui", "comment" => "device-comment"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:location_id/:decoder_id/loRaWAN");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:location_id/:decoder_id/loRaWAN");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"device-name\", \"device_eui\": \"device-device_eui\", \"comment\": \"device-comment\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
      "device_eui": "device-device_eui",
      "app_key": "device-app_key",
      "name": "device-dame",
      "comment": "device-comment",
      "latitude": "device-latitude",
      "longitude": "device-longitude",
      "altitude": "device-altitude",
      "location_id": "device-location-id",
      "decoder_id": "decoder-id",
      "type": "device-type",
      "gateway_id": "device-gateway-id",
      "created_at": "device-created-at",
      "id": "device-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "identifier": [
             "The identifier field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Device has already been claimed."
}

Create a device certificate

post
POST devices/:device_id/generate-certificate

Creates a device certificate

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: csr Type: String Required: Yes Description:

The Certificate sign request to be signed for the specified location

Parameter: identifier Type: String Required: Yes Description:

The Gateways unique identifier

Response Fields (SUCCESS 200)

Field Type Description
Field: certificate Type: String Description:

The device certificate

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/devices/:device_id/generate-certificate\
-X POST \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-H "Accept: application/json" \
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/devices/:device_id/generate-certificate");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/devices/:device_id/generate-certificate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "certificate": "device-certificate"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Event-Marker

Create an event marker

post
POST event-markers

Creates the supplied event marker to be used by devices

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: name Type: String Required: Yes Description:

The name of the event marker

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created gateway

Field: id Type: String Description:

The event marker platform unique id

Field: name Type: String Description:

The event marker name

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/event-markers
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "event-name"}'
$curl = curl_init();
$data = ["name" => "event-name"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/event-markers/");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/event-markers");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"event-name\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
     "name": "event-marker-name",
     "id": "event-marker-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

    *

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The marker already exists."
}

Gateway

Disable frame logging

post
POST gateways/:gateway_id/logging/disable

Disable Frame logging for the supplied gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateway_id to enable logging

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/logging/disable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/logging/disable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/logging/disable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Enable frame logging

post
POST gateways/:gateway_id/logging/enable

Enables Frame logging for the supplied gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateway_id to enable logging

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/logging/enable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/logging/enable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/logging/enable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a gateway

post
POST gateways/:location_id

Creates the supplied gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The id of the location the gateway is being added to

Parameter: identifier Type: String Required: Yes Description:

The Gateways unique identifier

Parameter: name Type: String Required: Yes Description:

The Gateways name

Parameter: comment Type: String Required: No Description:

Gateway comments

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created gateway

Field: id Type: String Description:

The gateway's platform unique id

Field: name Type: String Description:

The gateway's name

Field: identifier Type: String Description:

The gateway's unique identifier

Field: comment Type: String Description:

The gateway's comments

Field: longitude Type: Double Description:

The gateway's longitude

Field: latitude Type: Double Description:

The gateway's latitude

Field: altitude Type: Double Description:

The gateway's altitude

Field: type Type: String Description:

The gateway's type the values should be 'edge gateway' for aql gateways or 'lorawan' for third party gateways

Field: created_at Type: String Description:

The datetime the gateway was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Error message"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:location_id
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "gateway-name", "identifier": "gateway-identifier", "comment": "gateway-comment"}'
$curl = curl_init();
$data = ["name" => "gateway-name",  "identifier" => "gateway-identifier", "comment" => "gateway-comment"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:location_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:location_id");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"name\": \"gateway-name\", \"identifier\": \"gateway-identifier\", \"comment\": \"gateway-comment\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
     "name": "gateway-name",
     "identifier": "gateway-identifier",
     "comment": "gateway-comment",
     "type": "gateway-type",
     "longitude": "gateway-longitude",
     "latitude": "gateway-latitude",
     "altitude": "gateway-altitude",
     "created_at": "2022-11-30T15:27:19.000000Z",
     "id": "gateway-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "identifier": [
             "The identifier field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "type": [
             "The type field is required."
         ]
     }
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Gateway has already been claimed."
}

Get the gateways sensor readings

get
GET gateways/:gateway_id/sensor-data

Get sensor readings for the supplied gateway, limited to 1000 readings

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The id of the gateway being requested

Parameter: limit Type: Numeric Required: No Description:

Record limit max 1000 records

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD).

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD).

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/sensor-data
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/sensor-data");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/sensor-data");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
       "gateway" {
               "id": "gateway-id",
                "name": "gateway-name",
                "identifier": "gateway_identifier",
                 "sensors": [
                   {
                       "id": "sensor-id",
                       "name": "sensor-name",
                       "array_key" "array-key",
                       "sensor_type": {
                           "name": "Temp"
                           "metric_units": "°C",
                           "imperial_units": "°F",
                           "default_units": "°C"
                       }
               }
              ]
       },
       "readings": [
               {
               "sensorreadingdate":"2022-05-14 00:00:00",
                "sensorreadingdate_local":"2022-05-14 01:00:00",
               "type":"value",
               "sensor_id":"sensor-id"}
           ]
 }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get sensor readings for the supplied gateway based on the aggregate type

get
GET gateways/:gateway_id/sensor-data/aggregate/:type

Gets the aggregate sensor readings for the supplied gateway_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The id of the gateway being requested

Parameter: type Type: String Required: Yes Description:

The aggregate type must be one of the following first,min,max,ave,min_ave_max

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: granularity Type: String Required: No Description:

Record sample granularity should be in minute,half_minute,five_minutes,ten_minutes,quarter_hour,hour,half_hour,three_hours,six_hours,nine_hours,day,half_day,week,ten_days,two_weeks,month

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/sensor-data/aggregate/:type
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/sensor-data/aggregate/:type");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/sensor-data/aggregate/:type");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "gateway" {
              "id": "gateway-id",
               "name": "gateway-name",
               "identifier": "gateway_identifier",
                "sensors": [
                  {
                      "id": "sensor-id",
                      "name": "sensor-name",
                      "array_key" "array-key",
                      "sensor_type": {
                          "name": "Temp"
                          "metric_units": "°C",
                          "imperial_units": "°F",
                          "default_units": "°C"
                      }
              }
             ]
      },
      "readings": [
              {
              "sensorreadingdate":"2022-05-14 00:00:00",
              "sensorreadingdate_local":"2022-05-14 01:00:00",
              "type":"value",
              "sensor_id":"sensor-id"}
          ]
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Gets the latest sensor readings for the supplied gateway

get
GET gateways/:gateway_id/sensor-data/latest

Gets the most recent gateway sensor readings

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The id of the gateway being requested

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/sensor-data/latest
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/sensor-data/latest");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/sensor-data/latest");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
{
  "display_name": "Temperature",
  "sensorreadingdate": "2024-07-22 12:01:12",
  "value": 20,
  "display_significance": 1,
  "metric_units": "°C",
  "imperial_units": "°F",
  "default_units": "°C",
  "system_of_measure": "metric",
  "sensor_type_id": "sensor-type-id",
  "sensorTypeName": "Temperature",
  "deviceName": "MQTT",
  "array_key": "temp",
  "sensor_id": "sensor-id",
  "sensorreadingdate_local": "2024-07-22 13:01:12"
 }
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Delete a gateway

delete
DELETE gateways/:gateway_id

Delete the specified Gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateway's unique id

Response Fields (SUCCESS 204)

Field Type Description
Field: 204 Type: String Description:

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Gateway"

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id
-X DELETE
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 204 NO CONTENT

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Gateway."
}

Get the latest gateway frames

get
GET gateways/:gateway_id/gateway-frames

Gets the specified gateway frames

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateway's unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested gateway frames

Field: gateway_id Type: String Description:

The gateway's unique id

Field: frame Type: String Description:

The frame alias

Field: comment Type: String Description:

Raw payload frame

Field: created_at Type: String Description:

The datetime the frame created date

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Gateway"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/gateway-frames
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/gateway-frames");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/gateway-frames");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
 {
      "created_at": "2022-11-30T15:27:19.000000Z",
      "gateway_id": "gateway-identifier",
      "frame": "frame",
      "frame_payload": "frame_payload"
 },...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Gateway."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get all gateways

get
GET gateways

Get all gateways

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

gateways

Field: location_id Type: String Description:

The location's unique id

Field: name Type: String Description:

The gateway's name

Field: comment Type: String Description:

The gateway's comments

Field: id Type: String Description:

The gateway's unique id

Field: updated_at Type: String Description:

The datetime the gateway was updated

Field: created_at Type: String Description:

The datetime the gateway was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/gateways
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
     {
          "name": "gateway-name",
          "identifier": "gateway-identifier",
          "comment": "gateway-comment",
          "type": "gateway-type",
          "longitude": "gateway-longitude",
          "latitude": "gateway-latitude",
          "location_id": "location-id",
          "connected_status": "gateway-connect-status",
          "frame_logging": "gateway-frame-logging",
          "created_at": "2022-11-30T15:27:19.000000Z",
          "updated_at": "2022-11-30T15:27:19.000000Z",
          "id": "zQJtnXr75o"
     },
     ...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a gateway

get
GET gateways/:gateway_id

Gets the specified gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateway's unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested gateway

Field: location_id Type: String Description:

The location's unique id

Field: name Type: String Description:

The gateway's name

Field: comment Type: String Description:

The gateway's comments

Field: id Type: String Description:

The gateway's unique id

Field: updated_at Type: String Description:

The datetime the gateway was updated

Field: created_at Type: String Description:

The datetime the gateway was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Gateway"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "name": "gateway-name",
      "identifier": "gateway-identifier",
      "comment": "gateway-comment",
      "type": "gateway-type",
      "longitude": "gateway-longitude",
      "latitude": "gateway-latitude",
      "connected_status": "gateway-connect-status",
      "frame_logging": "gateway-frame-logging",
      "location_id": "location-id",
      "created_at": "2022-11-30T15:27:19.000000Z",
      "updated_at": "2022-11-30T15:27:19.000000Z",
      "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Gateway."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Update a gateway

put
PUT gateways/:gateway_id

Updates the specified gateway

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The gateways platform unique id

Parameter: name Type: String Required: No Description:

The gateway's name

Parameter: comment Type: String Required: No Description:

The gateway's comments

Parameter: location_id Type: String Required: No Description:

The location id

Response Fields (SUCCESS 201)

Field Type Description
Field: The Type: Object Description:

updated gateway

Field: altitude Type: Double Description:

The gateway's altitude

Response Fields (SUCCESS 200)

Field Type Description
Field: location_id Type: String Description:

The location's unique id

Field: name Type: String Description:

The gateway's name

Field: comment Type: String Description:

The gateway's comments

Field: type Type: String Description:

The gateway's type the values should be std for aql gateways or lorawan for third party gateways

Field: longitude Type: Double Description:

The location's longitude

Field: latitude Type: Double Description:

The location's latitude

Field: id Type: String Description:

The gateway's unique id

Field: updated_at Type: String Description:

The datetime the gateway was updated

Field: created_at Type: String Description:

The datetime the gateway was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Gateway"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

PUT

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id
-X PUT
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "gateway-name",  "comment": "gateway-comment"}'
$curl = curl_init();
$data = ["name" => "gateway-name", "comment" => "gateway-comment"];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"name\": \"gateway-name\",\"comment\": \"gateway-comment\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
  "name": "gateway-name",
  "identifier": "gateway-identifier",
 "comment": "gateway-comment",
  "type": "gateway-type",
  "location_id": "location-id",
  "longitude": "gateway-longitude",
  "latitude": "gateway-latitude",
  "altitude": "gateway-altitude",
  "created_at": "2022-11-30T15:27:19.000000Z",
  "updated_at": "2022-11-30T15:27:19.000000Z",
  "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Gateway."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Set gateway to be connected

post
POST gateways/:gateway_id/connected

Sets the gateway to be connected

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: identifier Type: String Required: Yes Description:

The Gateways unique identifier

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/connected
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/connected");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/connected");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Set gateway to be disconnected

post
POST gateways/:gateway_id/disconnected

Sets the gateway to be disconnected

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: identifier Type: String Required: Yes Description:

The Gateways unique identifier

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/disconnected
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/disconnected");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/disconnected");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a gateway certificate

post
POST gateways/:gateway_id/generate-certificate

Creates a gateway certificate

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: csr Type: String Required: Yes Description:

The Certificate sign request to be signed for the specified location

Parameter: identifier Type: String Required: Yes Description:

The Gateways unique identifier

Response Fields (SUCCESS 200)

Field Type Description
Field: certificate Type: String Description:

The gateway certificate

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/gateways/:gateway_id/generate-certificate
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/gateways/:gateway_id/generate-certificate");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/gateways/:gateway_id/generate-certificate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
"certificate": "gateway-certificate"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Integration

Delete a sensor from an integration

delete
DELETE integrations/:integrationId/sensors/:sensor_id

Delete the specified sensor

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: gateway_id Type: String Required: Yes Description:

The device's unique id

Response Fields (SUCCESS 204)

Field Type Description
Field: 204 Type: String Description:

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integrationId/sensors/:sensor_id
-X DELETE
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integrationId/sensors/:sensor_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integrationId/sensors/:sensor_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 204 NO CONTENT

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Disable a integration

post
POST integrations/:integration_id/disable

Disables data processing for the specified integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integration to enable

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id/disable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id/disable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id/disable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Enable a integration

post
POST integrations/:integration_id/enable

Enables data processing for the specified integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integration to enable

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id/enable
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id/enable");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id/enable");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a influxdb integration

post
POST integrations/influxdb

Creates the supplied influxdb integration, this is disabled until sensors are assigned

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: url Type: String Required: Yes Description:

The influxdb host to be called by the integration

Parameter: token Type: String Required: Yes Description:

The influxdb bearer token to be used by the integration

Parameter: organisation Type: String Required: Yes Description:

The influxdb organisation to be used by the integration

Parameter: bucket Type: String Required: Yes Description:

The influxdb bucket to be used by the integration

Parameter: measurement Type: String Required: No Description:

The influxdb measurement to be used by the integration, if null the location description is used

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created mqtt integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The mqtt settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/influxdb
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "url": "integration-url"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "url" => "integration-url"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/influxdb");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/influxdb");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"url\": \"integration-url\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "type": "mqtt",
 "name": "name",
 "settings": "settings json",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Get all sensors for a integration

get
GET integrations/:integration_id/sensors

Get all the sensors for the supplied integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integrations unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

The integration current senors

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id/sensors
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id/sensors");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id/sensors");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
{
  "sensor_uid": "sensor-id",
  "updated_at": "2023-02-21T08:26:35.000000Z",
  "created_at": "2023-02-21T08:26:35.000000Z",
   "id": "platform id"
 },..
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Add sensor to integration

post
POST integrations/:integration_id/sensors/:sensor_id

Adds the specified sensor to the integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integration with which to add the specified sensor to

Parameter: sensor_id Type: String Required: Yes Description:

The sensor to be included with the integration

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created integration

Field: integration_id Type: String Description:

The platform unique id

Field: sensor_id Type: String Description:

The sensor id

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id/sensors/:sensor_id
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id/sensors/:sensor_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id/sensors/:sensor_id");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
  "sensor_uid": "sensor-id",
  "updated_at": "2023-02-21T08:26:35.000000Z",
  "created_at": "2023-02-21T08:26:35.000000Z",
   "id": "platform id"
 }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Delete a integration

delete
DELETE integrations/:integration_id

Delete the specified Integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integrations unique id

Response Fields (SUCCESS 204)

Field Type Description
Field: 204 Type: String Description:

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id
-X DELETE
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 204 NO CONTENT

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get all integrations

get
GET integrations

Get all integrations

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

integrations

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: enabled Type: Boolean Description:

The integration enabled status

Field: settings Type: Json Description:

The integration settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/integrations
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
      {
         "type": "WebHook",
          "execution_type": "live",
          "settings": "settings json",
          "enabled": true,
          "name": "name",
          "updated_at": "2023-02-16T17:05:42.000000Z",
          "created_at": "2023-02-16T17:05:42.000000Z",
          "id": "id"
}
     ...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a integration

get
GET integrations/:integration_id

Gets the specified integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integration unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: enabled Type: Boolean Description:

The integration enabled status

Field: settings Type: Json Description:

The integration settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
         "type": "WebHook",
          "execution_type": "live",
          "settings": "settings json",
          "enabled": true,
          "name": "name",
          "updated_at": "2023-02-16T17:05:42.000000Z",
          "created_at": "2023-02-16T17:05:42.000000Z",
          "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Update an integration

put
PUT integrations/:integration_id

Updates the specified integration

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: integration_id Type: String Required: Yes Description:

The integration platform unique id

Parameter: type Type: String Required: Yes Description:

The type of integration must be WebHook or MQTT

Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: settings Type: Json Required: Yes Description:

The integration settings

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object Description:

Updated integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The integration settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Gateway"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

PUT

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/:integration_id
-X PUT
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "settings": "integration-settings"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "settings" => "integration-settings"];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/:integration_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/:integration_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"settings\": \"integration-settings\}", ParameterType.RequestBody);;
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
 "type": "WebHook",
 "execution_type": "live",
 "settings": "settings json",
 "name": "name",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Gateway."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Create a mqtt integration

post
POST integrations/mqtt

Creates the supplied mqtt integration, this is disabled until sensors are assigned

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: topic Type: String Required: Yes Description:

The mqtt topic used by the integration

Parameter: host Type: String Required: Yes Description:

The mqtt host to be called by the integration

Parameter: port Type: String Required: Yes Description:

The mqtt port to be used by the integration

Parameter: protocol Type: String Required: Yes Description:

The mqtt protocol to be used by the integration, must be mqtt or mqtts

Parameter: auth_type Type: String Required: Yes Description:

The mqtt auth type to be used by the integration, must be cert or user

Parameter: ca Type: String Required: Yes Description:

The mqtt ca used when auth_type is cert

Parameter: key Type: String Required: Yes Description:

The mqtt key used when auth_type is cert

Parameter: username Type: String Required: Yes Description:

The mqtt username used when auth_type is user

Parameter: password Type: String Required: Yes Description:

The mqtt password used when auth_type is user

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created mqtt integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The mqtt settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/mqtt
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "host": "integration-host"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "host" => "integration-host"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/mqtt");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/mqtt");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"host\": \"integration-host\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "type": "mqtt",
 "name": "name",
 "settings": "settings json",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Create a Slack integration

post
POST integrations/slack

Creates the supplied Slack integration, this is disabled until sensors are assigned

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: url Type: String Required: Yes Description:

The webhook url to invoke

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created Slack integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The Slack settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/slack
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "host": "integration-host"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "host" => "integration-host"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/slack");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/slack");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"host\": \"integration-host\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "type": "Slack",
 "name": "name",
 "settings": "settings json",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Create a webhook integration

post
POST integrations/webhook

Creates the supplied webhook integration, this is disabled until sensors are assigned

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: url Type: String Required: Yes Description:

The webhook url to invoke

Parameter: authorization Type: String Required: Yes Description:

The authorization header required to authenticate the request

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created zabbix integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The webhook settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/webhook
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "host": "integration-host"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "host" => "integration-host"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/webhook");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/webhook");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"host\": \"integration-host\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "type": "WebHook",
 "name": "name",
 "settings": "settings json",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Create a zabbix integration

post
POST integrations/zabbix

Creates the supplied zabbix integration, this is disabled until sensors are assigned

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: execution_type Type: String Required: Yes Description:

Type of integration must be live or schedule

Parameter: schedule Type: Int Required: No Description:

The Schedule interval max, required if execution_type schedule

Parameter: name Type: String Required: Yes Description:

The integration name

Parameter: host Type: String Required: Yes Description:

The zabbix server host name

Parameter: monitored_host Type: String Required: Yes Description:

The zabbix monitored_host unique name

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created zabbix integration

Field: id Type: String Description:

The platform unique id

Field: name Type: String Description:

The integration name

Field: type Type: String Description:

The integration type

Field: execution_type Type: String Description:

The integration execution type

Field: schedule Type: Integer Description:

The integration schedule time

Field: settings Type: Json Description:

The zabbix settings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/integrations/zabbix
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json" \
-d '{"type": "integration-type", "execution_type": "integration-execution_type", "name": "integration-name", "host": "integration-host"}'
$curl = curl_init();
$data = ["type" => "integration-type",  "execution_type" => "integration-execution_type", "name" => "integration-name", "host" => "integration-host"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/integrations/zabbix");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/integrations/zabbix");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"type\": \"integration-type\", \"execution_type\": \"integration-execution_type\", \"name\": \"integration-name\", \"host\": \"integration-host\}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
 "type": "Zabbix",
 "name": "name",
 "settings": "settings json",
 "updated_at": "2023-02-16T17:05:42.000000Z",
 "created_at": "2023-02-16T17:05:42.000000Z",
 "id": "id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Location

Create a location

post
POST locations

Create the supplied location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token.

Parameter

Parameter Type Required Description
Parameter: name Type: String Required: Yes Description:

The location's name

Parameter: postal_code Type: String Required: No Description:

The location's postal code

Parameter: address Type: String Required: No Description:

The location's address

Parameter: longitude Type: String Required: No Description:

The location's longitude

Parameter: latitude Type: String Required: No Description:

The location's latitude

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Newly created location

Field: id Type: String Description:

The location's unique id

Field: name Type: String Description:

The location's name

Field: postal_code Type: String Description:

The location's postal code

Field: address Type: String Description:

The location's address

Field: longitude Type: String Description:

The location's longitude

Field: latitude Type: String Description:

The location's latitude

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"The name field is required"

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/locations
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "location-name", "postal_code": "location-postal-code", "address": "location-address",
      "longitude": "location-longitude", "latitude": "location-latitude"}'
$curl = curl_init();
$data = ["name" => "location-name",  "postal_code" => "location-postal-code", "address" => "location-address",
      "longitude" => "location-longitude", "latitude" => "location-latitude"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"name\": \"location-name\", \"postal_code\": \"location-postal-code\", \"address\": \"location-address\",
      \"longitude\": \"location-longitude\", \"latitude\": \"location-latitude\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
  "name": "location-name",
  "longitude": "location-longitude",
  "latitude": "location-latitude",
  "postal_code": "location-postal-code",
  "address": "location-address",
  "created_at": "2022-11-30T15:27:19.000000Z",
  "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

Delete a location

delete
DELETE locations/:location_id

Delete the specified location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The location's unique id

Response Fields (SUCCESS 204)

Field Type Description
Field: 204 Type: String Description:

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

DELETE

Header

Parameter

Code Examples

curl https://api.aql.com/locations/:location_id
-X DELETE
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations/:location_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations/:location_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 204 NO CONTENT

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get all locations

get
GET locations

Get all locations

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

locations

Field: id Type: String Description:

The location's unique id

Field: name Type: String Description:

The location's name

Field: postal_code Type: String Description:

The location's postal code

Field: address Type: String Description:

The location's address

Field: longitude Type: String Description:

The location's longitude

Field: latitude Type: String Description:

The location's latitude

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/locations
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
     {
          "name": "location-name",
          "longitude": "location-longitude",
          "latitude": "location-latitude",
          "postal_code": "location-postal-code",
          "address": "location-address",
          "updated_at": "2022-11-30T15:27:19.000000Z",
          "created_at": "2022-11-30T15:27:19.000000Z",
          "id": "zQJtnXr75o"
     },
     ...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a location

get
GET locations/:location_id

Gets the specified location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The location's unique id

Response Fields (SUCCESS 200)

Field Type Description
Field: The Type: Object Description:

requested location

Field: id Type: String Description:

The location's unique id

Field: name Type: String Description:

The location's name

Field: postal_code Type: String Description:

The location's postal code

Field: address Type: String Description:

The location's address

Field: longitude Type: String Description:

The location's longitude

Field: latitude Type: String Description:

The location's latitude

Field: created_at Type: String Description:

The datetime the location was created

Field: updated_at Type: String Description:

The datetime the location was updated

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/locations/:location_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations/:location_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations/:location_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "name": "location-name",
      "longitude": "location-longitude",
      "latitude": "location-latitude",
      "postal_code": "location-postal-code",
      "address": "location-address",
      "updated_at": "2022-11-30T15:27:19.000000Z",
      "created_at": "2022-11-30T15:27:19.000000Z",
      "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Update a location

put
PUT locations/:location_id

Updates the specified location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: location_id Type: String Required: Yes Description:

The location's unique id

Parameter: name Type: String Required: No Description:

The location's name

Parameter: postal_code Type: String Required: No Description:

The location's postal code

Parameter: address Type: String Required: No Description:

The location's address

Parameter: longitude Type: String Required: No Description:

The location's longitude

Parameter: latitude Type: String Required: No Description:

The location's latitude

Response Fields (SUCCESS 201)

Field Type Description
Field: The Type: Object Description:

updated location

Response Fields (SUCCESS 200)

Field Type Description
Field: id Type: String Description:

The location's unique id

Field: name Type: String Description:

The location's name

Field: postal_code Type: String Description:

The location's postal code

Field: address Type: String Description:

The location's address

Field: longitude Type: String Description:

The location's longitude

Field: latitude Type: String Description:

The location's latitude

Field: created_at Type: String Description:

The datetime the location was created

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"The given data was invalid"

Send a Sample Request

PUT

Header

Parameter

Code Examples

curl https://api.aql.com/locations/:location_id
-X PUT
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"name": "location-name",  "postal_code": "location-postal-code", "address": "location-address",
     "longitude": "location-longitude", "latitude": "location-latitude"}'
$curl = curl_init();
$data = ["name" => "location-name", "postal_code" => "location-postal-code", "address" => "location-address",
     "longitude" => "location-longitude", "latitude" => "location-latitude"];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations/:location_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations/:location_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"name\": \"location-name\",\"postal_code\": \"location-postal-code\", \"address\": \"location-address\",
    \"longitude\": \"location-longitude\", \"latitude\": \"location-latitude\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "name": "location-name",
      "longitude": "location-longitude",
      "latitude": "location-latitude",
      "postal_code": "location-postal-code",
      "address": "location-address",
      "updated_at": "2022-11-30T15:27:19.000000Z",
      "created_at": "2022-11-30T15:27:19.000000Z",
     "id": "zQJtnXr75o"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "The given data was invalid.",
     "errors": {
         "name": [
             "The name field is required."
         ]
     }
}

Create a location certificate

post
POST locations/:location_id/generate-certificate

Creates a location certificate allowing subscription to all MQTT topics for this location

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: csr Type: String Required: Yes Description:

The Certificate sign request to be signed for the specified location

Parameter: identifier Type: String Required: Yes Description:

The Location unique identifier

Response Fields (SUCCESS 200)

Field Type Description
Field: certificate Type: String Description:

The gateway certificate

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/locations/:location_id/generate-certificate
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/locations/:location_id/generate-certificate");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/locations/:location_id/generate-certificate");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
"certificate": "gateway-certificate"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Sensor

Add sensor reading

post
POST sensors/:sensor_id/add-reading

Adds the supplied readings for the specified sensor

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The id of the sensor the reading is being recorded against

Parameter: reading Type: Numeric Required: Yes Description:

The sensor reading to be recorded

Parameter: readings Type: Array Required: No Description:

Array of sensor readings to be recorded limited to 100 readings per submission

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

sensor reading

Response Fields (SUCCESS 200)

Field Type Description
Field: device_id Type: String Description:

The associated device id

Field: type Type: String Description:

The sensor type

Field: reading Type: Numeric Description:

The sensor reading

Field: reading_at Type: String Description:

The datetime the reading was record

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id/add-reading
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"reading": "1"}'
$curl = curl_init();
$data = ["reading" => "1"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id/add-reading");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id/add-reading");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"reading\": \"1\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
[{
     "device_id": "device-id",
     "sensor_id": "sensor-id",
     "type": "Temperature",
     "reading": 28.5,
     "reading_date": "2023-01-18T15:32:50.343557Z"
  },...
]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Add sensor alarm rule

post
POST sensors/:sensor_id/set-alarm

Configures the alarm value for the specified alarm, set to null to remove the alarm

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The id of the sensor to attach the alarm too

Parameter: upper_alarm_value Type: Numeric|null Required: No Description:

The upper alarm value to validate against. Set to null to clear alarm rule

Parameter: upper_alarm_delay Type: Numeric Required: No Description:

The number of seconds delay before the upper alarm is activated

Parameter: upper_alarm_return_delay Type: Numeric Required: No Description:

The number of seconds delay before the upper alarm is cleared

Parameter: upper_warn_value Type: Numeric|null Required: No Description:

The upper warning alarm value to validate against. Set to null to clear alarm rule

Parameter: upper_warn_delay Type: Numeric Required: No Description:

The number of seconds delay before the upper alarm warning is activated

Parameter: upper_warn_return_delay Type: Numeric Required: No Description:

The number of seconds delay before the upper alarm warning is cleared

Parameter: lower_alarm_value Type: Numeric|null Required: No Description:

The lower alarm value to validate against. Set to null to clear alarm rule

Parameter: lower_alarm_delay Type: Numeric Required: No Description:

The number of seconds delay before the lower alarm is activated

Parameter: lower_alarm_return_delay Type: Numeric Required: No Description:

The number of seconds delay before the lower alarm is cleared

Parameter: lower_warn_value Type: Numeric|null Required: No Description:

The lower warning alarm value to validate against. Set to null to clear alarm rule

Parameter: lower_warn_delay Type: Numeric Required: No Description:

The number of seconds delay before the lower alarm warning is activated

Parameter: lower_warn_return_delay Type: Numeric Required: No Description:

The number of seconds delay before the lower alarm warning is cleared

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

sensor alarm configuration

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id/set-alarm
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"upper_alarm_value": "1"}'
$curl = curl_init();
$data = ["upper_alarm_value" => "1"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id/set-alarm");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id/set-alarm");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
"{\"upper_alarm_value\": \"1\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 201 CREATED
{
      "upper_warn_value": null,
      "upper_warn_delay": null,
      "upper_warn_return_delay": null,
      "upper_alarm_value": "1",
      "upper_alarm_delay": null,
      "upper_alarm_return_delay": null,
      "lower_warn_value": null,
      "lower_warn_delay": null,
      "lower_warn_return_delay": null,
      "lower_alarm_value": null,
      "lower_alarm_delay": null,
      "lower_alarm_return_delay": null,
      "created_at": "2023-01-04T08:45:20.000000Z",
      "updated_at": "2023-01-04T08:47:41.000000Z"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get sensor readings

get
GET sensors/:sensor_id/sensor-data

Get sensor readings for the supplied sensor, limited to 1000 readings

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The id of the sensor being requested

Parameter: limit Type: Numeric Required: No Description:

Record limit max 1000 records

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD).

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD).

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Field: sensor_id Type: String Description:

Associated sensor platform id

Field: name Type: String Description:

Sensor type

Field: reading_date Type: String Description:

The datetime the data was recorded

Field: value Type: Numeric Description:

The sensor value

Field: metric_units Type: String Description:

Metric unit type

Field: imperial_units Type: String Description:

Imperial unit type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id/sensor-data
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id/sensor-data");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id/sensor-data");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
       "sensor":
               {
                   "id": "sensor-id",
                   "name": "sensor-name",
                   "device_name": "device-name",
                   "array_key" "array-key",
                   "sensor_type": {
                       "id": "sensor-type-id",
                       "name": "Temp"
                       "metric_units": "°C",
                       "imperial_units": "°F",
                       "default_units": "°C"
                   }
               },
       "readings": [
               {
               "sensorreadingdate":"2022-05-14 00:00:00",
                "sensorreadingdate_local":"2022-05-14 01:00:00",
               "type":"value",
               "sensor_id":"sensor-id"}
           ]
  }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get sensor readings based on the aggregate type

get
GET sensors/:sensor_id/sensor-data/aggregate/:type

Gets the aggregate sensor readings for the supplied sensor_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The id of the sensor being requested

Parameter: type Type: String Required: Yes Description:

The aggregate type must be one of the following first,min,max,ave,min_ave_max

Parameter: startDate Type: String Required: No Description:

Record start period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: endDate Type: String Required: No Description:

Record end period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: granularity Type: String Required: No Description:

Record sample granularity should be in minute,half_minute,five_minutes,ten_minutes,quarter_hour,hour,half_hour,three_hours,six_hours,nine_hours,day,half_day,week,ten_days,two_weeks,month

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Field: sensor_id Type: String Description:

Associated sensor platform id

Field: name Type: String Description:

Sensor type

Field: reading_date Type: String Description:

The datetime the data was recorded

Field: value Type: Numeric Description:

The sensor value

Field: metric_units Type: String Description:

Metric unit type

Field: imperial_units Type: String Description:

Imperial unit type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id/sensor-data/aggregate/:type
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id/sensor-data/aggregate/:type");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id/sensor-data/aggregate/:type");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "sensor":
              {
                  "id": "sensor-id",
                  "name": "sensor-name",
                  "device_name": "device-name",
                  "array_key" "array-key",
                  "sensor_type": {
                      "id": "sensor-type-id",
                      "name": "Temp"
                      "metric_units": "°C",
                      "imperial_units": "°F",
                      "default_units": "°C"
                  }
              },
      "readings": [
              {
              "sensorreadingdate":"2022-05-14 00:00:00",
               "sensorreadingdate_local":"2022-05-14 01:00:00",
              "type":"value",
              "sensor_id":"sensor-id"}
          ]
 }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get the latest sensor reading

get
GET sensors/:sensor_id/sensor-data/latest

Gets the most recent sensor reading for the supplied sensor_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The id of the sensor being requested

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id/sensor-data/latest
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"sensor_ids": ["N9rhRPGJ7V", "MQnulkADXx"]}'
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id/sensor-data/latest");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id/sensor-data/latest");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
 "display_name": "Temperature",
 "sensorreadingdate": "2024-07-22 12:01:12",
 "value": 20,
 "display_significance": 1,
 "metric_units": "°C",
 "imperial_units": "°F",
 "default_units": "°C",
 "system_of_measure": "metric",
 "sensor_type_id": "sensor-type-id",
 "sensorTypeName": "Temperature",
 "deviceName": "MQTT",
 "array_key": "temp",
 "sensor_id": "sensor-id",
 "sensorreadingdate_local": "2024-07-22 13:01:12"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get a sensor

get
GET sensors/:sensor_id

Gets the supplied sensor based on the submitted sensor_id

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The sensors unique id *

Response Fields (SUCCESS 200)

Field Type Description
Field: id Type: String Description:

The sensors unique id

Field: device_id Type: String Description:

The associated device id

Field: key Type: String Description:

The sensors unique key used for frame mapping

Field: name Type: String Description:

The sensors name

Field: slope Type: Numeric Description:

The slope to be applied to sensor values

Field: offset Type: Numeric Description:

The offset to be applied to sensor values

Field: retention_days Type: Int Description:

How long sensor data will be stored before being cleared down

Field: sensor_type_id Type: String Description:

The associated sensor type id

Field: created_at Type: String Description:

The datetime the sensor was created

Field: updated_at Type: String Description:

The datetime the sensor was last updated

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "id": "sensor-id",
      "device_id": "device-id",
      "key": "sensor-key",
      "name": "sensor-name",
      "slope": 1,
      "offset": 0,
      "retention_days": 90,
      "created_at": "2022-09-28T11:11:01.000000Z",
      "updated_at": "2022-09-28T11:11:01.000000Z",
      "sensor_type_id": "sensor-type-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Gets all sensors

get
GET sensors

Get all sensors

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: searchKey Type: String Required: No Description:

Optional search terms to match sensors with similar names

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensors

Field: id Type: String Description:

The sensors unique id

Field: device_id Type: String Description:

The associated device id

Field: key Type: String Description:

The sensors unique key used for frame mapping

Field: name Type: String Description:

The sensors name

Field: slope Type: Numeric Description:

The slope to be applied to sensor values

Field: offset Type: Numeric Description:

The offset to be applied to sensor values

Field: retention_days Type: Int Description:

How long sensor data will be stored before being cleared down

Field: sensor_type_id Type: String Description:

The associated sensor type id

Field: created_at Type: String Description:

The datetime the sensor was created

Field: updated_at Type: String Description:

The datetime the sensor was last updated

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
   {
      "id": "sensor-id",
      "device_id": "device-id",
      "key": "sensor-key",
      "name": "sensor-name",
      "slope": 1,
      "offset": 0,
      "retention_days": 90,
      "created_at": "2022-09-28T11:11:01.000000Z",
      "updated_at": "2022-09-28T11:11:01.000000Z",
      "sensor_type_id": "sensor-type-id"
      },..
  ]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

Update a sensor

put
PUT sensors/:sensor_id

Updates the specified sensor

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_id Type: String Required: Yes Description:

The sensor's platform unique id

Parameter: slope Type: Numeric Required: No Description:

Multiplies the sensor reading with the associated slope value

Parameter: offset Type: Numeric Required: No Description:

Applies the sensor reading with the associated offset value

Parameter: retention_days Type: Numeric Required: No Description:

Specifies the number of days the data should be retained set 0 to store indefinitely

Response Fields (SUCCESS 201)

Field Type Description
Field: data Type: Object Description:

Updated sensor

Field: id Type: String Description:

The sensors unique id

Field: device_id Type: String Description:

The associated device id

Field: key Type: String Description:

The sensors unique key used for frame mapping

Field: name Type: String Description:

The sensors name

Field: slope Type: Numeric Description:

The slope to be applied to sensor values

Field: offset Type: Numeric Description:

The offset to be applied to sensor values

Field: retention_days Type: Int Description:

How long sensor data will be stored before being cleared down

Field: sensor_type_id Type: String Description:

The associated sensor type id

Field: created_at Type: String Description:

The datetime the sensor was created

Field: updated_at Type: String Description:

The datetime the sensor was last updated

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 422)

Field Type Description
Field: message Type: String Description:

"Invalid Device"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

PUT

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/:sensor_id
-X PUT
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"slope": "1",  "offset": "5"}'
$curl = curl_init();
$data = ["slope" => "1", "offset" => "5"];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/:sensor_id");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/:sensor_id");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
request.AddParameter("application/json",
     "{\"slope\": \"1\",\"offset\": \"5\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
      "id": "sensor-id",
      "device_id": "device-id",
      "key": "sensor-key",
      "name": "sensor-name",
      "slope": 1,
      "offset": 0,
      "retention_days": 90,
      "created_at": "2022-09-28T11:11:01.000000Z",
      "updated_at": "2022-09-28T11:11:01.000000Z",
      "sensor_type_id": "sensor-type-id"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
     "message": "Invalid Device."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get sensor readings based on the aggregate type for multiple sensors

get
GET sensors/sensors-data/aggregate/:type

Gets the aggregate sensor readings for multiple sensors

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_ids Type: Array Required: Yes Description:

The collection of sensors latest readings to be returned

Parameter: type Type: String Required: Yes Description:

The aggregate type must be one of the following first,min,max,ave,min_ave_max

Parameter: startDate Type: String Required: No Description:

Start period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: endDate Type: String Required: No Description:

End period in UTC (format: YYYY-MM-DD HH:mm:ss)

Parameter: granularity Type: String Required: No Description:

Record sample granularity should be in minute,half_minute,five_minutes,ten_minutes,quarter_hour,hour,half_hour,three_hours,six_hours,nine_hours,day,half_day,week,ten_days,two_weeks,month

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Field: sensor_id Type: String Description:

Associated sensor platform id

Field: name Type: String Description:

Sensor type

Field: reading_date Type: String Description:

The datetime the data was recorded

Field: value Type: Numeric Description:

The sensor value

Field: metric_units Type: String Description:

Metric unit type

Field: imperial_units Type: String Description:

Imperial unit type

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/sensors-data/aggregate/:type
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
-d '{"sensor_ids": ["abd", "cbd"]}'
$queryParams = [
         'sensor_ids' => [
         'abd',
         'cbd',
         ],
];
$queryString = http_build_query($queryParams);
$curl = curl_init();
$baseUrl = "https://api.aql.com/sensors/sensors-data/aggregate/:type";
$fullUrl = "{$baseUrl}?{$queryString}";
curl_setopt($curl, CURLOPT_URL, $fullUrl);
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/sensors-data/aggregate/:type");
var request = new RestRequest(Method.GET);
string[] sensorIds = { "abd", "cbd" };
sensorIds.ToList().ForEach(id => request.AddQueryParameter("sensor_id[]", id));
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
{
       "sensors":[
               {
                   "id": "sensor-id",
                   "name": "sensor-name",
                   "device_name": "device-name",
                   "array_key" "array-key",
                   "sensor_type": {
                       "id": "sensor-type-id",
                       "name": "Temp"
                       "metric_units": "°C",
                       "imperial_units": "°F",
                       "default_units": "°C"
                   }
               }],
       "readings": [
               {
               "sensorreadingdate":"2022-05-14 00:00:00",
                "sensorreadingdate_local":"2022-05-14 01:00:00",
               "type":"value",
               "sensor_id":"sensor-id"}
           ]
  }

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Get the latest sensor reading for multiple sensors

post
POST sensors/sensors-data/latest

Gets the most recent sensor readings for the supplied sensor_ids's

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: sensor_ids Type: Array Required: Yes Description:

The collection of sensors latest readings to be returned

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensor readings

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/sensors/sensors-data/latest
-X POST
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensors/sensors-data/latest");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensors/sensors-data/latest");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[{
  "display_name": "Temperature",
  "sensorreadingdate": "2024-07-22 12:01:12",
  "value": 20,
  "display_significance": 1,
  "metric_units": "°C",
  "imperial_units": "°F",
  "default_units": "°C",
  "system_of_measure": "metric",
  "sensor_type_id": "sensor-type-id",
  "sensorTypeName": "Temperature",
  "deviceName": "MQTT",
  "array_key": "temp",
  "sensor_id": "sensor-id",
  "sensorreadingdate_local": "2024-07-22 13:01:12"
 }]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found

Sensor Type

Get all the sensor types supported

get
GET sensor-types

Get all supported sensor types

Header

Header Type Required Description
Header: Accept Type: String Required: Yes Description:

Accept content type

Header: Authorization Type: String Required: Yes Description:

Authorization token

Parameter

Parameter Type Required Description
Parameter: searchKey Type: String Required: No Description:

Optional search terms to match sensors with similar names

Response Fields (SUCCESS 200)

Field Type Description
Field: data Type: Object[] Description:

sensors

Field: name Type: String Description:

The Sensor Name

Field: id Type: String Description:

The sensors unique id

Field: unit Type: String Description:

The sensor unit

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated"

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised"

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/sensor-types
-X GET
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
-H "Accept: application/json"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/sensor-types");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Accept: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
var client = new RestClient("https://api.aql.com/sensor-types");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);

Success Response Example

HTTP/1.1 200 OK
[
      {
          "name": "Sensor Name",
          "id": "Sensor Id",
          "unit": "Sensor Unit"
      },..
  ]

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
     "message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
     "message": "This action is unauthorised."
}
AutoJemma®

How can I help you today?

Can't find what you're looking for, ask a question below!

Additional Details

AutoJemma® can make mistakes, please verify any critical information.