查询资源实例数量
功能介绍
通过标签查询工作空间数量:without_any_tag=true时查询无标签资源,忽略tags字段;false或未提供时,按tags、matches等条件过滤。tags最多含20个键,每键最多20个值,键不可重复,值可为空但结构不可缺失。matches支持特定字段的精确或模糊搜索。返回符合过滤条件的工作空间数量。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST https://localhost.com/v1/{project_id}/fabric-workspace/resource-instances/count
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
|
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
否 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
without_any_tag |
否 |
Boolean |
|
tags |
否 |
Array of ResourceTagParam objects |
|
matches |
否 |
Array of TagMatch objects |
|
sys_tags |
否 |
Array of SystemTagParam objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
key |
是 |
String |
|
values |
否 |
Array of strings |
|
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
X-request-id |
String |
|
参数 |
参数类型 |
描述 |
---|---|---|
total_count |
Integer |
实例总数。 |
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:408
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
请求示例
请求统计tag_key的标签的资源,具体请求实例如下。
POST https://{endpoint}/v1/{project_id}/fabric-workspace/resource-instances/count
{
"without_any_tag" : false,
"tags" : [ {
"key" : "tag_key",
"values" : [ "tag_value" ]
} ],
"matches" : [ {
"key" : "resource_name",
"value" : "tag_value"
} ],
"sys_tags" : ""
}
响应示例
状态码:200
OK
{
"total_count" : 1
}
状态码:400
BadRequest
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}
状态码:401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
状态码:403
Forbidden
{
"error" : {
"code" : "403",
"message" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
},
"error_code" : 403,
"error_msg" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
}
状态码:404
NotFound
{
"error_code" : "common.01000001",
"error_msg" : "response status exception, code: 404"
}
状态码:408
Request Time-out
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred"
}
状态码:500
InternalServerError
{
"error_code" : "common.00000500",
"error_msg" : "internal error"
}
状态码
状态码 |
描述 |
---|---|
200 |
OK |
400 |
BadRequest |
401 |
Unauthorized |
403 |
Forbidden |
404 |
NotFound |
408 |
Request Time-out |
500 |
InternalServerError |
错误码
请参见错误码。