# 上传勋章图片

通过该接口可以上传勋章详情图、挂饰图的文件，获取对应的文件key。

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/admin/v1/badge_images
HTTP Method | POST
接口频率限制 | [20 次/分钟](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用** | 查看、创建、编辑勋章信息和上传勋章图片(admin:badge)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `tenant_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：如何选择与获取 access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | 是 | **示例值**："multipart/form-data; boundary=---7MA4YWxkTrZu0gW"

### 请求体

名称 | 类型 | 必填 | 描述
---|---|---|---
image_file | file | 是 | 勋章图片的文件，仅支持 PNG 格式，320 x 320 像素，大小不超过 1024 KB。<br>**示例值**：file binary
image_type | int | 是 | 图片的类型<br>**示例值**：1<br>**可选值有**：<br>- 1：勋章详情图<br>- 2：勋章挂饰图<br>**数据校验规则**：<br>- 取值范围：`1` ～ `2`

### 请求体示例

```HTTP
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image_file";
Content-Type: application/octet-stream

---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image_type";

1
---7MA4YWxkTrZu0gW
```

## 响应

### 响应体

名称 | 类型 | 描述
---|---|---
code | int | 错误码，非 0 表示失败
msg | string | 错误描述
data | \- | \-
image_key | string | 图片的key

### 响应体示例
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "image_key": "f02a98aa-1413-4af6-93ab-431ba9e5f2cg"
    }
}
```

### 错误码

HTTP状态码 | 错误码 | 描述 | 排查建议
---|---|---|---
500 | 1051000 | unknown server error | 服务内部错误，请稍后重试
400 | 1051001 | request contain invalid param | 请求中包含非法参数
403 | 1051002 | request to exceed authority | 请求发生越权
400 | 1051100 | the image size is too large | 上传的图片大小不符合要求
400 | 1051101 | the image format is illegal | 上传的图片格式不符合要求
400 | 1051109 | the image height is too small | 图片尺寸高度过小
400 | 1051110 | the image height is too large | 图片尺寸高度过大
400 | 1051111 | the aspect ratio of the image is too small | 图片尺寸宽高比过小
400 | 1051112 | the aspect ratio of the image is too large | 图片尺寸宽高比过大
403 | 1051003 | the tenant's current payment plan does not support the use of this function | 该租户当前套餐不能使用勋章功能点

