Create Media
Request Body
Field | Type | Description | |
---|---|---|---|
data | binary | upload file binary 容量限制為8MB 或8388608 bytes 支援格式為 png gif jpeg jpg The maximum file size is 8MB or 8388608 bytes Support png gif jpeg jpg data |
Sample Request
Header
Field | Type | ||
---|---|---|---|
Authorization | String | Bearer authentication with access token given |
curl --location --request POST '<<api_domain>>/v1/media' \
--header 'Authorization: Bearer ${access_token}' \
--form 'data=@/path/wallpaper.png'
We accept multipart/form-data
An example to upload a file with okhttp
https://gist.github.com/balvinder294/e869944161cb0af250b1296f64e3129a
An example to upload a file with php curl
https://gist.github.com/maxivak/18fcac476a2f4ea02e5f80b303811d5f
guzzle
https://github.com/guzzle/guzzle/issues/2296
An example to upload a file with nodejs axios
https://maximorlov.com/send-a-file-with-axios-in-nodejs/
Sample Response
{
"result": true,
"message": "",
"data": {
"images": {
"original": {
"width": 120,
"height": 120,
"url": "https://img.shoplineapp.com/media/image_clips/6217735bee0709002ff6fdd5/original.png?1645704027"
}
},
"_id": "6217735bee0709002ff6fdd5",
"alt_translations": {}
},
"status": 200,
"images": {
"original": {
"width": 120,
"height": 120,
"url": "https://img.shoplineapp.com/media/image_clips/6217735bee0709002ff6fdd5/original.png?1645704027"
}
},
"_id": "6217735bee0709002ff6fdd5",
"alt_translations": {}
}
Failures
When file size exceeds limit or the file is not a valid media.
{
"result": false,
"message": "unprocessable_entity",
"status": 422
}
Updated 9 months ago