- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 11:37 PM
I need to send two dynamic parameters to the endpoint for querying. I confirmed that the token works properly. However, it returns no value, and when debugging, the endpoint remained unchanged without a value passed.
getACTIVITY2: function() {
try {
var r = new sn_ws.RESTMessageV2('CPNYCostCenter', 'Get ACTIVITY');
r.setStringParameterNoEscape('p_fund', 'AF'); //Hardcode for now to debug
r.setStringParameterNoEscape('p_org', 'CSIPM'); //Hardcode for now to debug
r.setRequestHeader('Authorization', 'Bearer ' + this.token);
var response2 = r.execute();
var responseBody2 = response2.getBody();
var httpStatus2 = response2.getStatusCode();
gs.info("The Activity: " + responseBody2); //return empty
gs.info("Endpoint: " + r.getEndpoint();) // return https:url.com//ServiceNow/getActivityList?p_org=${p_org}&p_fund=${p_fund} //Variable value did not pass into the endpoint
} catch (ex) {
var message = ex.message;
}
},
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 03:00 AM
You are posting the query parameters twice
If you do that you will get them twice
If using the HTTP Query Parameters you should not add anything in the path. It will add "?" as well as the parameters you hav added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 01:58 AM
try the below
content-type = application/xml.
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 02:25 AM
Failed too
with code: 415: no thrown error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 02:42 AM
These are the parameters
2nd parameters change like as Bearer ${Token}
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 03:00 AM
You are posting the query parameters twice
If you do that you will get them twice
If using the HTTP Query Parameters you should not add anything in the path. It will add "?" as well as the parameters you hav added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 03:05 AM
Spot on! Thank you!