I am trying to use the REST API to add a service request.

rdolan58
Kilo Explorer

Can you tell me what   tables I need to use.   I am assuming i need to add a record to the sc_request table then a record to the sc_req_item table?

I can add the request to the sc_request successfully but when I try to add the item to create the RIT record   in the sc_req_item table I get a 201 but no retuned data.

When I go back to look at the request ticked there is no RIT attached.   Can you tell me what I am doing wrong?

Thanks

5 REPLIES 5

guhann
Mega Guru

Ray,



Service Request has to be submitted with supported variable values as defined in relevant catalog item. It's not the case of an INC/PBM/CHG where records can be directly created in the respective tables. You may have to submit the service request via script. Please see this Service Catalog Script API - ServiceNow Wiki


Thanks for the quick reply




Sent by Outlook for Android


Jace Benson
Mega Sage

ServiceNow does not provide an easy way to do this as the Cart API is only exposed within the servicenow system.



However, recently my peers and I did work on something to allow this.   I just posted it to share, it's a single processor and script include to expose those parts feel free to try it out.   Here's a link to the share - ServiceCatalog Custom Rest Processor


Below are screenshots using Chrome's DHC Addon



Calling https://instance.service-now.com/service.do with GET


Headers required: Authorization: Basic (your auth token goes here)


service-1.png


Calling https://instance.service-now.com/service.do?sys_id=01205b180a0a0b3000b6efd641d24b75 with GET


This will get all the details of the item your want to request.


Headers required: Authorization: Basic (your auth token goes here)


service-2.png


Calling https://instance.service-now.com/service.do with POST


This will request the items you tell it in the array you pass.   There is no checking if the values you pass would pass client side.


Headers required: Authorization: Basic (your auth token goes here)


service-3.png


Try it out.   Maybe it'll meet your needs.


Thanks so much for the suggestion. I will take a look.