cancel
Showing results for 
Search instead for 
Did you mean: 

Upload multiple product images in REST Api

Upload multiple product images in REST Api

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 ?

 

Magento2 - Rest API -- Issue With Multiple Images Upload

 

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

2 REPLIES 2

Re: Upload multiple product images in REST Api

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!

Re: Upload multiple product images in REST Api

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 

https://devdocs.magento.com/swagger/index_23.html#/catalogProductRepositoryV1/catalogProductReposito...

 

Suman Kar(suman.jis@gmail.com) Magento Certified Developer Plus Skype: sumanphptech Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.