The consumer key of the Connected App used to connect.
Closes the connection with the currently connected Salesforce org. Stored auth keys are expired and removed.
Retrieves the connection’s auth tokens from local storage.
An object containing the access and refresh tokens.
The URL of the connected Salesforce org.
Executes a custom REST API request to the specified endpoint.
Typically, every Salesforce REST API data endpoint must include the REST API version that is being requested. However, when calling the executeApiRequest
function you can either explicitly set the REST API version to call or simply use "vXX.X" to default to the REST API version set by the API.
For POST
/PATCH
requests, Content-Type
header is set to "application/json" by default and so data
parameter can simply be set to an object.
Note: depending on which REST API endpoint you attempt to request, you may need to add additional OAuth scopes to your Connected App.
A SalesforceRestApiResponse response object containing the status code and response data (if provided). The data is expected to be of the given generic type, but this is not enforced.
ConnectionError Thrown if the connection object is no longer valid, for example if the session has been disconnected.
ParameterError Thrown if invalid function parameter values are detected.
RestApiError Thrown if an error occurs calling the Salesforce REST API.
A type that defines the expected response data. A number of response types suitable for common requests are included for convenience, such as SalesforceRestApiSObjectBasicInfoResponse, SalesforceRestApiQueryResponse, SalesforceRestApiSearchResponse and more.
The relative Salesforce REST API endpoint being requested (e.g. /services/data/vXX.X/sobjects/Contact
).
Optional
httpMethod: HttpMethodThe HTTP Method to use when making the request (defaults to GET
).
Optional
data: anyOptional data to pass with the request (for POST
/PATCH
requests).
Optional
headers: anyOptional headers to include with the request. Important: do not attempt to set the Authorization
header manually as the API will include it automatically (as long as includeAuthorization
is not set to false
).
Optional
includeAuthorization: booleanWhether the Authorization
header will be added automatically. Set this to false
when making requests to endpoints that do not expect an Authorization
header, such as the OAuth endpoints.
Generated using TypeDoc
Defines a connection to a Salesforce org.