Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Created July 22, 2020 20:56
Show Gist options
  • Save justin-lyon/9c2e5c849ef5b478806bc1f6e8dd118a to your computer and use it in GitHub Desktop.
Save justin-lyon/9c2e5c849ef5b478806bc1f6e8dd118a to your computer and use it in GitHub Desktop.
Sample Axios Config
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 => {})
@justin-lyon
Copy link
Author

An example of an Axios instance using Salesforce REST API Contacts endpoint

@jamessimone
Copy link

Nice, nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment