curl -v www.example.com
curl --header "X-Signature: XXX" http://example.com/endpoint
curl -H "X-Signature: XXX" -H "Content-Type: application/json http://example.com/endpoint
curl -X DELETE example.com
curl --insecure https://example.com
curl -H "Content-Type: application/json" -X POST -d '{"field1":"val1","field2":"val2"}' http://localhost:3000/api/test
When:
<form method="POST" action="page.cgi">
<input type=text name="field1">
<input type=submit name="Submit" value="OK">
</form>
Then:
curl --data "field1=somevalue&Submit=OK" http://www.example.com/page.cgi
or
curl --data-urlencode "field1=value with spaces" http://www.example.com/page.cgi
When:
<form method="POST" enctype='multipart/form-data' action="upload.cgi">
<input type=file name=upload>
<input type=submit name="Submit" value="OK">
</form>
Then:
curl --form upload=@localfilename --form Submit=OK http://www.example.com/upload.cgi
curl -u username:password URL
curl -u ftpuser:ftppass -O ftp://ftpserver/file.zip
curl -u ftpuser:ftppass -T myfile.txt ftp://ftp.testserver.com
For Salesforce you must first register a connected app. Append the security token to the password.
curl -X POST 'https://test.salesforce.com/services/oauth2/token?grant_type=password&username=<ACCOUNT USERNAME>&password=<ACCOUNT PASSWORD><SECURITY TOKEN>&client_id=<CLIENT ID>&client_secret=<SECRET>'
Response:
{
"access_token":"TOKENVALUE",
"instance_url":"https://url.com",
"id":"https://test.salesforce.com/id/xxxxxxxx/xxxxxxxxx",
"token_type":"Bearer",
"issued_at":"1477526642560",
"signature":"nrFRBW0zTYxxxmP0cFAmA3Mo3rlxxxxqeAupBGGeRXuAn0="
}
curl -H 'Authorization: Bearer <TOKEN>' -H 'content-length: 0' -X POST 'instance_url/resource'
curl -L http://www.google.com
curl --limit-rate 1000B -O http://www.example.com/file