Updated on 2022-09-20 GMT+08:00

Creating a Device

Function

This API is used to create a device on ROMA Connect.

URI

POST /v1/{project_id}/link/instances/{instance_id}/devices

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

string

Yes

Project ID of each region of a tenant.

instance_id

string

Yes

ID of the ROMA Connect instance used by the tenant.

Request

Request parameters

Table 2 Body parameter description

Parameter

Type

Mandatory

Description

product_name

string

Yes

Name of a product that has been created.

devices

Array<device>

Yes

Device information.

Table 3 Parameter description of devices

Parameter

Type

Mandatory

Description

device_name

string

Yes

Device name. The value can contain a maximum of 64 characters, including letters, digits, underscores (_), and hyphens (-).

remark

string

No

Description, which contains a maximum of 200 characters.

status

integer

No

Device status. The value can only be 0 (default value) or 1.

  • The value 0 indicates that the device is enabled.
  • The value 1 indicates that the device is disabled.

Example request

https://example.cloud.com/v1/80e2b******f4a398d6409a50932d917/link/instances/fb3b24ab-5d87-473d-9c57-fc6******6a1/devices 
{ 
    "product_name" : "product01",
    "devices" : [
    {
        "device_name" : "device01",
        "remark" : "",
        "status" : 0
    }
    ]
}

Response

Response parameters

The response parameter is an array element.

Table 4 Response parameter description

Parameter

Type

Description

Array elements

Array<device>

Device information.

Table 5 Parameter description of devices

Parameter

Type

Description

client_id

string

Client ID.

device_id

integer

Device ID.

device_name

string

Device name. The value can contain a maximum of 64 characters, including letters, digits, underscores (_), and hyphens (-).

password

string

Password.

product_id

integer

Product ID.

product_name

string

Product name.

remark

string

Product description, which contains a maximum of 200 characters.

status

integer

Device status. The value can be 0 or 1.

  • The value 0 indicates that the device is enabled.
  • The value 1 indicates that the device is disabled.

user_name

string

Username.

Example response

[
   {
       "client_id": "D2096b22290ddd4e",
       "device_id": 868,
       "device_name": "device-ada",
       "password": "*****************",
       "product_id": 209,
       "product_name": "product-ada1",
       "remark": "",
       "status": 0,
       "user_name": "5b24c8a0fb5a4416af1640bb1d25e294"
   }
]