Magento 2 - Construct a HTTP Post REST API

Magento do not support urlencoded requests.

Please specify content type: Add -H "Content-type: application/json" to curl command and send body as {"customerId": 1, "point":1 23}


I faced the same issue implementing a payment gateway. You need to define a way for Magento to deserialize url-encoded requests. Take a look to this repository. In more specific how Deserializer and Decoder works.

repo : https://github.com/ICEPAY/Magento-2

What you need :

https://github.com/ICEPAY/Magento-2/tree/master/Model/PostbackNotification https://github.com/ICEPAY/Magento-2/tree/master/Webapi/Rest/Request/Deserializer https://github.com/ICEPAY/Magento-2/blob/master/etc/di.xml

Similar issue : Magento 2 API: 3rd Party makes a post request to magento API with x-www-form-encoded data

Tags:

Rest

Api

Magento2