Skip to main content

List Available Devices

HTTP client

While this guide uses cURL for examples, you can follow along in Postman or any other HTTP client you prefer.

First of all, we need to receive a list of available devices. This can be done via assets/v1/devices method. See method reference to get full information.

$ curl http://enapter-gateway.local/api/assets/v1/devices -X GET \
-H 'X-Enapter-Auth-Token: f84d33264442d9af226f2a9e0c80b74d32515763'

If you provided the right values, you should get a success response back containing a list of registered devices:

{
"devices": [
{
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"type": "endpoint",
"updated_at": "2022-01-01T20:22:00Z"
}
],
"next_page_token": null
}

The default response provides information about device ID, device type and the time of the last device update. next_page_token field set to null signals that there are no more results to fetch.

Often you may need to get more information such as properties, connection status, and blueprint manifest to see device telemetry attributes and commands. Method assets/v1/devices allows you to get additional device information via setting expand parameters:

$ curl http://enapter-gateway.local/api/assets/v1/devices -X GET -G \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}'
-d 'expand=properties,connectivity,manifest'

You should get a success response containing additional information for each device:

{
"devices": [
{
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"type": "endpoint",
"updated_at": "2022-01-01T20:22:00Z",
"properties": {
"firmware_version": "1.0.0"
},
"connectivity": {"online": true},
"manifest": {...}
}
],
"next_page_token": null
}

All Rights Reserved © 2024 Enapter AG.