Newer Version Available
Using cURL in the REST Examples
The examples in this guide use the cURL tool to send HTTP requests to access, create, and manipulate REST resources on the Lightning Platform. cURL is pre-installed on many Linux and Mac 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.
- Escaping the Session ID or Using Single Quotes on Mac and Linux Systems
- When running the cURL examples for the REST resources, you may
get an error on Mac and Linux systems due to the presence of the exclamation
mark special character in the session ID argument. To avoid getting
this error, do one of the following:
- Escape the exclamation mark (!) special character in the session
ID by inserting a backslash before it (\!) when the session ID is
enclosed within double quotes. For example, the session ID string
in this cURL command has the exclamation mark (!) escaped:
1curl https://instance_name.salesforce.com/services/data/v46.0/ 2-H "Authorization: Bearer 00D50000000IehZ\!AQcAQH0dMHZfz972Szmpkb58urFRkgeBGsxL_QJWwYMfAbUeeG7c1E6 3LYUfiDUkWe6H34r1AAwOR8B8fLEz6n04NPGRrq0FM" - Enclose the session ID within single quotes. For example:
1curl https://instance_name.salesforce.com/services/data/v46.0/ 2-H 'Authorization: Bearer sessionID'
- Escape the exclamation mark (!) special character in the session
ID by inserting a backslash before it (\!) when the session ID is
enclosed within double quotes. For example, the session ID string
in this cURL command has the exclamation mark (!) escaped: