Updated on 2023-08-02 GMT+08:00

Querying Environment Tags

Function

This API is used to query environment tags.

URI

POST /v1/apm2/openapi/cmdb/tag/get-env-tag-list

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

x-business-id

Yes

Long

Application ID.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tag_id

No

Long

Environment tag ID.

tag_name

No

String

Environment tag name.

env_id

No

Long

Environment ID.

descp

No

String

Description.

business_id

Yes

Long

Application ID.

env_id_list

No

Array of integers

Environment ID list.

tag_id_list

No

Array of integers

Environment tag ID list.

keyword

No

String

Keyword.

page_enable

Yes

Boolean

Whether pagination is supported.

page_number

No

Integer

Number of records on each page.

page_size

No

Integer

Current page number.

add_env_id_list

No

Array of integers

IDs of environments to be added.

add_tag_id_list

No

Array of integers

IDs of environment tags to be added.

remove_tag_id_list

No

Array of integers

IDs of environment tags to be removed.

remove_env_id_list

No

Array of integers

IDs of the environments to be removed.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

env_tags

Array of CmdbTagEntity objects

Environment tag list.

total_count

Integer

Total number.

Table 4 CmdbTagEntity

Parameter

Type

Description

name

String

Environment tag name.

business_id

Long

Application ID.

uuid

String

UUID.

descp

String

Description.

creator_id

Long

Creator ID.

env_id_list

Array of integers

Environment ID list.

id

Long

Environment tag ID.

gmt_create

String

Creation time.

gmt_modify

String

Update time.

Example Requests

Query the environment tag of application 162. The query result is displayed on the same page.

/v1/apm2/openapi/cmdb/tag/get-env-tag-list

{
  "business_id" : 162,
  "page_enable" : false
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "env_tags" : [ {
    "name" : "suzhou-roma-2",
    "businessId" : 162,
    "uuid" : "e9c8f632*********cbfcfa148c0",
    "descp" : null,
    "creatorId" : null,
    "envIdList" : null,
    "id" : 72,
    "gmt_create" : "2022-10-25T02:18:44.000+00:00",
    "gmt_modify" : "2022-10-25T02:18:44.000+00:00"
  } ],
  "total_count" : 1
}

Status Codes

Status Code

Description

200

OK: The request is successful.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.