cancel
Showing results for 
Search instead for 
Did you mean: 

Server can not understand Content-Type HTTP header media type "application/x-www-form-urlencoded

Server can not understand Content-Type HTTP header media type "application/x-www-form-urlencoded

I am a Ruby on Rails developer. I am trying to integrate Magento rest api in my application.

 

I have generated AccessToken and OauthTokenSecret successfully using ConsumerKey and ConsumerSecret ( via oauth authentication ).

 

After doing all this I am able to send GET requests successfully to access orders, products, stock-items etc.

 

But i am getting following error on sending PUT request to update "StockItems" for a product:

"{\"messages\":{\"error\":[{\"code\":400,\"message\":\"Server can not understand Content-Type HTTP header media type \\\"application\\/x-www-form-urlencoded\\\"\"}]}}"

 

Following is the request i am sending:

Request: PUT "http://www.groovepacker.com/store/api/rest/stockitems/3"

Parameters: "qty=999"

Note: Also provided Authorization header for oauth authentication

 

It seems like PUT string is not encoded properly. Can anyone please suggest me the right way to overcome this issue.

 

Thanks in advance.

2 REPLIES

Re: Server can not understand Content-Type HTTP header media type "application/x-www-form-urlen

Hello,

 

I am facing the same problem when trying to call a Magento api in Laravel.

 

Did you found a solution for your problem?

 

Regards.

Re: Server can not understand Content-Type HTTP header media type "application/x-www-form-urlen

Hello, I am facing the same problem when trying to call a Magento api in Laravel. Did you found a solution for your problem? Regards.