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

Creating a Custom Topic for a Device

Function

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

URI

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

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.

device_name

string

Yes

Name of a product that has been created.

topic_name

string

Yes

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

topic_perm

string

Yes

Permission of a topic. Only the pub and sub permissions are supported.

remark

string

No

Description, which contains a maximum of 200 characters.

Example request

https://example.cloud.com/v1/80e2b******f4a398d6409a50932d917/link/instances/fb3b24ab-5d87-473d-9c57-fc6******6a1/topics 
{ 
    "product_name" : "product01",
    "device_name" : "device01",
    "topic_name" : "alarm",
    "topic_perm" : "pub",
    "remark" : "alarm topic"
}

Response

Response parameters

Table 3 Response parameter description

Parameter

Type

Description

remark

string

Device description, which contains a maximum of 200 characters.

topic_id

integer

Topic ID.

  • -1: system topic.
  • A value greater than 0: customized topic.

topic_name

string

Topic name.

topic_perm

string

Permission of a topic. Only the pub and sub permissions are supported.

Example response

{
    "remark": "alarm topic ",
    "topic_id": null,
    "topic_name": "alarm",
    "topic_perm": "pub"
}