Skip to content

Instantly share code, notes, and snippets.

@srichakradhar
Created March 2, 2018 04:33
Show Gist options
  • Save srichakradhar/13a13fcb63a6e91ab01c769cb2e8a87c to your computer and use it in GitHub Desktop.
Save srichakradhar/13a13fcb63a6e91ab01c769cb2e8a87c to your computer and use it in GitHub Desktop.
create servicenow incident in node js
axios.post('https://dev32043.service-now.com/api/now/table/incident',
requestBody,
{
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic ' + Buffer.from('admin'+':'+'ynZVT7Uwa5gW').toString('base64'),
// 'Authorization': 'Basic '+btoa('admin'+':'+'admin'),
}
})
.then(function (response) {
console.log(response.data.result);
incident_number = response.data.result.number;
session.endDialog("Here you go! " + response.status + ' ' + response.statusText
+ '\n' + response.data.result.number);
})
.catch(function (error) {
console.log("===========********========= ERROR ===========********=========", error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment