venkateshchalla
Kilo Contributor

Here is an example to create incident using Request module in NodeJS



var request = require('request');



var options = {


      url: 'https://[MY INSTANCE].service-now.com/api/now/table/incident',


      method: 'POST',


      headers: {"Accept":"application/json","Content-Type":"application/json","Authorization": ("Basic " + new Buffer("[USERNAME]:[PASSWORD]").toString('base64'))},


      json: true,


      body: {'short_description':'Creating incident through Request','assignment_group':'287ebd7da9fe198100f92cc8d1d2154e','urgency':'3','impact':'3'}


};



function callback(error, response, body) {


   


  if (error) {


      console.log(error);


  } else{


          console.log(body);


  }


}



request(options,callback);