How to get integration URL in script include.

Abhijit Das7
Tera Expert

Hi Everyone,

 

I have created a custom Scripted REST API. I am sending a data to post in incident using postman, where I get the payload in form of JSON and which I send from scripted REST API to script include. I am able to get payload, but I am not able to get the integration URL which is coming from postman. 

 

I want this integration URL because when we will send data from backend then it will have some parameters in integration URL, which I will be using in script include. 

 

Can anyone suggest how can I get integration URL?

 

Thanks in advance

1 ACCEPTED SOLUTION

Robert H
Mega Sage

Hello @Abhijit Das7 ,

 

You can use request.queryString to get the full URL query.

You can also use request.queryParams to check for individual parameters.

 

RobertH_0-1745817996647.png

 

Example:

Sent the following request:

POST https://xxx.service-now.com/api/yyy/my_rest_api/post_example?my_special_parameter=123&sent_by_team=N...

 

Result:

RobertH_1-1745818071745.png

 

 

Regards,

Robert

 

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Abhijit Das7 

you won't get the URL in scripted REST API

the parameter you want should be passed in JSON request body itself since it's a POST method

Consider this scripted REST API is shared with 3 different external teams and each team can include a particular unique JSON key value pair in the JSON request body which you can access in script and you will know which external team is consuming this endpoint

Example

{

"requestFrom":"TeamA"

}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Robert H
Mega Sage

Hello @Abhijit Das7 ,

 

You can use request.queryString to get the full URL query.

You can also use request.queryParams to check for individual parameters.

 

RobertH_0-1745817996647.png

 

Example:

Sent the following request:

POST https://xxx.service-now.com/api/yyy/my_rest_api/post_example?my_special_parameter=123&sent_by_team=N...

 

Result:

RobertH_1-1745818071745.png

 

 

Regards,

Robert