Help Center/ Data Lake Insight/ API Reference/ APIs Related to Resource Tags/ Querying Tags of a Specified Resource Instance
Updated on 2024-11-04 GMT+08:00

Querying Tags of a Specified Resource Instance

Function

This API is used to query tags of a specified resource instance.

URI

GET /v3/{project_id}/{resource_type}/{resource_id}/tags

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

resource_type

Yes

String

Resource type. The options are:

  • dli_queue: queue
  • dli_elastic_resource_pool: elastic resource pool
  • dli_enhanced_datasource: enhanced datasource connection
  • dli_database: database
  • dli_package_resource: resource package (built-in resource packages with a module ID specified are not supported)
  • dli_flink_job: Flink job

resource_id

Yes

String

Resource ID.

Minimum length: 1 character

Maximum length: 1,000 characters

Obtain it as follows:

  • Queue ID: Obtain it by calling Querying All Queues. queue_id in the response indicates the queue ID.
  • Elastic resource pool ID: Obtain it by calling Querying All Elastic Resource Pools. resource_id in the response indicates the elastic resource pool ID.
  • Enhanced datasource connection ID: Obtain the Connection ID on the Enhanced tab of Data Connections page of the DLI management console.
  • Database ID: name of the database that is passed in when adding a tag. You can view the database name on the Data Management > Databases and Tables page of the DLI console.
  • Flink job ID: On the Job Management > Flink Jobs page of the DLI management console, click the name of a Flink job. On the displayed Flink job details page, obtain the Flink job ID.
Table 2 Query parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Number of records displayed on each page. The default value is 1000.

offset

No

Integer

Query result offset. The default value is 0.

Request Parameters

None

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

count

Integer

Number of tags.

tags

Array of objects

List of resource tags. For details, see Table 4.

Table 4 tags field data structure description

Parameter

Type

Description

key

String

Resource tag key.

value

Array of strings

List of resource tag values.

Example Request

None

Example Response

{
       "count": 2,
       "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value3"
        }
]
}

Status Codes

Status Code

Description

200

The modification is successful.

400

Request error.

500

Internal server error.

Error Codes

See Error Codes.