How to retrieve the REST web service endpoint details through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2016 12:08 AM
Dear All,
I would like to know about how to retrieve the REST web service endpoint details through script?
Suppose, the endpoint is set as https://XXXXX.service-now.com/api/now/v1/table/incident?sysparm_query=active%3Dtrue%5Epriority%3D1&s...
I want to retrieve the endpoint information from the web service and modify it.
Can anyone please help me out?
Thanks in advance,
Subhankar
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2016 12:57 AM
Hi Subhankar,
Not sure what your use case is but the REST Endpoint can be set like so:
SOAPMessageV2 - setEndpoint(String endpoint)
How/if the current REST endpoint could be determined might depend on how the outbound REST was implemented.
Best Regards
Tony
Subhankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2016 01:46 AM
Dear Tony,
Thank you for the response.
I am aware of how to set endpoint.
I want to know if there is any way to retrieve the already set endpoint..something equivalent to getEndpoint.
e.g. I want to change the table name of the already configured endpoint from script multiple times. So, I want to retrieve the configured endpoint, modify and reset.
Thanks,
Subhankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 02:10 PM
As I understand you need to get the endpoint within your script. One way is access that using GlideRecord api.
Rest message details are stored in a table called 'sys_rest_message'. you can query your end point using 'name' or 'sys_id' then get the end point using 'rest_endpoint'.
var gr = new GlideRecord('sys_rest_message');
gr.addQuery('name','Google Cloud Messaging Send');
gr.query();
gr.next();
gs.log(gr.getValue('rest_endpoint'));
rest method details are stored in sys_rest_message_fn table. Similarly you can take values of that table too.