# GET resource with basic authentication
curl -u shaun:admin http://localhost/webservice/escenic/content/151
# For header -I, for vervosity -v
curl -I -v -u shaun:admin http://localhost/webservice/escenic/content/151
# Write response to a file
curl -u shaun:admin http://localhost/webservice/escenic/content/151 -o /tmp/out.xml
# Formatting xml
sudo apt install libxml2-utils
curl -u shaun:admin http://localhost/webservice/escenic/content/151 | xmllint --format -
# With headers, multiple headers needs to be in multiple -H option
curl -u shaun:admin -H 'Accept: application/xml' http://localhost/webservice/escenic/content/151
#PUT example
curl -X PUT -H 'Content-Type:application/atom+xml; type=entry' -H 'If-Match:*' -u shaun:admin http://localhost/remote/webservice/escenic/content/151 -d @post-151-with-permission.xml
# write formatted json to file
curl api.example.com | jq '.' > call.txt
#write formatted xml to file
curl api.example.com | xmllint --format --output formatted.xml -
# $ man xargs
# -P maxprocs
Parallel mode: run at most maxprocs invocations of utility at once.
# -n number
Set the maximum number of arguments taken from standard input for
each invocation of utility. An invocation of utility will use less
than number standard input arguments if the number of bytes
accumulated (see the -s option) exceeds the specified size or there
are fewer than number arguments remaining for the last invocation of
utility. The current default value for number is 5000.
# Send 200 request in parallel
seq 1 200 | xargs -n1 -P10 curl -H "Authorization: Bearer eyJ0eXAiOkBKg" http://localhost/user/me