Created
March 2, 2018 04:33
-
-
Save srichakradhar/13a13fcb63a6e91ab01c769cb2e8a87c to your computer and use it in GitHub Desktop.
create servicenow incident in node js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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