Create REQ via rest api

User485076
Tera Contributor

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

3 REPLIES 3

Community Alums
Not applicable

Hi,

There are multiple ways of creating REQs in ServiceNow via REST API:

  1. 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.
  2. 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.
  3. There is also Table API. It is basically the same as previous one, but older.

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

Community Alums
Not applicable

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.