cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3 Image POST method giving Decoding Error

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Magento 2.3 Image POST method giving Decoding Error

In Magento 2.3 or 2.2 while using POST Method with Python 3 and above it is not working 

 

rest/V1/products/sku/media

 

In response I always get {'message': 'Decoding error.'} with 400 status 

 

Tried with Binary data as well as URL for the image nothing working out 

Any Solution Please ?

1 REPLY 1

Re: Magento 2.3 Image POST method giving Decoding Error

Because nobody replied to this issue yet and it took me quite some time to find the solution, I thought I would reply to this message for other people who are facing the same.

 

For me, the issue was solved by adding UTF-8 encoding to my body.

I am sending the post request from my java code and in my case, I had to add the following:

RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters() .add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));