Updated on 2024-07-23 GMT+08:00

Querying Project Tags

Function

Projects are used to group and isolate OpenStack resources, which include computing, storage, and network resources. A project can be a department or a team. Multiple projects can be created for the same account.

This API is used to query all tags used by a user in a specified project.

URI

GET /v1/{project_id}/servers/tags

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Request

None

Response

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Type

Description

tags

Array of objects

Specifies tags.

Table 3 tag field description

Parameter

Type

Description

key

String

Specifies the tag key.

  • It contains a maximum of 36 Unicode characters.
  • Can be any from Unicode characters (\u4E00-\u9FFF) and the following character set: A-Z, a-z, 0-9, hyphens (-), and underscores (_).

values

Array of strings

Specifies the tag value.

  • Each value contains a maximum of 43 Unicode characters.
  • This field can be left blank.
  • Can be any from Unicode characters (\u4E00-\u9FFF) and the following character set: A-Z, a-z, 0-9, hyphens (-), underscores (_), and periods (.).

Examples

  • Example request
    GET https://{endpoint}/v1/{project_id}/servers/tags
  • Example response
    {
          "tags": [
            {
                "key": "key1",
                "values": [
                    "value1",
                    "value2"
                ]
            },
            {
                "key": "key2",
                "values": [
                    "value1",
                    "value2"
                ]
            }
        ]
    }

Error Codes

See Error Codes.