Add a Device Group

post

/rest/{versionId}/inventory/device-mgmt/device-groups

Use this (POST) method to add a device group to Device Manager. A device group is a containment group that can contain other device groups or devices maintained in Network Functions (NFs).

Request

Path Parameters
Back to Top

Response

201 Response

Resource created successfully.

400 Response

The user input is invalid.

401 Response

The user is not authorized.

403 Response

The user does not have permission for the attempted action.

404 Response

The object (resource URI, device, and so on) of your input request cannot be found.

409 Response

The device group already exists.

500 Response

An internal server error has occurred while processing the request.
Back to Top

Examples

Examples of Accessing the API

See Authenticate page to acquire a token.

The following example shows how to use curl to add a Device Group.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/inventory/device-mgmt/device-groups"

The following example shows how to use Python to add a Device Group.

import requests
import json
headers = {
	"Accept": "application/json",
	"Authorization": "Bearer <auth-token>"
}
with open("request.json") as f: data = json.load(f)
url  = "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/inventory/device-mgmt/device-groups"
resp = requests.post(url, headers=headers, data=data)

Example of the Request Body

The following shows an example of the contents of the request file sent as the request body.

{
  "name": "test2",
  "parentGroupFullName":"test1"
}

Example of the Response Body

The following example shows the contents of the response body.

{
  "fullName": "test1/test2",
  "id": "102",
  "name": "test2",
  "parentGroupFullName": "test1",
  "parentGroupId": "101"
}

Example 2 of Accessing this API

When parentGroupFullName is not specified, the group is added at the "Home" level, with parentGroupId set to "ID0" as a placeholder.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/inventory/device-mgmt/device-groups"

The following shows an example of the request body.

{
  "name":"dg2"
}

The following shows an example response.

{
  "fullName": "dg2",
  "id": "21",
  "name": "dg2",
  "parentGroupId": "ID0"
}
Back to Top