| 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. |
request:
{
"media_item": {
"media_item_type": "ImageMediaItem",
"product_id": 9,
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image.jpg",
"description": "image description",
"position": 2,
"is_primary": true,
"tag_list": ["lady's"],
"derived_media_items": [
{
"name": "crop",
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image-crop.jpg"
}
],
"attribute_values": [
{
"attribute_definition_id": 16,
"attribute_definition_code": "img_desc",
"data": "image description"
}
]
}
}
Sample: create a media item for Npc Entity with npc entity code
{
"media_item": {
"media_item_type": "ImageMediaItem",
"associated_type": "NpcEntity",
"associated_code": "cotton",
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image.jpg",
"description": "image description",
"position": 2
"is_primary": true,
"tag_list": ["lady's"],
"derived_media_items": [
{
"name": "crop",
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image-crop.jpg"
}
]
}
}
Sample: create a media item for Category with category id
{
"media_item": {
"media_item_type": "ImageMediaItem",
"associated_type": "Category",
"associated_id": 1,
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image.jpg",
"description": "image description",
"position": 2
"is_primary": true,
"tag_list": ["lady's"]
}
}
Sample: reset multi shared reference association
Supported Mode:
- upsert: default
- reset: Delete all existing association for this attribute, and replace with the current one. Send empty array to remove all existing values.
{
"media_item": {
"media_item_type": "ImageMediaItem",
"product_id": 9,
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image.jpg",
"attribute_values": [
{
"attribute_definition_id": 16,
"attribute_definition_code": "img_desc",
"data": {
"associated_code": ["code_1", "code_2"]
}
"mode": "reset"
}
]
}
}
response:
{
"id": 14,
"media_item_type": "ImageMediaItem",
"url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image2xxl.jpg",
"description": "image description",
"sort_order": 1048576,
"is_primary": true,
"is_uploaded": null,
"product_id": 9,
"tag_list": [
"lady's"
],
"position": 2
}
| Param name | Description |
|---|---|
|
media_item required |
Validations:
|
|
media_item[media_item_type] optional , nil allowed |
Validations:
|
|
media_item[product_id] optional , nil allowed |
Product ID. Required if assigning media item to product and product_code is not provided Validations:
|
|
media_item[product_code] optional , nil allowed |
Product Code. Required if assigning media item to product and product_id is not provided Validations:
|
|
media_item[associated_type] optional , nil allowed |
Associated entity class name. Required if assigning media item to entity other than product like Npc Entity, Category Validations:
|
|
media_item[associated_id] optional , nil allowed |
Associated entity ID. Required if assigning media item to entity other than product and associated_code is not provided Validations:
|
|
media_item[associated_code] optional , nil allowed |
Associated entity Code. Required if assigning media item to entity other than product and associated_id is not provided. Not supported for Category Validations:
|
|
media_item[url] required |
URL that stores the corresponding media item Validations:
|
|
media_item[description] optional , nil allowed |
Description for the media item Validations:
|
|
media_item[sort_order_position] optional , nil allowed |
This field is deprecated. Please use position instead Validations:
|
|
media_item[is_primary] optional , nil allowed |
Make this media item as primary Validations:
|
|
media_item[tag_list] optional , nil allowed |
Tags for this media item Validations:
|
|
media_item[etag] optional , nil allowed |
ETag for the resource on the url Validations:
|
|
media_item[processing_options] optional , nil allowed |
Options to perform extra image processing on the media item. This is applicable only when media_item_type is ‘ImageMediaItem’ Validations:
|
|
media_item[processing_options][apply_background] optional , nil allowed |
Setting this to true would result in a new media item created against the product with background applied. Removes transparency. Validations:
|
|
media_item[processing_options][background_colour] optional , nil allowed |
The colour name or a hex colour code for the background colour for the created media item. Defaults to white. Validations:
|
|
media_item[processing_options][processed_tags] optional , nil allowed |
The tags for the created media item. Validations:
|
|
media_item[derived_media_items] optional , nil allowed |
Transformations for this image Validations:
|
|
media_item[derived_media_items][name] optional , nil allowed |
Name for the transformation Validations:
|
|
media_item[derived_media_items][url] optional , nil allowed |
URL for the transformation Validations:
|
|
media_item[position] optional , nil allowed |
Sort order value. Warning: Drag and drop sorting from UI might change the position you have set. Validations:
|
|
media_item[attribute_values] optional , nil allowed |
Attribute values assigned to the Media Item. Validations:
|