Hello,
Magento Version : 2.3.0
I want to create product with multiple images using rest api, so please suggest me how can i implement ?
I am trying add multiple images of product through Magento2 Rest API but some only one image is getting added. I saw the documentation. Any help on this would be highly appreciated.
Thanks in advance
HI @psenthilpre6e4
You can try the below link.
https://devdocs.magento.com/swagger/index_23.html#/catalogProductRepositoryV1/catalogProductReposito...
In media gallery section you can set multiple images.
I hope it will help you!
REST API POST /V1/products has media_gallery_entries which is an array.
You can provide multiple images, like the below example.
$request['media_gallery_entries'] = [
[
'id' => 1,
'media_type' => 'image',
'label' => 'tiny1_new_label',
'position' => 1,
'disabled' => false,
'types' => [],
'file' => '/t/i/' . $filename1,
],
[
'id' => 2,
'media_type' => 'image',
'label' => 'tiny1_new_label2',
'position' => 2,
'disabled' => false,
'types' => [],
'file' => '/t/i/' . $filename2,
],
];
API reference