REST/Table API-Session Reuse for multiple request

bhavnagyanchand
Kilo Explorer

I am using REST/Table API for ServiceNow.

To process multiple requests , I am sending request to servicenow endpoint in a for each Loop.

I had a query here : In servicenow, for multiple requests, is the session maintained?

or Is there a provision using which   I can Reuse the connection with ServiceNow for multiple requests ?

14 REPLIES 14

Chuck Tomasi
Tera Patron

Hi Bhavna,



Can you help me understand what the goal is here?



If it's a simple question about sessions, then as far as I know, it's a new session each time and authentication needs to be passed. I can double check with our developers to see if the session header token thingy (often visible in the REST API Explorer) has any impact on that.


Hi Chuck,



I ask me the same question than Bhavna.



We can see on the wiki/docs : "REST supports cookies for binding to the existing session.".


(Fuji : http://wiki.servicenow.com/index.php?title=REST_API#gsc.tab=0)


(Geneva : https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/concept/c_...)


(Helsinki : https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/integrate/inbound-rest/concept/...)



Unfortunately, we don't have more information and/or example to use coockies in REST API.



Simple example :


We have two instances, Dev1 and Dev2.


Case 1 : From Dev1, we use the REST API to contact Dev2. We want load an incident and a problem. So wemake a REST API to load the incident and we want to used the cookies session to load the problem. Theorically it's possible...


Case 2 : From Dev1, we use the REST API to contact himself to load all active incident in JSON format. We want to used the token session because we are connected to the instance. Theorically it's possible...



Thanks for your time


Regards,


Florian.


Hi Florian,



Using the REST API this way is beyond what I've done so far. You might want to reach out to support to see what they have to say.



HI Service Portal - ServiceNow


Contact Support | ServiceNow


tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi Bhavna,


Might OAuth suit your needs?



Enable OAuth with inbound REST


Using OAuth, you can pass a user ID and password once, and then use a token for subsequent REST requests instead of submitting credentials with each request.



Best Regards


Tony