Here is an api on my server:
https://server/api/v1/products?filter[name]=foo
this works well when I access it via browser, and it works well with the following two methods:
$ cat /tmp/x
{"filter": {"name": "foo"}}
$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : -H 'Content-Type: application/json' -d "@/tmp/x" https://server/api/v1/products
{"name": "foo", ...}
$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : -d "filter[name]=foo" https://server/api/v1/products
{"name": "foo", ...}
Now I'm trying to do it with:
$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : https://server/api/v1/products?filter[name]=foo
$ echo $?
3
it fails with error code 3, which stands for "URL malformed. The syntax was not correct."
How should I specify the query string parameters in the url?
The query string needs to be URL encoded so it has to look like this:
https://server/api/v1/products?filter%5Bname%5D=foo
asciitable.com.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With