ServiceNow REST
Comprehensive wrapper for the ServiceNow REST API's
Promise based
Contact abey@elucent.io for any questions, feedback, issues, or feature requests.
Update 5/29/2016: Major revisions to GlideRecord and Attachment API Update 1/27/2016: Added clone method to GlideRecord
Update 1/26/2016: v1 Release
Update 1/21/2016: GlideRecord is fully functional Built out skeleton of other REST APIs
Table of contents
- GlideRecord
- query
- get
- insert
- update
- clone
- delete
- GlideAggregate
- query
- ImportSet
- get
- insert
- Attachment(Geneva)
- get
- getAttachment
- getAttachments
- attachFile
- About Promises
- Questions and Issues
- Authors
Install
npm install servicenow-rest
GlideRecord
var GlideRecord = gliderecord; var gr = 'instance''tablename''user''password''v1'
Version is optional
query
//methods optionsgr;gr;gr; gr
get
gr //errors)
insert
var obj = short_description:"Production Server down" description:"latin words here" priority:1;gr //errors)
update
var obj = comment:"hey whats up"gr //errors)
clone
//two parameters//sysid of record you want to clone//array fields that you want to clonevar arr1 = 'short_description''description'gr
addProxy
If proxy requires credentials they need to be embedded in the URL
gr;
delete
gr //errors)
GlideAggregate
var GlideAggregate = glideaggregate;
query
grgr //agg options: MIN,MAX,SUM,AVGgrgr // Aggregate,fieldname,operator,valuegr //integergr // Automatically sorts by ascending gr
ImportSet
Create records on import set tables that are immediately transformed
var ImportSet = importset; var gr = 'instance''tablename''user''password' //tablename should be the import table here
get
gr.get(sysid).then(function(value) { console.log(value); }
insert
gr.get(
Attachment
var Attachment = attachment; var gr = 'instance''tablename''user''password'
get
gr
delete
gr
getAttachment
gr
getAttachments
gr
attachFile
gr;
About Promises##
A promise is an alternative to callback hell. It's pretty simple
gr //This right here returns a 'promise' //resolve and reject are functions with one argument. When the request succeeds, the resolve function is called. When it fails, the reject function is called //alternativegr
Questions and Issues##
For feature requests and bug reports please use the github issue tracker. For immediate support join the ServiceNow Slack Community (get an auto-invite here: http://snowslack.io) or email abey@elucent.io
Authors##
Abey Ahmad. Contributors Welcome