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

Querying Device Topics

Function

This API is used to query the topic name, ID, permission, and description.

URI

GET /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.

device_name

string

Yes

Device name based on which topics are queried.

product_name

string

Yes

Product name based on which topics are queried.

Request

Request parameters

None

Example request

https://example.cloud.com/v1/80e2b******f4a398d6409a50932d917/link/instances/fb3b24ab-5d87-473d-9c57-fc6******6a1/topics?device_name=device01& product_name =product01

Response

Response parameters

The response parameter is an array element.

Table 2 Response parameter description

Parameter

Type

Description

Array elements

Array<topic>

Topic list information.

Table 3 topic

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": "Pub Topics",
        "topic_id": 122,
        "topic_name": "lozrWs4y7218/out/device01",
        "topic_perm": "pub"
    },
    {
        "remark": "Sub Topics",
        "topic_id": 123,
        "topic_name": "lozrWs4y7218/in/device01",
        "topic_perm": "sub"
    },
    {
        "remark": "Update Shadow Topic",
        "topic_id": 124,
        "topic_name": "shadow/update/lozrWs4y7218/device01",
        "topic_perm": "pub"
    }
]