Incident REST detailed documentation

patricktownsend
Kilo Explorer

Hello, I am developing a custom client implementation that will create new incidents in ServiceNow using the REST interface. I am looking for detailed documentation on the fields that can be passed in the payload. I've used the on-line REST API tester interface. I can see that there are many fields that are supported in the request payload, but I need some detailed documentation on these fields that includes a full list of the available fields. Is there a full PDF or on-line reference for the Incident REST interface? Thanks.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Patrick,



This is your own personal developer instance? And you're logging in as admin? Or are you logging in to a client instance with limited access?



There are a couple of ways you can handle what you want to do. If the IBM system can send an email, you can send an email to the servicenow instance, and you can script an inbound action to create whatever type of record you want. Problem is a different table/process, but you can very well create a Problem record as opposed to an Incident; it really depends on the internal process and how you want to handle the incoming record.



The second option (and third) would be to use the REST API in servicenow; a)   the table API which already exists or b) write a scripted rest api to handle the incoming REST request and create the record that way.



Email is probably the easiest/quickest, depending on if you require additional scripting to create anything the than an incident. Otherwise, if you just send an email to your instance, the default inbound email action will create an Incident.



Hopefully that clarifies a couple of things for you, let me know if you need any other assistance!



Cheers,



Tim


View solution in original post

14 REPLIES 14

Community Alums
Not applicable

Just found out about this from another developer; you can get a raw JSON output of a record from your instance by passing the 'JSONv2' (or 'XML' if that's your thing) parameter to the query URL:



https://instance.service-now.com/incident_list.do?sysparm_query=active%3Dtrue%5Enumber%3DINC00100001...



This way you can then see, in JSON/XML format what you could essentially use in the POST payload to create a record. You're probably past this at this point, but it might be helpful nonetheless.



Cheers,



Tim


Thanks Tim! This is exactly what I was looking for. Will give it a try.


Patrick


Hi Tim,



Your suggestion on listing the fields worked really well, many thanks for that!



I am trying to understand which HTTP headers are required for creating an incident. In the API tester it appears that the Accept, Content-Type, and X-UserToken HTTP headers are required. But there is also a discussion about the Authorization header. Do you know if both Authorization and X-UserToken headers are required? And if the X-UserToken header is required, where does the user token come from? I searched my account information and am not finding the token.



Thanks for your help again,


Patrick


Community Alums
Not applicable

Patrick,



This might help:



X-UserToken




When I have done this, I either use Basic auth (setup a service account on the instance with only the access it needs), or setup oAuth on the SN instance and use that. It depends on your use case. If the IBM side is not accessible by the end user (i.e right click and view source to see the JS code), then Basic auth should work just fine. If you need to hide the username/password, you may need to go the route if setting up an oAuth service to handle the authentication.



Are you able to share any of the code you're using to access the SN API?



Cheers,


Tim


Hi Tim,



Thanks, your comments and the link were perfect. I will use the Authorization format of base64 encoded user:password.



The code is written in C for an IBM Enterprise server and bound to TLS libraries. I imagine not of much use to anyone else. I am exploring options, but I imagine that our solution will end up in the ServiceNow store in the not to distant future.



Again, thanks for your help.


Patrick