Send a request with Basic Auth
Send an HTTP request with a username and password (Basic Authentication).
curl -s -u user:password https://api.example.com/endpoint | jq .
- tool
- curl21 commands
More curl commands
-
curl -so /dev/null -w '%{http_code}' https://example.comPrint just the response status code. Handy in scripts.
-
curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' -d '{"name":"foo"}'Send a JSON payload in a POST request.
-
curl -H 'Authorization: Bearer $TOKEN' https://api.example.com/meSend a JWT or Bearer token in the Authorization header.
-
curl -Lv --max-redirs 5 https://example.comFollow up to 5 redirects and show every request and response in detail.
-
curl -sSL -o /tmp/result.json https://api.example.com/dataDownload quietly and follow redirects, but still show errors.