How to pass values dynamically in REST Endpoint

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:16 AM
Hi,
Does anybody have any idea how to pass values dynamically in REST endpoint. In below snapshot, in place of IP, i want a fucntionality that on clicking a button, it should automatically pass the IP address field of the record and parse the response.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:23 AM
Hi Chandresh,
Make the end-point as follows with a variable substitution and this should be for the HTTP method and not the end-point itself
http://adam.kahtava.com/services/whois.xml?query={ipAddress}
Create a variable substitution as follows:
Name - ipAddress
Test Value - ${ipAddress}
While you test use setStringParameter() to set the dynamic value
var ipAddress = ''; // any value you need here
var r = new RestMessage();
r.setStringParameter('ipAddress', ipAddress);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2019 09:19 PM
Do we need to add ${ipAddress} in both Content and Rest message function parameters or content is enough?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2019 10:19 PM
Hi Mallikharjuna,
you need to put ${ipAddress} in the content body where you want the ip address to be present
also you need to create variable substitution or rest message function parameter for that and in name use ${ipAddress}
Could you give link to your question in community since this is an old thread?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2019 11:02 PM
You can also use:
Recordless RESTMessageV2 example
You can just set the endpoint in the script rather than defining in the rest message.