Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
//authenticate to get access token
var authEndpoint = '' //provide API endpoint
var payload = {
client_id: "xxxxxx", //pass Client ID
client_secret: "xxxxxx", //pass Client Secret
grant_type: "client_credentials"
var url = authEndpoint + '/v2/token'
var contentType = 'application/json'
var accessTokenRequest = HTTP.Post(url, contentType, Stringify(payload));
if (accessTokenRequest.StatusCode == 200) {
var tokenResponse = Platform.Function.ParseJSON(accessTokenRequest.Response[0]);
var accessToken = tokenResponse.access_token
var rest_instance_url = tokenResponse.rest_instance_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment