
# 批量设置/取消设置标签接口 - BatchSetTags
#### 功能介绍
批量设置/取消设置标签接口
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/GSL/doc?api=BatchSetTags)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-ocgsl/gsl_07_0026.html)。
#### URI
POST /v1/sim-tags/batch-set
#### 请求参数
表1请求Body参数 
| 参数           | 是否必选 | 参数类型             | 描述                                                                                                                       |
|:---|:---|:---|:---|
| file_temp_id | 否    | Long             | 临时文件ID                                                                                                                   |
| sim_card_ids | 否    | Array of longs   | SIM卡id列表，最多500.sim_card_ids与iccids不能同时为空，sim_card_ids参数为空则根据iccids参数处理 最小值：**0** 数组长度：**0 - 500**                        |
| iccids       | 否    | Array of strings | iccid列表，最多支持传入500个iccid。sim_card_ids与iccids不能同时为空，sim_card_ids参数为空则根据iccids参数处理 最小长度：**19** 最大长度：**20** 数组长度：**0 - 500** |
| tag_ids      | 否    | Array of longs   | 绑定的标签id列表，最多10 最小值：**0** 数组长度：**0 - 10**                                                                                 |
   
#### 响应参数
**状态码：200**
表2响应Body参数 
| 参数 | 参数类型    | 描述 |
|:---|:---|:---|
| -  | Boolean | OK |
   
**状态码：400**
表3响应Body参数 
| 参数         | 参数类型   | 描述                |
|:---|:---|:---|
| error_code | String | 错误码 最大长度：**64**   |
| error_msg  | String | 错误描述 最大长度：**512** |
   
**状态码：500**
表4响应Body参数 
| 参数         | 参数类型   | 描述                |
|:---|:---|:---|
| error_code | String | 错误码 最大长度：**64**   |
| error_msg  | String | 错误描述 最大长度：**512** |
   
#### 请求示例
- 批量设置/取消设置标签。指定SIM卡ID"123456"和"234567"绑定标签"123"。
  ```
  POST https://{endpoint}/v1/sim-tags/batch-set
  {
    "sim_card_ids" : [ 123456, 234567 ],
    "tag_ids" : [ 123 ]
  }
  ```
- 批量设置/取消标签。当参数sim_card_ids不传或长度为0时，指定SIM卡iccid"898606xxxxxxxxxxxx"和"898601xxxxxxxxxxxx"绑定标签"123"。
  ```
  POST https://{endpoint}/v1/sim-tags/batch-set
  {
    "sim_card_ids" : [ ],
    "iccids" : [ "898606xxxxxxxxxxxx", "898601xxxxxxxxxxxx" ],
    "tag_ids" : [ 123 ]
  }
  ```
#### 响应示例
**状态码：400**
Parameter Invalid
- 示例 1
  ```
  {
    "error_code" : "GSL.00010001",
    "error_msg" : "请求携带的token无效。"
  }
  ```
- 示例 2
  ```
  {
    "error_code" : "GSL.00012016",
    "error_msg" : "SIM卡文件不存在，请检查！"
  }
  ```
- 示例 3
  ```
  {
    "error_code" : "GSL.000160051",
    "error_msg" : "SIM卡数量必须介于1和500之间，请重新输入！"
  }
  ```
- 示例 4
  ```
  {
    "error_code" : "GSL.000160052",
    "error_msg" : "标签数量必须介于0-10之间，请重新输入！"
  }
  ```
- 示例 5
  ```
  {
    "error_code" : "GSL.000160053",
    "error_msg" : "以下simCardId/tagId不存在或没有操作权限，请重新输入！simCardId/tagId : [-3333, 111, 656565465]"
  }
  ```
- 示例 6
  ```
  {
    "error_code" : "GSL.000160054",
    "error_msg" : "以下simCardId/tagId重复，请重新输入！simCardId/tagId : [2, 3]"
  }
  ```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "GSL.00010003",
  "error_msg" : "系统繁忙，请稍后重试。"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Parameter Invalid     |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-ocgsl/ErrorCode.html)。
