Reputation: 135
I'm trying to look for a product with a specific SKU using this API call
/api/v2/products?sku=P99X-GO
and I get the error
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)")
I've tried putting the sku in single quotes and double quotes, but nothing works. I've tried encoding the hyphen to %2D -- that doesn't help.
Suggestions?
Upvotes: 0
Views: 43
Reputation: 2153
Your request URL and query parameter are correct, although you may want to look into updating your request to Oauth and the v3 products endpoint. However, your request URL is formatted correctly for Basic auth and the v2 products endpoint. :)
It looks like the error is coming from the way your script is handling the JSON response, which will come back as an array. You might find this helpful: https://stackoverflow.com/a/26300663/8521556
If that doesn't point you in the right direction, it would be good to see the code you're using the make the request and handle the response.
Upvotes: 1