API: rcs/media - 創(chuàng)建素材
概覽
rcs/upload
是 SUBMAIL 5G消息的素材創(chuàng)建 API。
URL
https://api-v4.mysubmail.com/rcs/media
接口響應(yīng)數(shù)據(jù)格式
格式 | URL |
---|---|
json | https://api-v4.mysubmail.com/rcs/media.json (默認(rèn)) |
xml | https://api-v4.mysubmail.com/rcs/media.xml |
yaml | https://api-v4.mysubmail.com/rcs/media.yaml |
http 請(qǐng)求方式
請(qǐng)求方式 | content-type設(shè)置 |
---|---|
post | multipart/form-data |
請(qǐng)求參數(shù)
參數(shù) | 類型 | 必需/可選 | 默認(rèn) | 描述 |
---|---|---|---|---|
appid | string | 必須 | 無(wú) | 在 SUBMAIL Chatbot中創(chuàng)建的5G消息應(yīng)用ID |
file | file | 必須 | 無(wú) | 素材文件 素材大小建議控制在2M內(nèi) |
timestamp | int | 可選 | 無(wú) | UNIX 時(shí)間戳,結(jié)果以秒為單位,使用加密鑒權(quán)方式,此參數(shù)必填 |
signType | string | 可選 | normal | API 鑒權(quán)模式,可選參數(shù)normal 、sha256 |
signature | string | 必須 | 無(wú) | 鑒權(quán)簽名 1. 當(dāng) signType 為sha256 時(shí),將以下參數(shù)拼接appid +appkey +appid=?&signType=sha256& timestamp=1712122221 +appid +appkey “+”號(hào)為鏈接符號(hào),不參與拼接 用sha256將以上拼接字符串加密作為鑒權(quán)參數(shù) 當(dāng) signType 為normal 時(shí),appkey 即是signature 的值 |
請(qǐng)求示例
POST /rcs/media HTTP/1.1
Host: api-v4.mysubmail.com
Content-Length: 370
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="appid"
appid
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="signature"
signature
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="123.png"
Content-Type: image/png
(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--
成功返回
{
"status": "success",
"id": "ikJvMC", //素材ID
}
失敗返回
{
"status":"error",
"code":"2xxx",
"msg":"錯(cuò)誤信息描述"
}