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:
  {
      "media_item": {
          "url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image3xxl.jpg"
      }
  }

response:
  {
    "id": 14,
    "media_item_type": "ImageMediaItem",
    "url": "http://images.asos-media.com/inv/media/0/0/3/2/3882300/white/image3xxl.jpg",
    "description": "image description",
    "sort_order": 1048576,
    "is_primary": true,
    "is_uploaded": null,
    "product_id": 9,
    "position": 1,
    "tag_list": [
      "lady's"
    ]
  }

Params

Param name Description
media_item
required

Validations:

  • Must be a Hash

media_item[media_item_type]
optional , nil allowed

Validations:

  • Must be one of: ImageMediaItem, VideoMediaItem, FileMediaItem.

media_item[product_id]
optional , nil allowed

Product ID. Required if assigning media item to product and product_code is not provided

Validations:

  • Must be a Integer

media_item[product_code]
optional , nil allowed

Product Code. Required if assigning media item to product and product_id is not provided

Validations:

  • Must be a String

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:

  • Must be one of: NpcEntity, Category.

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:

  • Must be a Integer

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:

  • Must be a String

media_item[url]
optional

URL that stores the corresponding media item

Validations:

  • Must be a String

media_item[description]
optional , nil allowed

Description for the media item

Validations:

  • Must be a String

media_item[sort_order_position]
optional , nil allowed

This field is deprecated. Please use position instead

Validations:

  • Must be a Integer

media_item[is_primary]
optional , nil allowed

Make this media item as primary

Validations:

  • Must be one of: true, false, 1, 0.

media_item[tag_list]
optional , nil allowed

Tags for this media item

Validations:

  • Must be an array of String

media_item[etag]
optional , nil allowed

ETag for the resource on the url

Validations:

  • Must be a String

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:

  • Must be a Hash

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:

  • Must be one of: true, false, 1, 0.

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:

  • Must be a String

media_item[processing_options][processed_tags]
optional , nil allowed

The tags for the created media item.

Validations:

  • Must be an array of String

media_item[derived_media_items]
optional , nil allowed

Transformations for this image

Validations:

  • Must be an Array of nested elements

media_item[derived_media_items][name]
optional , nil allowed

Name for the transformation

Validations:

  • Must be a String

media_item[derived_media_items][url]
optional , nil allowed

URL for the transformation

Validations:

  • Must be a String

media_item[position]
optional , nil allowed

Sort order value. Warning: Drag and drop sorting from UI might change the position you have set.

Validations:

  • Must be a Integer

media_item[attribute_values]
optional , nil allowed

Attribute values assigned to the Media Item.

Validations:

  • Must be an array of any type