
# 根据标签查询代码解释器数量 - ShowCoreCodeInterpreterNumsByTags
#### 功能介绍
该API用于根据标签查询代码解释器数量。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-agentarts/agentarts_07_0003.html)。
#### 授权信息
账号根用户具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备如下身份策略权限，更多的权限说明请参见[权限和授权项](https://support.huaweicloud.com/api-agentarts/Permission.html)。
| 授权项                           | 访问级别 | 资源类型（\*为必须） | 条件键       | 别名 | 依赖的授权项 |
|:---|:---|:---|:---|:---|:---|
| agentarts::listResourcesByTag | List | -           | g:TagKeys | -  | -      |
   
#### URI
POST /v1/code-interpreters/resource-instances/count
#### 请求参数
表1请求Body参数 
| 参数              | 是否必选 | 参数类型                                                                                                              | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|:---|
| without_any_tag | 否    | Boolean                                                                                                           | **参数解释：** 是否查询所有不带标签的资源。 **约束限制：** 不涉及。 **取值范围：** - true：查询所有不带标签的资源，此时忽略"tags"字段。   - false：该条件不生效，返回所有资源或按"tags"、"matches"等条件过滤。    **默认取值：** false。 |
| tags            | 否    | Array of [CoreToolsTagValuesForTMS] objects | **参数解释：** 包含标签，结果返回包含所有标签的资源列表。 **约束限制：** 最多包含20个key，每个key下面的value最多20个。Key不能重复，同一个key中values不能重复。每个key对应的value可以为空数组但结构体不能缺失。 **取值范围：** 数组长度0-20。 **默认取值：** 不涉及，无tag过滤条件时返回全量数据。                                                                                                                                                                                                                                                                                                                                        |
| matches         | 否    | Array of [CoreToolsTagForTMS] objects             | **参数解释：** 标签键值匹配规则，key之间是与的关系，key-value结构中value是或的关系。无matches过滤条件时返回全量数据，当matches和tags同时存在时表示获取同时满足matches和tags的资源。 **约束限制：** Key不能重复，同一个key中values不能重复，每个key对应的value可以为空数组但结构体不能缺失。 **取值范围：** 数组长度最大为1。 **默认取值：** 不涉及。                                                                                                                                                                                                                                                                                                  |
   
 表2CoreToolsTagValuesForTMS 
| 参数     | 是否必选 | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| key    | 是    | String           | **参数解释：** 标签键。 **约束限制：** 不能为空或空字符串，不能为空格，校验和使用之前先trim前后的半角空格，且不能以_sys_开头。 **取值范围：** 最大长度128个unicode字符，可用 UTF-8 格式表示的字母、数字和空格，以及以下字符：_ . : / = + - @。 **默认取值：** 不涉及。                                                        |
| values | 是    | Array of strings | **参数解释：** 标签值列表，value之间为或的关系。 **约束限制：** value可为空数组但不可缺省，如果values为空列表则表示any_value（查询任意value）。校验和使用之前先trim前后的半角空格。 **取值范围：** 最小数量0，最大数量20，每个值最大长度255个unicode字符，可用 UTF-8 格式表示的字母、数字和空格，以及以下字符：_ . : / = + - @。 **默认取值：** 不涉及。 |
   
 表3CoreToolsTagForTMS 
| 参数    | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| key   | 是    | String | **参数解释：** 搜索字段名称，当前仅支持resource_name，后续可扩展。 **约束限制：** key为固定字典值，不能包含重复的key或不支持的key。 **取值范围：** resource_name。 **默认取值：** 不涉及。                      |
| value | 是    | String | **参数解释：** 搜索字段的值。 **约束限制：** 支持前缀搜索，如果value为空字符串则精确匹配。 **取值范围：** 最大长度255个unicode字符，可用 UTF-8 格式表示的字母、数字和空格，以及以下字符：_ . : / = + - @。 **默认取值：** 不涉及。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数          | 参数类型    | 描述                                                                                                                                                                                             |
|:---|:---|:---|
| total_count | Integer | **参数解释：** 总记录数。 **取值范围：** 非负整数。 |
   
**状态码：400**
 表5响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
**状态码：401**
表6响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
**状态码：403**
表7响应Body参数 
| 参数                            | 参数类型                                                                                                       | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code                    | String                                                                                                     | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg                     | String                                                                                                     | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
| encoded_authorization_message | String                                                                                                     | **参数解释：** 编码后的授权失败信息。 **取值范围：** 不涉及。                                       |
| details                       | Array of [CoreToolsCommonError] objects | **参数解释：** 依赖的下游服务错误信息列表。 **取值范围：** 不涉及。                                    |
   
表8CoreToolsCommonError 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
**状态码：404**
表9响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
**状态码：429**
表10响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
**状态码：500**
表11响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。 **取值范围：** 满足正则\^AgentArts.0400\\d{4}$，例如AgentArts.04000404。 |
| error_msg  | String | **参数解释：** 错误信息。 **取值范围：** 不涉及。                                             |
   
#### 请求示例
```
/v1/code-interpreters/resource-instances/count
{
  "without_any_tag" : false,
  "tags" : [ {
    "key" : "key1",
    "values" : [ "value1" ]
  } ]
}
```
#### 响应示例
**状态码：400**
请求参数错误。
```
{
  "error_code" : "AgentArts.04000001",
  "error_msg" : "Invalid parameter."
}
```
**状态码：401**
认证失败。
```
{
  "error_code" : "AgentArts.04000002",
  "error_msg" : "Authentication failed: invalid token"
}
```
**状态码：403**
权限不足。
```
{
  "error_code" : "AgentArts.04000003",
  "error_msg" : "Authentication failed: you have no permission of VCPEP.",
  "encoded_authorization_message" : "eyJlcnJvciI6ICJVbmF1dGhvcml6ZWQifQ==",
  "details" : [ {
    "error_code" : "AgentArts.04000403",
    "error_msg" : "Authentication information is incorrect or you have no permissions."
  } ]
}
```
**状态码：404**
资源不存在。
```
{
  "error_code" : "AgentArts.04000004",
  "error_msg" : "Resource not found"
}
```
**状态码：429**
请求频率超限。
```
{
  "error_code" : "AgentArts.04000006",
  "error_msg" : "Too many requests: please retry later"
}
```
**状态码：500**
内部系统错误。
```
{
  "error_code" : "AgentArts.04000000",
  "error_msg" : "System error. Please retry."
}
```
#### 状态码
| 状态码 | 描述               |
|:---|:---|
| 200 | 根据标签查询代码解释器数量成功。 |
| 400 | 请求参数错误。          |
| 401 | 认证失败。            |
| 403 | 权限不足。            |
| 404 | 资源不存在。           |
| 429 | 请求频率超限。          |
| 500 | 内部系统错误。          |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-agentarts/ErrorCode.html)。
