Help Center/ AI DataLake/ API Reference/ TMS Management/ Querying the Number of Resource Instances
Updated on 2026-11-06 GMT+08:00

Querying the Number of Resource Instances

Function

This API is used to query the number of resource instances by tag. This API is synchronous. There are no accompanying APIs or specific scenarios.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/{resource_type}/resource-instances/count

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Constraints: N/A

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

resource_type

Yes

String

Definition: Resource type, used to specify the type of resource to be tagged.

Constraints: Cannot be empty.

Range

  • aidatalake-workspace: Workspace.

  • aidatalake-endpoint-ray: Ray engine endpoint.

  • aidatalake-endpoint-aura: Aura engine endpoint.

  • aidatalake-endpoint-spark: Spark engine endpoint.

  • aidatalake-endpoint-flink: Flink engine endpoint.

  • aidatalake-compute: Compute resources.

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

engine_types

No

Array of strings

Definition: List of endpoint engine types. Range

  • AuraJob: AuraJob engine.

  • SparkSql: SparkSQL engine.

  • SparkJob: SparkJob engine.

  • FlinkJob: FlinkJob engine.

  • AuraJobV2: AuraJobV2 engine.

  • RayCluster: RayCluster engine.

  • RayJob: RayJob engine.

Constraints: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation.

Default Value: N/A

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

without_any_tag

No

Boolean

Definition: Not containing any tag.

Constraints: N/A

Range

  • true: Resources that do not contain any tag are queried. In this case, the tags filter field is ignored.

  • false: This condition does not take effect, meaning all resources are returned or filtered by tags, matches, or other conditions.

Default Value: N/A

tags

No

Array of V2ResourceTagParam objects

Definition: Tags are included. Each tag contains a maximum of 20 keys. Each key can have up to 20 values. The value corresponding to each key can be an empty array, but the structure cannot be missing.

Constraints: Up to 20.

matches

No

Array of V2TagMatch objects

Definition: Prefix search field. key is a fixed dictionary value. Currently, only resource_name is supported, indicating a search based on the resource name prefix. value is the matching value.

Constraints: N/A

sys_tags

No

Array of V2SystemTagParam objects

Definition: system tag list. Only one tag structure is included currently. Each key contains only one value.

Constraints: N/A

Table 5 V2ResourceTagParam

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Resource tag key.

Constraints: N/A

Range: 1 to 128 characters. Only letters, spaces, digits, underscores (_), periods (.), colons (:), backslashes (), equal signs (=), plus signs (+), minus signs (-), and at signs (@) are allowed.

Default Value: N/A

values

No

Array of strings

Definition: Resource tag value list.

Constraints: Up to 20 strings. Each string has a maximum of 255 characters.

Table 6 V2TagMatch

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Fixed dictionary value.

Constraints: N/A

Range: resource_name, indicating the resource name.

Default Value: N/A

value

No

String

Definition: Prefix matching value based on the field corresponding to key.

Constraints: Up to 255 characters.

Range: N/A

Default Value: N/A

Table 7 V2SystemTagParam

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Key of a system tag.

Constraints: N/A

Range: _sys_enterprise_project_id

Default Value: N/A

values

Yes

Array of strings

Definition: List of system tag values, that is, a list of enterprise project IDs. An enterprise project ID can be obtained by calling the Obtaining an Enterprise Project ID API.

Constraints: N/A

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

total_count

Integer

Definition: Number of tag resource instances.

Range: 0 to 2,147,483,647.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 404

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 408

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Example Requests

Count the number of resources based on tag filtering. The following is an example request.

POST /v2/{project_id}/{resource_type}/resource-instances/count

{
  "without_any_tag" : false,
  "tags" : [ {
    "key" : "tag_key",
    "values" : [ "tag_value" ]
  } ],
  "matches" : [ {
    "key" : "resource_name",
    "value" : "resource_name_value"
  } ]
}

Example Responses

Status code: 200

{
  "total_count" : 1
}

Status code: 400

{
  "error_code" : "AIDataLake.00010151",
  "error_msg" : "Parameter value is invalid.",
  "solution_msg" : "Please input valid parameter value."
}

Status code: 401

{
  "error_code" : "APIGW.0301",
  "error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
  "solution_msg" : "Check whether the IAM authentication information is correct."
}

Status code: 403

{
  "error_code" : "AIDataLake.00010150",
  "error_msg" : "The operation is not allowed.",
  "solution_msg" : "Check whether the operation is allowed in the current status."
}

Status code: 404

{
  "error_code" : "AIDataLake.00010009",
  "error_msg" : "No resources found.",
  "solution_msg" : "Ensure the requested resource exists and the parameters are correct."
}

Status code: 408

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred",
  "solution_msg" : "Try again later. If the problem persists, contact technical support."
}

Status code: 500

{
  "error_code" : "AIDataLake.00011001",
  "error_msg" : "Internal error.",
  "solution_msg" : "Contact technical support or try again later."
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameters.

401

Unauthorized.

403

Access denied.

404

Resource not found.

408

Request timeout.

500

Internal server error.