Skip to content

Instantly share code, notes, and snippets.

@jessemlay
Created April 27, 2021 21:56
Show Gist options
  • Save jessemlay/f09ddbfd7fb2e1d7941b44018521962e to your computer and use it in GitHub Desktop.
Save jessemlay/f09ddbfd7fb2e1d7941b44018521962e to your computer and use it in GitHub Desktop.
const echoPostRequest = {
url: pm.environment.get('API_URL'),
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
userName: pm.environment.get('userName'),
passWord:pm.environment.get('passWord')
})
}
};
pm.sendRequest(echoPostRequest, function (err, res) {
console.log(err ? err : res.json());
if (err === null) {
console.log('Saving the token and expiry date')
var responseJson = res.json();
pm.environment.set('token', responseJson.token)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment