- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:24 AM
Hi All,
I am trying to get data from external resource using REST call.
When I set parameter with '/' is not working. Getting response as 0, but it contains data.
sm.setHttpMethod("get");
sm.setEndpoint("https://<application.doamin.com>/api/v1/locations/${date_updated_since,active,type_id,region}");
sm.setRequestHeader("Accept", 'application/json');
sm.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
sm.setRequestHeader("key","<my key value>");
sm.setQueryParameter("date_updated_since", '2016-04-04');
sm.setQueryParameter("active", 1);
sm.setQueryParameter("type_id", 1);
sm.setQueryParameter("region", "NA/EU/APAC"); // the api call works fine without this parameter
This query return records without region, but if I add region parameter then it returns 0.
But I'm sure that records are available with this value.
I assume this front slash is causing the issue.
Even I tried escape character (with back slash) but no use.
Any help.
Thanks
Prici
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 08:11 AM
Hi Chuck,
Thank you for your response.
Tried giving '/' but got the same response (error).
But the below statement solved my issue.
'sm.setStringParameterNoEscape("region", "NA/EU/APAC");'
Thanks
Prici.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 12:31 AM
Sure Chuck..Marked the correct answer..
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:33 AM
Hi Prici,
When you set some parameter using GET it goes in URL and if you are using special characters such as space, slash etc you need to send URL encoded values for these
example:
space %27
slash /
For your reference
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
‎05-23-2017 12:32 AM
I tried '/' Ankur, but sadly it was not working for me.