Purpose: add an image to a product group, as a file upload or by URL. The image is stored straight away, and download problems are reported in the response.
As an alternative you can send image URLs in the product itself; see the Images topic for both options and for the image requirements.
Required fields (multipart form)
| Field | Expected value |
|---|---|
parent |
The parent of the product group, exactly as you sent it with the product. The product must exist. |
attribute |
The image attribute: image_default (main image) or image_1, image_2, …. |
file or url |
Either the image file, or a public URL of the image. Send exactly one of the two. |
Example
curl -X POST https://content.winkelstraat.nl/api/rest/v1/retailer/media-files \
-H "Authorization: Bearer <access_token>" \
-F "parent=TSHIRT-001-BLACK" \
-F "attribute=image_default" \
-F "url=https://cdn.example.com/products/tshirt-001-black-front.jpg"
POST
/api/rest/v1/retailer/media-files
curl \
--request POST 'https://content.winkelstraat.nl/api/rest/v1/retailer/media-files' \
--header "Authorization: $API_KEY"
Response examples (401)
{
"code": 401,
"message": "The access token provided is invalid."
}
Response examples (401)
{
"code": 42,
"message": "string"
}
Response examples (403)
{
"code": 403,
"message": "Access forbidden. You are not allowed to list products."
}
Response examples (403)
{
"code": 42,
"message": "string"
}
Response examples (415)
{
"code": 415,
"message": "\"xxx\" in \"Content-Type\" header is not valid. Only \"multipart/form-data\" is allowed."
}
Response examples (415)
{
"code": 42,
"message": "string"
}
Response examples (422)
{
"code": 422,
"message": "Failed to download 'https://cdn.example.com/products/missing.jpg': Client error: `GET https://cdn.example.com/products/missing.jpg` resulted in a `404 Not Found` response"
}
Response examples (422)
{
"code": 42,
"message": "string"
}