Create REQ via rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 03:38 AM
Hi,
A third party application needs to create REQ's in SN. This can be done via rest api but the information will be different every time they raise a request. For example, there are a few different catalog items that will be raised. Each one will have different data. So my questions are:
a) Will I need to provide them with a different url for each catalog item?
b) How will they know the sys_id's of each reference fields in some of the varaibles? Will I have to provide them with the sys_id of every possible value in a ref field?
Any help would be great
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 04:32 AM
Hi,
There are multiple ways of creating REQs in ServiceNow via REST API:
- Most basic one, use REST Service Catalog API, for example POST order_now method (documentation here). You will have to provide sys_id of catalog item and names of the variables. You can use display value for the reference fields.
- You may also use Import Set API. The difference to previous one is that here you will work with staging table. You have to create the table and the fields, write some transformation maps, maybe scripts. It gives you more control but requires more work and maintenance. In this case you give them whatever you like, as long as there is a mapping from staging table to REQ table.
- There is also Table API. It is basically the same as previous one, but older.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 08:58 AM
Thank you Cezary, I've been playing around with option 1 and seems to do the trick. The REQ creates a RITM which is great, is there a way I can access the RITM fields too in the JSON body? I can write to the variables of the item but there's a few fields on the RITM as well that need data in too
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 01:16 PM
I don't think so as these are separate records. I think the best would be to go for business rules on either RITM or REQ, depends on your use case.