When I am using content type="application/json",I cant passing any parameters and also returns
"message": "Decoding error."
When I am using content type="application/x-www-form-urlencoded",I cant passing any parameters and also returns
"message": "Server cannot understand Content-Type HTTP header media type application/x-www-form-urlencoded"
Best Answer
Creating and using rest api in magento 2 is very easy but for that you need some startup example.Magento 2 uses token based rest api.First you need to authenticate user and get the token from magento 2.After getting token you have to pass this token to every request you performed.For example to get product details by SKU you need to first authenticate user and get token now pass this token to your header to call web service /V1/products/:sku
Here I have created example for get product by SKU using magento 2 rest api.Here is list of API that supported by magento 2. LIST OF Methods REST API MAGENTO 2
Below Example please follow
Magento 2 REST API Authentication