Skip to content

Instantly share code, notes, and snippets.

@achesco
Last active December 6, 2019 15:22
Show Gist options
  • Save achesco/78a0c8bc413635728b06c728e40429fd to your computer and use it in GitHub Desktop.
Save achesco/78a0c8bc413635728b06c728e40429fd to your computer and use it in GitHub Desktop.
Curl requests
# POST request with cookies
curl \
--cookie "authId=12345" \
-X POST \
-d '{"payload":"DATA"}' \
-H "Content-Type: application/json" \
-k https://localhost:8080/
# Call senecajs action with POST request
curl \
-X POST \
-d '{"role":"serviceRole","cmd":"commandName"}' \
-k https://localhost:8080/act
# Call senecajs action with GET request
curl -k https://localhost:8080/act?role=serviceRole&cmd=commandName
# Request using p12 client certificate
curl \
--cert-type P12 \
--cert /path/to/client.cert.p12:ClientCertPassword \
https://cert-protected-host/api
# Request using client certificate + key
curl \
--cacert /path/to/ca.pem \
--key /path/to/client-key.pem \
--cert /path/to/client-cert.pem \
https://api-host/api/v1/
# and ... wget
wget -qO- --no-check-certificate --header 'Content-Type: application/json' --post-data='{"foo":"bar"}' https://api-host/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment