Update Device Group

Last Updated on : 2023-06-15 05:04:16

Update the information about a specified device group by group ID. When the devices in the device group have not changed, the returned result does not contain a task ID and expiration time. When the devices in the device group have changed, call the API operation of querying the group task information to check whether the task is successful based on the task ID.

API address

PUT: /v1.0/iot-03/device-groups/{group_id}

Request parameter

Parameter nameTypeINRequiredDescription
group_idStringuritrueThe ID of a specified group.

Description of body

Parameter nameTypeINRequiredDescription
group_nameString falseThe name of a specified group.
asset_idString falseThe asset ID.
device_idsList falseThe device ID.

Return parameter

Parameter nameTypeDescription
resultGroupPackageTaskVOThe task information about updating a specified group.

Description of result

Parameter nameTypeDescription
group_idStringThe ID of a specified group.
task_idStringThe task ID. The value is empty if the device data is not changed.
expire_timeLongThe time when the task expires. Unit: seconds. The value is empty if the device data is not changed.

Request example

PUT: /v1.0/iot-03/device-groups/1405519276818854****
{
  "group_name": "Lighting",
  "asset_id": "145248249804602****",
  "device_ids": [
    "6c9a276l739687ul3****",
    "6c6a8s608j21n78f1****"
  ]
}

Return example

{
    "result": {
        "expire_time": 14,
        "task_id": "1405519276103219****",
        "group_id": "1405519276818854****"
    },
    "t": 1623938320521,
    "success": true
}

Error code

For more information, see error code.