Create Group

Last Updated on : 2023-11-23 06:24:48download

Create a Wi-Fi group. The group shall be a collection of devices in the same category and the same space.

API address

POST: /v2.0/cloud/thing/group

Request parameter

Description of body

Parameter nameTypeINRequiredDescription
space_idStringbodytrueThe ID of the specified space.
nameStringbodytrueThe name of the specified group.
product_idStringbodytrueThe product ID (PID).
device_idsStringbodytrueThe list of up to 20 device IDs, separated with commas (,).

Return parameter

Parameter nameTypeDescription
resultDeviceGroupCloudDTOThe returned result of the specified group.
successBooleanIndicates whether the operation is successful. Valid values:
  • true: The operation succeeded.
  • false: The operation failed.
tBooleanThe timestamp.
tidBooleanThe link ID.

Description of result

Parameter nameTypeDescription
idLongThe ID of the specified group.
nameStringThe name of the specified group.
pvStringThe version number of the specified MQTT protocol.
timeLongThe time when a group is created.
typeIntegerThe type of the specified group. Valid values:
  • 0: Devices that can be directly connected to the cloud.
  • 1:Devices that cannot be directly connected to the cloud, but can only be connected to the cloud through gateways.
uidStringThe ID of a user in the specified group.
group_typeIntegerThe protocol type applicable to the specified group. Valid values:
  • 0: Wi-Fi
  • 1: Bluetooth low energy
  • 2: Zigbee
  • 3: Bluetooth mesh
icon_urlStringThe picture of the specified group. A product picture is used by default. Currently, you cannot change the product picture.
local_keyStringThe localKey used for the MQTT connection.
owner_idStringThe ID of the space to which the specified group belongs.
product_idStringThe ID of a product in the group.

Request example

POST: /v2.0/cloud/thing/group
  "space_id": "25129******",
  "name": "Test Group**",
  "product_id": "dsadhsjkh2***",
  "device_ids": "dshajhdkhaj***,hsdkajhkk***"

Return example

    "tid": "22b76e4eb71211edabe5e6670becb070",
    "result": {
        "local_key": "93fda9e167da***",
        "pv": "2.2",
        "group_type": 0,
        "type": 0,
        "product_id": "fqi9xqldl****",
        "name": "测***",
        "id": 1286611,
        "time": 1677552405152
    "t": 1677552405220,
    "success": true

Error code

For more information, see error code.

Limits on API Request Frequency

For more information, see Limits on API Request Frequency.