Supported Formats
json
Errors
Code |
Description |
401 |
Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource. |
403 |
Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource. |
404 |
Not Found. The requested resource could not be found. |
422 |
Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors. |
500 |
Internal Server Error. An unexpected condition was encountered. |
Examples
request:
curl --request POST --url https://product.commerceconnect.co/api/v2/media_items/upload --header 'authorization: Token token=YOUR_TOKEN,email=YOUR_EMAIL' --header 'content-type: multipart/form-data;' --form 'image_media_item[asset]=@test.png' --form product_id=257 --form 'image_media_item[description]=Test' --form 'image_media_item[sort_order_position]=1' --form 'image_media_item[is_primary]=true' --form 'image_media_item[tag_list]=test_tag' --form 'image_media_item[position]=100'
response:
{
"id": 968,
"media_item_type": "ImageMediaItem",
"url": "http://s3-ap-southeast-2.amazonaws.com/fusionfactory.commerceconnect.localming6.local/pim_media/000/000/968/test.png?1487740669",
"description": "Test",
"sort_order": 7340032,
"is_primary": true,
"is_uploaded": true,
"product_id": 257,
"asset_file_name": "test.png",
"position": 100,
"tag_list": [
"test_tag"
]
}