Skip to content

Instantly share code, notes, and snippets.

@mlsaito mlsaito/curl_sheetsheet.md
Last active Jun 18, 2018

Embed
What would you like to do?
cURL Cheatsheet

cURL with Basic Authorization:

$ cURL -X POST -H "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l" https://localhost:3000

cURL with username and password (pretty much same with Basic Auth):

$ curl -X POST -H "Content-Type: application/json" \
     --user "usernameorclient_id:passwordorclient_secret" \
     -d '{"grant_type": "client_credentials", "scope": "public"}' \

cURL with URL-encoded data:

$ cURL -X POST -d "api_key=JfdkamjTu" "secret_key=NotSoSecret" https://localhost:80

cURL with JSON data:

$ cURL -X POST -H "Content-Type: application/json" -data '{"username":"xyz","password":"xyz"}' https://localhost:3000/api/login

cURL to upload image file:

$ curl -X POST -F "image=@/yourPath/yourImageFile.jpg" https://localhost:3000/image_recognize

cURL on https localhost but with invalid cert:

$ cURL --insecure https://localhost:3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.