0

I'm trying a PUT on Magento 2 REST API through Postman like this:

https://domain/rest/V1/products/IP_X

With only a price change on the JSON content.

I'm getting the following error message:

{
    "message": "\"%fieldName\" is required. Enter and try again.",
    "parameters": {
        "fieldName": "product"
    }
}

The REST API spec indicates the URL to be PUT /V1/products/:sku and the JSON should include only the parameter to change.

Any idea?

2
  • 1
    I found the answer, the json content should be like this: { "product": { "price": "500.55" } }
    – A Zuniga
    Aug 8, 2019 at 12:59
  • @GeneralGrievance I added the community wiki answer. Thank you. Sep 23, 2023 at 13:04

2 Answers 2

0

your data is in json format. Removed json_encode from there it will resolve this issue.

1
  • Hi Anas, the "Content-Type" needs to be "application/json", the problem was that I was doing a bad content package. Here it is how it worked: { "product": { "price": "500.55" } } Tx for your help!
    – A Zuniga
    Aug 8, 2019 at 13:01
0

From A Zuniga's comment, the json content should be like this:

{ "product": { "price": "500.55" } } 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.