Update a Device Group

put

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

This API can be used to rename a device group and/ormove a device group to another parent group within Device Manager.

Request

Path Parameters
Back to Top

Response

200 Response

Successfully updated the device group.

400 Response

The user input is invalid.

401 Response

The user is unauthorized.

403 Response

The user does not have permission for the attempted action.

404 Response

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

409 Response

Conflict. This occurs when renaming a device group to an existing name or moving it to its current parent group.

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 update a device group.

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

The following example shows how to use Python to update 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/v1.0/inventory/device-mgmt/device-groups/181"
resp = requests.put(url, headers=headers, data=data)

Note:

Use the Get Existing Device Groups API to find the groupId parameter.

Example of the Request Body

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

{
  "name":"devgrp1",
  "parentGroupFullName":"qa-test"
}

Example of the Response Body

The following example shows the contents of the response body.

{
  "fullName": "qa-test/devgrp1",
  "id": "181",
  "name": "devgrp1",
  "parentGroupFullName": "qa-test",
  "parentGroupId": "161"
}

Example 2 of Accessing this API

This example shows how to rename a device group.

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

The following shows an example of the request body.

{
  "name": "test3"
}

The following shows an example response.

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

Example 3 of Accessing this API

This example shows how to move a device group.

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

The following shows an example of the request body.

{
  "parentGroupFullName": "testDevGrp"
}

The following shows an example response.

{
  "fullName": "testDevGrp/test3",
  "id": "102",
  "name": "test3",
  "parentGroupFullName": "testDevGrp",
  "parentGroupId": "61"
}
Back to Top