Documentation

Mistake on this page? Email us

Device groups using the APIs

All methods for device groups are in the Device Directory API.

Authentication

Before you can successfully send requests, you need an API key, which you can obtain from Device Management Portal.

Creating a new group

Create a new group using POST /v3/device-groups/. Include name, description, and other custom attributes in the body of the request:

curl -X POST \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/ \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
	"name": "test",
	"description": "This is my test group.",
	"custom_attribute": "1"
}'

Deleting a group

Delete a group using DELETE /v3/device-groups/{device-group-id}/:

curl -X DELETE \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/<device-group-id>/ \
  -H 'Authorization: Bearer <api_key>' \

Listing all groups

See a list of all created groups using GET /v3/device-groups:

curl -X GET \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/ \
  -H 'Authorization: Bearer <api_key>' \

Showing a specific group

See information, including custom attributes, for a specific group using GET /v3/device-groups/{device-group-id}:

curl -X GET \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/ \
  -H 'Authorization: Bearer <api_key>' \

Modifying group attributes

Change group attributes like name, description, and so on using PUT /v3/device-groups/{device-group-id}/. Include these attributes in the body of the request:

curl -X PUT \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/<device-group-id>/ \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "custom_attributes":
    "hello" : "hi"
  }
}'

Adding devices to a group

Add a device to a group using POST /v3/device-groups/{device-group-id}/devices/add/:

curl -X POST \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/<device-group-id>/devices/add/ \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
	id : "<device-id>"
}'

Note: You must send a request for each device you want to add or remove.

Showing devices in a specific group

See a list of devices in a particular group using GET /v3/device-groups/{device-group-id}/devices/:

curl -X GET \
  https://api.us-east-1.mbedcloud.com/v3/device-groups/<device-group-id>/devices/ \
  -H 'Authorization: Bearer <api_key>' \

Removing devices from a group

Remove a specific device from a group with POST /v3/device-groups/{device-group-id}/devices/remove/. Include the device ID in the body of the request:

curl -X POST \
  'https://api.us-east-1.mbedcloud.com/v3/device-groups/<device-group-id>/devices/remove/' \
  -H 'Authorization: Bearer <api_key>' \