Testing with curl
GET a resource
Print response headers with -i while learning.
curl -i https://httpbin.org/get
POST JSON
Send a body with -d and set Content-Type.
curl -i https://httpbin.org/post \
-H "Content-Type: application/json" \
-d '{"title":"Practical APIs"}'
Add auth headers
Pass Bearer tokens or API keys the same way your app will.
curl -i https://api.example.com/v1/books \
-H "Authorization: Bearer TOKEN"
Helpful flags
-X PATCHto set the method-o fileto save the body-vfor a verbose trace--failto exit non-zero on HTTP errors
Comments
One comment per signed-in account. Comments are saved with this page’s URL.