Handline curl GET request with spaces

0

Here is the command i am using to get the data.

Tried using %20, + and also quotes. Nothing seems working.

curl -g -v -H "Authorization: "XXX" --request GET \
--url https://insights-api.clavistechnology.com/api/v2/search-term-results?filter\[online-store\]=amazon&\[search-term\]=250gb%20ssd \
--header 'accept: application/vnd.api+json' \
--header 'content-type: application/vnd.api+json' --globoff 

enclosing it quotes gives < HTTP/1.1 400 BAD_REQUEST

--url "https://insights-api.clavistechnology.com/api/v2/search-term-results?filter\[online-store\]=amazon&\[search-term\]=250gb ssd" \ 

Priya Sundaram

Posted 2018-11-12T19:30:20.340

Reputation: 1

Answers

1

I think you need a few more quotes, and to remove one quote. I got the following to give me a Not Authenticated message:

curl -g -v -H 'Authorization: XXX' \
  --url 'https://insights-api.clavistechnology.com/api/v2/search-term-results?filter[online-store]=amazon&[search-term]=250gb%20ssd' \
  --header 'accept: application/vnd.api+json' \
  --header 'content-type: application/vnd.api+json'

I replaced the double quotes with single quotes around Authorization: XXX, and removed the double quote in the middle. I single quoted the URL too.

Hope this helps.

Lewis M

Posted 2018-11-12T19:30:20.340

Reputation: 327

For future readers using Windows: given the \ to continue the command on the next line(s), I assume the question and answer are not for Windows. For Windows, for what I've heard, one might need double quotes for all quoted parameters. (But: I've not tested, as I'm not on Windows myself.)

– Arjan – 2018-11-12T21:01:11.280