Update a Product Media item

PUT /api/v2/products/{productId}/media/{id}.json

Update an existing Product Media item by its ID.

Scope

Requires the products OAuth scope.

Parameters

Your request must provide the following URL parameters:

id required
The ID of your Product Media object
productId required
The ID of your Product object


Request body

Your request body must contain an object including:

data required
Containing updates to your Product Media object.


Example JSON request

To update a Product Media item you must PUT JSON to this resource within a data object. You do not need to supply all properties and may choose to only supply properties that require modifying.

{
    "data": {
        "image": "https://url-to-import.com/example-image.jpg,
        "title": "Example image"
    }
}


Success responses

If the Media item was updated successfully you should receive a response with a 200 status code:

success
A boolean where a value of true means the object was saved successfully.
status
The HTTP status code e.g. 200 means the object was updated successfully.
data
Contains the Product Media object you updated.


Error responses

If the Media could not be updated you will encounter a response with either a 400, 404 or 422status code:

success
A boolean where a value of false means the object could not be updated.
status
  • 400 may indicate that the ID was not provided.
  • 404 means Product or Media could not be found by the IDs provided.
  • 422 means the Media item could not be updated due to errors in the data.
context
  • parameters means the error is with the required id URL parameter.
  • data indicates an error within the Media object data.
errors

Contains an array of error objects, each will have the following properties:

  • name - The property name that encountered an error.
  • message - A human readable error message.
  • ref - An error reference string.