devdocs
devdocs copied to clipboard
Explain how to upload images to configurable product
General issue
The tutorial example shows how to create a configurable product, but does not show how to upload images to it as well.
Description:
How can we upload the product images with the bulk API?
Related question on magento stack exchange. https://magento.stackexchange.com/questions/310766/import-update-create-products-in-bulk-with-async-api-with-product-images-and
@LiamKarlMitchell
We need a topic that discusses creating products in detail. The configurable products tutorial is a start, but's it's lacking details about things like the media gallery, product links, stock items, etc. I've shied away from media gallery in particular, because converting an image to base64 makes any sample too long to read. In the real world, you'd call some method that converts an image to base64 on the fly.
I've been able to add an image to an existing product with the POST V1/products/:sku/media endpoint with a payload similar to this:
{
"entry": {
"media_type": "image",
"label": "watch",
"position": 1,
"disabled": false,
"types": [
"image", "small_image"
],
"content": {
"base64_encoded_data": "enormous-block-of-text",
"type": "image/jpeg",
"name": "watch.jpeg"
}
}
}
I don't think there would be any fundamental difference if you added images in bulk.
You can review this functional test to get other ideas on how to add media gallery items.
I'd like to ask you to rewrite the description of this issue, requesting that we fully document how to create simple and download products. (Or maybe close this PR and open a new one.)
@keharper just adding a note that this is an Issue, not Pull Request.