- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 03:57 AM
Hello- I have use rest call to get the count of records. I can see in REST API explorer that some of the parameters are available in SNOW rest call. But I want to pass the data of those parameter bases on user entry and pass dynamically to the rest call instead of hard coded.
Let me know how we can do that.
Suppose: I have created a REST Call called "Test Fuji" and It has end point define https://snow1.servicenow-com/api/now/stats/{tableName}
I want to use Get and pass the data of tableName dynamically through script and sysparm_query, count etc through query to get the data.
Please let me know how to do that.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 04:36 AM
It doesn't do the encoding automatically. You can do it using the ScopedGlideURI API call.
Scoped GlideURI API Reference - ServiceNow Wiki
Example (untested):
var q = 'active=true^priority=1';
var endpoint = https://myinstance.service-now.com/api/now/table/incident?sysparm_query=' + q;
var gURI = new ScopedGlideURI();
var uri = gURI.toString(endpoint); //returns fully encoded URI

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 04:36 AM
It doesn't do the encoding automatically. You can do it using the ScopedGlideURI API call.
Scoped GlideURI API Reference - ServiceNow Wiki
Example (untested):
var q = 'active=true^priority=1';
var endpoint = https://myinstance.service-now.com/api/now/table/incident?sysparm_query=' + q;
var gURI = new ScopedGlideURI();
var uri = gURI.toString(endpoint); //returns fully encoded URI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 06:21 AM
Thanks Chuck. This is useful information. I will check and update you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2016 06:26 AM
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you