- 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-18-2017 06:26 AM
Have you tried replacing the slashes with /
If it's passing them as part of the URI, which it may, then they could be getting the URI garbled.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:42 AM
You can use the method
var string2 = gs.urlEncode(string1);
to convert a lot of this stuff before putting it in your parameters.
- 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-18-2017 10:48 AM
Good to know Prici! I should have remembered the alternate methods to setStringParameter(). Thanks for sharing.
You may want to consider marking your 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