Skip to main content

Assets API

Assets API provides HTTP API for the end user to read device info.

List Your Devices

GET /assets/v1/devices

Get the list of devices the user has access to.

Request

Sample request via cURL
$ curl http://enapter-gateway.local/api/assets/v1/devices -X GET -G \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d 'page_token=RW5hcHRlcg==' \
-d 'page_size=10' \
-d 'expand=manifest,properties,connectivity' \
-d 'filter[type_in]=endpoint,ucm'

Path Parameters

page_tokenstring#

Token for the results page. The next page's token can be obtained from the next_page_token field. If the token is empty, the first page will be returned.

page_sizeinteger#

Maximum number of results per response page. If omitted, the server chooses the number of results.

expandarray of strings#

Comma-separated list of additional device information to display. By default, no additional fields are included.

Supported values:

  • manifest — to include device blueprint manifest.
  • properties — to include the last received device properties.
  • connectivity — to include current device connection status.
filterobject#

A filter expression that filters resources listed in the response. A filter is an object whose keys are a combination of a field name and a predicate separated by underscore (e.g. type_in), and whose values are predicate arguments.

Currently only filter for the field type using in predicate is available (argument is comma-separated array of strings).

Response

Sample response (200 OK)
{
"devices": [
{
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"type": "endpoint",
"updated_at": "2022-01-01T20:22:00Z",
"properties": {
"serial_number": "1XXXX",
"model": "AnySen M12"
},
"connectivity": {
"online": true
},
"manifest": {...}
}
],
"next_page_token": "TmV4dCBQYWdlIFRva2Vu"
}
devicesobject#

Array of Device objects.

Device.device_idstring#

Device ID.

Device.typestring#

Device type. One of: endpoint (i.e. your connected device), ucm (i.e. one of Enapter UCMs), gateway (i.e. Enapter Gateway).

Device.updated_atstring#

The latest update time of the device in RFC 3339 format.

Device.propertiesobject#

The latest device properties. This is an object whose keys and values are properties' names and values respectively. Set only if properties are requested via expand parameter.

Device.connectivityobject#

Current device connection status, instance of Connectivity object. Set only if connection status is requested via expand parameter.

Connectivity.onlineboolean#

true if device is online, false otherwise.

Device.manifestobject#

Device blueprint manifest. Set only if manifest is requested via expand parameter.

errorsarray of errors#

Array of errors. See common error format for more details.

next_page_tokenstring#

Token of the next page. If token is null, there are no more pages.

Hardware diversity is welcome. Integrate any device into a unified energy network.
© 2024 Enapter
Developer toolkit
DocumentationReference