Skip to content

Instantly share code, notes, and snippets.

@alexandru-calinoiu
Last active January 29, 2022 05:04
Show Gist options
  • Save alexandru-calinoiu/451bb7cdaa1e67111ae7 to your computer and use it in GitHub Desktop.
Save alexandru-calinoiu/451bb7cdaa1e67111ae7 to your computer and use it in GitHub Desktop.
Send a CURL get request with an array param
This took me longer that I will like to find out
curl "http://localhost:3000/v1/collections/42/items?fields[]=synopsis" -v -H "Content-Type: application/json" -H "X-Session-Token: xxx" --globoff
@cyb3r-n3rd
Copy link

not working for me
i ave to send a get request through curl with array parameter with a name[0]=value1&name[1]=value2 how should i do it can u help

@valo-ur
Copy link

valo-ur commented Sep 14, 2021

Make sure you have url encoded '[' with %5B and ']' with %5D.
Your curl command should look something like this
curl -X GET "httpx://uri?name%5B0%5D=value1&name%5B1%5D=value2"

@MERLIN-Flotilla
Copy link

MERLIN-Flotilla commented Oct 20, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment