3

Issue

Unable to get update price via REST API due to white space in the sku

Steps to reproduce the issue

  1. Create a product with SKU containing white space, eg. 'BAH SB'
  2. Query Magento instance via REST API /rest/V1/products/BAH SB
  3. Observe response

I tried URL Encoding:

/rest/V1/products/BAH%20SB

/rest/V1/products/BAH+SB

but didn't work.

Any Help?

2
  • Try like that "/rest/V1/products/BAH SB"
    – Jay Parmar
    Commented May 25, 2021 at 3:04
  • 1
    @JayParmar Thank you for your comment. Syntactically, a URI must not contain a literal space and it must be encoded.
    – User-15895
    Commented May 25, 2021 at 14:21

1 Answer 1

1

Accoding to the endpoint documentation (https://magento.redoc.ly/2.3.7-admin/tag/products), you are supposed to make a POST call to the endpoint URL /rest/default/V1/products and the payload can look something like this:

{
 "product": {
     "sku": "BAH SB",
     "price": 999
 }
}

There is no query parameter that you need to add to the endpoint URL.

good luck!

2
  • Thank you for your suggestion. I tested but unfortunately it not working in the case of white space in a SKU.
    – User-15895
    Commented May 25, 2021 at 14:35
  • that's really weird, i just tested this before answering and it was working properly. but tell me, what errors do you get in the response?
    – Diana
    Commented May 26, 2021 at 5: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.