Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl -h or curl --header not working

Tags:

curl

api

box-api

i'm trying to connect ti a web api service, box-api, and following the tutorial i have to type this command to fetch a folder in the user content:

 curl https://api.box.com/2.0/folders/FOLDER_ID/items?limit=2&offset=0 -H "Authorization: Bearer ACCESS_TOKEN"

I tryied to connect from the command line to test the command but it keep complaining about the -H or the --header command saying that it doesn exist:

 -bash: -H: command not found
 -bash: --header: command not found

but when i type curl --help the command is in the manual:

 -H, --header LINE   Custom header to pass to server (H)

I'm confused, what should i do to connect to this site and get the JSON content? Thanks

like image 206
softwareplay Avatar asked Dec 11 '22 08:12

softwareplay


1 Answers

Your url has & sign. and this is making end of command on there(and running at background). You can remove this error by using quotes around. Like this

curl "https://api.box.com/2.0/folders/FOLDER_ID/items?limit=2&offset=0" -H "Authorization: Bearer ACCESS_TOKEN"

Hope this helps.

like image 158
Sabuj Hassan Avatar answered Jan 04 '23 08:01

Sabuj Hassan