コンテンツアップロード
メンバーに送信するコンテンツをアップロードします。
アップロード後に発行される resourceId の値を メッセージ送信やリッチメニュー画像の設定などに利用することができます。
注意
- コンテンツはアップロード後 24 時間を経過すると自動的に削除されます。
API の種類
サーバー API
Request URL
http://storage.worksmobile.com/openapi/message/upload.api
HTTP Method
POST(Content-Type: multipart/form-data)
Request Header
リクエストヘッダー | 説明 |
---|---|
consumerKey | Server API Consumer Key |
authorization | Token 'Bearer' を明記し、'Bearer' と 'Token' の間に半角スペース (space) を入れること。 |
x-works-apiid | API ID |
Response Header
リクエストヘッダー | 説明 |
---|---|
x-works-resource-id | アップロードしたコンテンツの resourceId |
Request Example
multipart/form-data でフィールド名を "resourceName" に指定してファイルをアップロードします。
POST /openapi/message/upload.api HTTP/1.1
Host: storage.worksmobile.com
consumerKey:LQwDde6x8eV4ROOCOdSW
authorization: Bearer AAAA67h9/36ItvAEea7G8ijrDeCy/22BO5IcP0/KkwZO6unIYET6xkmp3RLW
x-works-apiid: jp1AqBWcedRFt
Content-Length: 11410
Content-Type: multipart/form-data; boundary=----------------------------74eee5798fec
------------------------------74eee5798fec
Content-Disposition: form-data; name="resourceName"; filename="sample.png"
Content-Type: application/octet-stream
.PNG***(skip)
------------------------------74eee5798fec--
Curl Example
応答にレスポンスヘッダーの x-works-resource-id の値を利用します。
curl -XPOST "http://storage.worksmobile.com/openapi/message/upload.api" \
-H "consumerKey:LQwDde6x8eV4ROOCOdSW" \
-H "authorization: Bearer AAAA67h9/36ItvAEea7G8ijrDeCy/22BO5IcP0/KkwZO6unIYET6xkmp3RLW" \
-H "x-works-apiid:jp1wwxrYebIat" \
-F "resourceName=@sample.png" -i
HTTP/1.1 200 OK
Server: FileCloud
Content-Type: application/json;charset=UTF-8
ETag: 1522604899
x-works-resource-id: WAAAQPwBexX2HnseNvvM9Zyhvp2kIRF3Ul7L7/aMVti8=
Content-Length: 131
{
"code":0,
"message":"success",
"result":{
"accessKey":"",
"resourceCid":"1522604899362238275",
"resourceSize":11205
}
}