Organizing devices with the nRF Cloud APIs
This page explains device group and tag operations in the nRF Cloud REST API.
You cannot use the REST API to manage user access to device groups. Use the nRF Cloud portal for this.
Viewing device groups
Use the
ListDeviceTags
endpoint to show all tags associated with a team. If you are not an owner or
admin, you will see only the device groups you have access to.
Use the
FetchDevice
endpoint to view a single device's information, including which tags it has.
Adding device tags at onboarding
You can add tags to a device at onboarding. If you want multiple tags, separate
them using a pipe | character in the CSV file or message body text.
See the documentation for the
OnboardDevices
endpoint for more information on formatting.
Managing groups for a device
Use the
UpdateDeviceTags
endpoint to edit the tags associated with a device.
The content of the message body for this endpoint replaces the tags the device
currently has. For example, if you have a device with tag test1 and want to
add tag test2 as well, make sure you include both tags in the message body.
Any existing tags will be removed if you do not include them in each update
request.
Include the device ID as a path parameter. Specify tags in the message body,
enclosed in double quotation marks ("). Separate multiple tags with a comma,
with one line for each:
[
"test1",
"test2"
]
The server responds with a 202 code if successful.
Use the
ListDevices
or
FetchDevice
endpoints to verify that the device's tags have been updated.
The following example shows the portion of the response that includes the device's tags:
"id": "nrf-0123456789012345",
"tags": [
"test1",
"test2"
],
You can also verify that the tag has been added by checking the individual device's page in the nRF Cloud portal, or by checking the group's page.