Postman API Calls

Hello @npilley,

Welcome to the Sailpoint Developer Community!

If you are using the latest official postman collections you’ll want to make sure the following information is in place.

Check that the collection environment variables are set correctly. Click on the collection name IdentityNow V3 APIs that you have forked and verify that the domain and baseUrl are set on the Variables Tab.

Next, verify that you have the Authorization tab using the environment variable accessToken for authenticating to our APIs.

On the Pre-request Script tab verify that you have the latest script for retrieving and storing your accessToken.

const domain = pm.environment.get('domain') ? pm.environment.get('domain') : pm.collectionVariables.get('domain')
const tokenUrl = 'https://' + pm.environment.get('tenant') + '.api.' + domain + '.com/oauth/token';
const clientId = pm.environment.get('clientId');
const clientSecret = pm.environment.get('clientSecret');

const getTokenRequest = {
    method: 'POST',
    url: tokenUrl,
    body: {
        mode: 'formdata',
        formdata: [{
                key: 'grant_type',
                value: 'client_credentials'
            },
            {
                key: 'client_id',
                value: clientId
            },
            {
                key: 'client_secret',
                value: clientSecret
            }
        ]
    }
};


var moment = require('moment');
if (!pm.environment.has('tokenExpTime')) {
    pm.environment.set('tokenExpTime', moment());
}


if (moment(pm.environment.get('tokenExpTime')) <= moment()) {
    var time = moment();
    time.add(12, 'hours');
    pm.environment.set('tokenExpTime', time);
    pm.sendRequest(getTokenRequest, (err, response) => {
        const jsonResponse = response.json();
        const newAccessToken = jsonResponse.access_token;
        pm.environment.set('accessToken', newAccessToken);
    });

}

Finally, you will need an environment like the one you have included in your post with only the following values.

Environment Variable Required Description
tenant * This is your IdentityNow tenant, typically your company’s name.
clientId * This is the client ID for the API client or personal access token.
clientSecret * This is the client secret for the API client or personal access token.
domain This field is optional and is only needed for a select few who may have a domain in their API URL that differs from “identitynow”.

Please let us know if you still experience issues!

2 Likes