Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Send REST Requests with cURL
cURL is pre-installed on many Linux and macOS systems. Windows users can download a version at curl.haxx.se/. When using HTTPS on Windows, ensure that your system meets the cURL requirements for SSL.
Attaching Request Bodies
Many examples include request bodies—JSON or XML files that contain data for the request. When using cURL, save these files to your local system and attach them to the request using the —data-binary or -d option.
This example attaches the new-account.json file.
1curl https://MyDomainName.my.salesforce.com/services/data/v/sobjects/Account/ -H "Authorization: Bearer access-token" -H “Content-Type: application/json” —data-binary @new-account.json -X POSTHandling Exclamation Marks in Access Tokens
When you run cURL examples, you can get an error on macOS and Linux systems due to the presence of the exclamation mark (!) special character in OAuth access tokens. To avoid getting this error, either escape the exclamation mark or use single quotes.
To escape the exclamation mark in the access token, insert a backslash before it (\!) when the access token is enclosed within double quotes. For example, the access token string in this cURL command has the exclamation mark (!) escaped.
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/ -H "Authorization: Bearer 00D50000000IehZ\!AQcAQH0dMHZfz972Szmpkb58urFRkgeBGsxL_QJWwYMfAbUeeG7c1E6LYUfiDUkWe6H34r1AAwOR8B8fLEz6n04NPGRrq0FM"Or, you can enclose the access token within single quotes.
1curl https://MyDomainName.my.salesforce.com/services/data/v/ -H 'Authorization: Bearer 00D50000000IehZ!AQcAQH0dMHZfz972Szmpkb58urFRkgeBGsxL_QJWwYMfAbUeeG7c1E6LYUfiDUkWe6H34r1AAwOR8B8fLEz6n04NPGRrq0FM'