Created
July 22, 2020 20:56
-
-
Save justin-lyon/9c2e5c849ef5b478806bc1f6e8dd118a to your computer and use it in GitHub Desktop.
Sample Axios Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const authBearer = `Authorization: Bearer ${token}` | |
const baseURL = 'https://my-domain.my.salesforce.com/services/data/v49.0/sobjects' | |
const contactsApi = axios.create({ | |
baseURL: `${baseURL}/contact`, | |
timeout: 1000, | |
headers: { authBearer } | |
}) | |
const contactId = '' | |
contactsApi.get(`/${contactId}?fields=FirstName,LastName,Email,Phone`) | |
.then(res => {}) | |
.catch(error => {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An example of an Axios instance using Salesforce REST API Contacts endpoint