Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
Last active August 12, 2022 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-ramon/3bcdd02ec998bab6efba to your computer and use it in GitHub Desktop.
Save chris-ramon/3bcdd02ec998bab6efba to your computer and use it in GitHub Desktop.
curl notes
· curl
curl -G "https://api.github.com/search/repositories?page=1&per_page=6" --data-urlencode "sort=stars" --data-urlencode "order=desc" --data-urlencode "q=language:html" | jq ".items[0,1,2,3,4,5] | {name, description, html_url}"
# set headers
curl localhost:8080 --header "jwt: mycooltoken"
# display headers
curl localhost:8080 -v
# show output in new line
curl localhost:8080 ; echo
# post
curl -v -H "Content-Type: application/json" -d '{"a":"aa", "b":"bb"}' 127.0.0.1:3000/bar
curl -X POST -H "Content-Type: application/json" -d '{"a": {"b": "c"}}' localhost:4005/endpoint ; echo
# ok
curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer A015YQQV8oH1bejkvoJfQU9HNZqRJXs8Lg8K5sKu0nyUP2g' \
-d '{
"intent":"sale",
"redirect_urls":{
"return_url":"http://example.com/your_redirect_url.html",
"cancel_url":"http://example.com/your_cancel_url.html"
},
# post
curl -X POST https://endpoint.com \
-d a=c \
-d f=b \
-d c=a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment