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
$ 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_tokenfield. 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
typeusinginpredicate is available (argument is comma-separated array of strings).
Response
{
"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
Deviceobjects.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
expandparameter.
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.
💬 Need Help?
Have a question or hit a roadblock? Join the Enapter Discord community to get quick support, exchange ideas, and collaborate with other developers and energy experts.