How to pass --url-query to curl
This is a nice way how to multiline query parameters when using curl.
This is a nice way to pass multiline query parameters when using curl.
The --url-query flag (available in curl 7.87+) lets you add query parameters individually, making long URLs much more readable. Each parameter is automatically URL-encoded and appended to the request URL.
1
2
3
4
5
6
7
8
curl "https://example.cloud/drms/whatever/rest/deployrequests" \
--url-query "deployFromDate=10.06.2023" \
--url-query "deployToDate=10.06.2024" \
--url-query "showStates=Defined,Locked,Failed,Confirmed,Succeeded" \
-H "Authorization: Bearer ..." \
-H 'Referer: https://.../history' \
-H 'Accept: application/json, text/plain, */*' | jq
This post is licensed under CC BY 4.0 by the author.