Device to Cloud Command Line Interface Device Group Commands
Overview
This chapter describes the commands of d2c to manage device groups. Most of the commands such as add-device-group or updatey-device-group return with a JSON output which data model is described in the d2c client sided domain model
.
Available Commands
| Command | Short | Description |
|---|---|---|
| add-device-group | adg | Creates a new device group object in DMO. |
| get-device-groups | gdg | Gets a device group object by its name or id or a list of all device group objects from DMO. |
| update-device-group | udg | Updates the attributes of a device group object in DMO. |
| delete-device-group | ddg | Deletes a device group object by its name or id from DMO. |
d2c you need to configure a DMO access profile and activate it (see Manage DMO access profiles
). Without an active DMO access profile d2c cannot access DMO.Before d2c can drop requests to the DMO API you need to create an oneM2M application entity for d2c in DMO. To do so run the command
d2c add-d2ccli-application
add-device-group
- Description
- Options
- Global Options
- Samples
With the command d2c add-device-group you can create a device group object which act as a container for devices and application which are notified with the received uplink messages of the devices.
d2c add-device-group --name <string> | -n <string>
[--description <string> | -de <string>]
[--devices <list-of-strings> | -ds <list-of-strings>]
[--applications <list-of-strings> | -as <list-of-strings>]
[--profile-file <file> | -p <file>]
[--origin <string> | -o <string>]
[--help | -h]
[--debug]
[--info]
[--outfile <filepath>]
[--config-directory <directory>]
[--config-file <file>]
--name <string>, -n <string>
The required --name option defines the unique identifier of the device group object.
Valid characters for the device group name are: digits (0-9), lower and upper case ascii characters (A-Z and a-z), special characters “-”, “_”.--description <string>, -de <string>
An additonal description for the device group.--devices <list-of-strings>, -ds <list-of-strings>
With the --devices option you can define list of names of the devices which shall be referenced by the device group.
You have the following possibilities to define the list of devices:
| Case | Option Sample |
|---|---|
| Define single device | –devices “528479272740225” |
| Define multiple devices | –devices “528479272740225,109931700226026, 865975962828205” |
| Define multiple devices | –devices ‘[“528479272740225”,“109931700226026”, “865975962828205”]’ |
--applications <list-of-strings>, -as <list-of-strings>
With the --applications option you can define list of names of the applications which shall be referenced by the device group.
You have the following possibilities to define the list of applications:
| Case | Option Sample |
|---|---|
| Define single application | –applications “scs-message-monitor-001” |
| Define multiple applications | –devices “scs-message-monitor-001,uplink-injestor” |
| Define multiple devices | –devices ‘[“scs-message-monitor-001”, “uplink-injestor”]’ |
--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.
--help, -hDisplays the help for this command.
--infoTurn on info logging.
--debugTurn on debug logging.
--outfile <file>File into which the info or debug outputs shall be written additionaly.
--config-directory <directory>Path to the directory within which the file config.json can be found. By default this directory is
$HOME/.d2c.--config-file <file>Path to the configuration file. By default this path is
$HOME/.d2c/config.json.d2c add-device-group --name spacemonitoring.de \
--description "Spacemonitoring devices in German offices"
{
"id": "685534e9e81f8c583a3a8517",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:16:09",
"lastModificationTime": "2025-06-20T10:16:09",
"description": "Spacemonitoring devices in German offices",
"devices": [],
"devicesCount": 0,
"applications": [],
"applicationsCount": 0
}
d2c add-device-group --name spacemonitoring.de \
--description "Spacemonitoring devices in German offices" \
--applications "iot-uplink-messages" \
--devices '[
"519137704459506",
"514324965299665",
"861673172400212",
"511552582356939"
]'
{
"id": "685536abf7d995e4fe5081e9",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:23:39",
"lastModificationTime": "2025-06-20T10:23:39",
"description": "Spacemonitoring devices in German offices",
"devices": [
"519137704459506",
"514324965299665",
"861673172400212",
"511552582356939"
],
"devicesCount": 4,
"applications": [
"iot-uplink-messages"
],
"applicationsCount": 1
}
get-device-groups
- Description
- Options
- Global Options
- Samples
The command d2c get-device-groups retrievs information about a single or a list of multiple device-groups from DMO. To identify a single device-group you can use the option --name or --id.
d2c get-device-groups [--name <string> | -n <string> | --id <string> | -i <string>]
[--select <select fields> | -s <select fields>]
[--format <CSV | JSON> | -f <CSV | JSON>]
[--separator-char <char> | -sc <char>]
[--result-content-indicator <rci> | -rci <rci>]
[--limit <int> | -li <int>]
[--offset <int> | -os <int>]
[--profile-file <file> | -p <file>]
[--origin <string> | -o <string>]
[--help | -h]
[--debug]
[--info]
[--outfile <filepath>]
[--config-directory <directory>]
[--config-file <file>]
--name <string>, -n <string>
In case you want to retriev the detail information of specific device group you can use the option --name to identify the device group.--id <string>, -i <string>
In case you want to retriev the detail information of specific device group you can use the option --id to identify the device group.--select <select fields>, -s <select fields>
A comma seperated list of element names which shall be selected from the returned objects and written to stdout as CSV or JSON format. To control if the output is written in CSV or JSON format use the –format option. To understand which fields are available to select you can run d2c get-applications without –select option to see which fields are part of the queried devices or you can read the documentation Key Concepts of Device to Cloud
.--format <CSV | JSON>, -f <CSV | JSON>
With the –format option you can control in which format the queried resource objects shall be written to stdout. If you don’t define any select fields with –select option the default format is JSON. If you define select fields with –select option the default format is CSV.--separator-char <char>
If the –select option is used the selected elements are written to the stdout as CSV. With –separator-char you can control which character shall be used to seperate the different fields from each other in the output. By default ; is used as separator character.--result-content-indicator <rci>, -rci <rci>
With the option –result-content-indicator you can control the amount of content which is returned as a result. The following indicators can be used:
| Result content indicator | Short |
|---|---|
| return-nothing | rn |
| return-all | ra |
| return-modified | rm |
| attributes | a |
| attributes-and-children | ac |
| children | c |
--limit <int>, -li <int>
To controll the number of resource objects in the result you can use the option –limit. With the –limit option in combination with the –offset option, you can implement a pagination process to walk through large amounts of resource objects.--offset <int>, -offset <int>
With the –offset option you can define the index or offset of the first object in the response. Normally you use the –offset option together with the –limit option to implement a pagination process.--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.
--help, -hDisplays the help for this command.
--infoTurn on info logging.
--debugTurn on debug logging.
--outfile <file>File into which the info or debug outputs shall be written additionaly.
--config-directory <directory>Path to the directory within which the file config.json can be found. By default this directory is
$HOME/.d2c.--config-file <file>Path to the configuration file. By default this path is
$HOME/.d2c/config.json.d2c get-device-groups --name spacemonitoring.de
{
"id": "685536abf7d995e4fe5081e9",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:23:39",
"lastModificationTime": "2025-06-20T10:25:25",
"description": "Spacemonitoring devices in German offices",
"devices": [
"519137704459506",
"514324965299665",
"861673172400212",
"511552582356939"
],
"devicesCount": 4,
"applications": [
"iot-uplink-messages"
],
"applicationsCount": 1
}
d2c get-device-groups --select "name,applications"
Roland_Baldin_001;['68502cead2a48861fe1a9463'] TestMikhailGroup;['scs-message-monitor-022'] TestMikhailGroup45;['SCS-PRD-message-monitor', 'devicegroup02-app2-919'] TestMikhailGroup90;['d2c-customer-poa-app01', 'd2c-customer-mikhail'] spacemonitoring.de;['iot-uplink-messages']
d2c get-device-groups --select "name,devices" --format JSON
[
{
"name": "spacemonitoring.de",
"devices": [
"519137704459506",
"514324965299665",
"861673172400212",
"511552582356939"
]
},
{
"name": "roland-dg-003",
"devices": [
"aa1",
"aa2",
"aa3"
]
},
{
"name": "roland-dg-002",
"devices": []
}
]
d2c get-device-groups --select "name,creationTime" | sort -t';' -k2
Application011446DefaultGroup;2025-06-15 21:44:53 Application011567DefaultGroup;2025-06-16 06:39:16 Roland_Baldin_001;2025-06-17 07:01:44 roland-dg-001;2025-06-20 08:53:58 roland-dg-002;2025-06-20 09:00:34 roland-dg-003;2025-06-20 09:00:59 spacemonitoring.de;2025-06-20 10:23:39
update-device-group
- Description
- Options
- Global Options
- Samples
With the command d2c update-device-group you can update the attributes of an existing device group.
d2c update-device-group --name <string> | -n <string>
[--description <string> | -de <string>]
[--devices <list-of-strings> | -ds <list-of-strings>]
[--applications <list-of-strings> | -as <list-of-strings>]
[--profile-file <file> | -p <file>]
[--origin <string> | -o <string>]
[--help | -h]
[--debug]
[--info]
[--outfile <filepath>]
[--config-directory <directory>]
[--config-file <file>]
--name <string>, -n <string>
The required --name option defines the unique identifier of the device group. Alternatively you can use --id option instead of --name to identify the device group.--id <string>, -i <string>
The required --id option defines the unique identifier of the device group. Alternatively you can use --name option instead of --id to identify the device group.--description <string>, -de <string>
With --description option you can define the description of the device group.--devices <list-of-strings>, -ds <list-of-strings>
With the --devices option you can update list of names of the devices which shall be referenced by the device group.
You have the following possibilities to modify the list of devices:
| Case | Option Sample |
|---|---|
| Add single device | –devices “+915973319313039” |
| Remove single device | –devices “\-915973319313039” \ |
| Add muliple devices | –devices “+915973319313039, +308044730067540” |
| Add muliple devices | –devices ‘["+915973319313039","+308044730067540"]’ |
| Remove muliple devices | –devices “\-915973319313039, -308044730067540” |
| Remove muliple devices | –devices ‘["-915973319313039","-308044730067540"]’ |
| Add and remove devices | –devices “+915973319313039, -308044730067540, +508922686842099” |
| Add and remove devices | –devices ‘["+915973319313039","-308044730067540", “+508922686842099”]’ |
| Remove all devices | –devices “\-*” |
| Remove all devices | –devices ‘["-*"]’ |
--applications <list-of-strings>, -as <list-of-strings>
With the --applications option you can modify list of names of the applications which shall be referenced by the device group.
You have the following possibilities to modify the list of applications:
| Case | Option Sample |
|---|---|
| Add single application | –applications “+message-logger” |
| Remove single application | –applications “\-messsage-logger” \ |
| Add muliple applications | –applications “+message-logger, +message-backup” |
| Add muliple applications | –applications ‘["+message-logger","+message-backup"]’ |
| Remove muliple applications | –applications “\-message-logger, -message-backup” |
| Remove muliple applications | –applications ‘["-message-logger","-message-backup"]’ |
| Add and remove applications | –applications “+message-logger, -message-backup” |
| Add and remove applications | –applications ‘["+message-logger","-message-backup"]’ |
| Remove all applications | –devices “\-*” |
| Remove all applications | –devices ‘["-*"]’ |
--profile-file <file>, -p <file>
DMO access profile file which shall be used instead of the current activated on in the d2c configuration.--origin <string>, -o <string>
Each request to the DMO API requires the HTTP header field X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.
--help, -hDisplays the help for this command.
--infoTurn on info logging.
--debugTurn on debug logging.
--outfile <file>File into which the info or debug outputs shall be written additionaly.
--config-directory <directory>Path to the directory within which the file config.json can be found. By default this directory is
$HOME/.d2c.--config-file <file>Path to the configuration file. By default this path is
$HOME/.d2c/config.json.d2c update-device-group --name spacemonitoring.de \
--devices "+527735893073317,989189228185886"
{
"id": "685536abf7d995e4fe5081e9",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:23:39",
"lastModificationTime": "2025-06-20T12:42:47",
"description": "Spacemonitoring devices in German offices",
"devices": [
"519137704459506",
"514324965299665",
"861673172400212",
"511552582356939",
"527735893073317",
"989189228185886"
],
"devicesCount": 6,
"applications": [
"iot-uplink-messages"
],
"applicationsCount": 1
}
d2c update-device-group --name spacemonitoring.de \
--devices '[
"499804750967203",
"108040606838370"
]'
{
"id": "685536abf7d995e4fe5081e9",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:23:39",
"lastModificationTime": "2025-06-20T12:45:23",
"description": "Spacemonitoring devices in German offices",
"devices": [
"499804750967203",
"108040606838370"
],
"devicesCount": 2,
"applications": [
"iot-uplink-messages"
],
"applicationsCount": 1
}
d2c update-device-group --name spacemonitoring.de --devices '["-*"]'
d2c update-device-group --name spacemonitoring.de \
--devices $(d2c get-devices --select name | tr '\n' ',' | sed s/',$'//g)
{
"id": "685536abf7d995e4fe5081e9",
"name": "spacemonitoring.de",
"creationTime": "2025-06-20T10:23:39",
"lastModificationTime": "2025-06-20T12:57:10",
"description": "Spacemonitoring devices in German offices",
"devices": [
8C1F648D0098B043
8C1F648D0098B044
8C1F648D0098B045
8C1F648D0098B046
8C1F648D0098B047
8C1F648D0098B048
8C1F648D0098B04A
8C1F648D0098B04B
8C1F648D0098B04C
8C1F648D0098B04D
8C1F648D0098B04E
8C1F648D0098B04F
8C1F648D0098B051
8C1F648D0098B054
8C1F648D0098B056
8C1F648D0098B057
8C1F648D0098B058
8C1F648D0098B05B
8C1F648D0098B05D
8C1F648D0098B060
8C1F648D0098B061
8C1F648D0098B062
8C1F648D0098B068
8C1F648D0098B069
A8404100B459BAE6
A84041108059BAF5
A840412D0F59BAF1
A84041361A59BADC
A84041525359BAAA
A8404152C259BADF
A84041607759BAEF
A840417AA259BAE5
A8404187DA59BAAD
],
"devicesCount": 151,
"applications": [
"iot-uplink-messages"
],
"applicationsCount": 1
}
delete-device-group
- Description
- Options
- Global Options
- Samples
With the command d2c delete-device-group you can delete an existing device group object by its name or id.
d2c delete-device-group --name <string> | -n <string> | --id <string> | -i <string>
[--profile-file <file> | -p <file>]
[--origin <string> | -o <string>]
[--help | -h]
[--debug]
[--info]
[--outfile <filepath>]
[--config-directory <directory>]
[--config-file <file>]
--name <string>, -n <string>The required
--name option defines the unique identifier of the device group which shall be deleted. Alternatively you can use --id option instead of --name to identify the device group.--id <string>, -i <string>The required
--id option defines the unique identifier of the device group. Alternatively you can use --name option instead of --id to identify the device group.--profile-file <file>, -p <file>DMO access profile file which shall be used instead of the current activated on in the d2c configuration.
--origin <string>, -o <string>Each request to the DMO API requires the HTTP header field
X-M2M-ORIGIN. With the option –origin you can overwrite the default value of d2ccli. By convension oneM2M requires that the X-M2M-ORIGIN value is prefixed with a C character. This is done automatically by d2c, so please define the origin without the leading C.--help, -hDisplays the help for this command.
--infoTurn on info logging.
--debugTurn on debug logging.
--outfile <file>File into which the info or debug outputs shall be written additionaly.
--config-directory <directory>Path to the directory within which the file config.json can be found. By default this directory is
$HOME/.d2c.--config-file <file>Path to the configuration file. By default this path is
$HOME/.d2c/config.json.d2c delete-device-group --name spacemonitoring.de
d2c delete-device-group --id 685536abf7d995e4fe5081e9