WHY is the Rest Message URL being truncated?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:22 AM - edited 02-15-2024 06:26 AM
Hello all,
I am able to use the below code in a lower Dev environment just fine. I move the code up to an IT environment, and I am seeing the StringParameter being contatenated to: https://dingdongs.net/v1/cb_link Please note, that I was originally using the "setStringparameterNoEscape" and the same thing is happening. I commented out both "setStringParameter" and "setStringparameterNoEscape" and ServiceNow did not use any URL at all, which was expected. So, I know that my code is using this string value, there is just something I am missing.
var r = new sn_ws.RESTMessageV2('qualtrics', 'POST');
//gs.log(body,"REST API TESTING"); // Testing purpose need to comment this line
r.setStringParameterNoEscape('interactionRecord', body);
var qualtricsURL = gs.getProperty('qualtrics.API.URL');
//Development Env
r.setStringParameter('endpoint', 'https://dingdongs.net/v1/cb_link?jobId=123&apiKey=123');
//Prod Env
//r.setStringParameterNoEscape('endpoint', qualtricsURL);
var response = r.execute();
var responseBody = response.getBody();
//gs.log('STRY0750821 ' + body);
var httpStatus = response.getStatusCode();
//gs.log(httpStatus,"REST API TESTING"); // Testing purpose need to comment this line
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:26 AM
Where is it getting cut off? In the UI? If so, thats a character limit on that string field.
I've used URLs a lot longer than that in my scripted rest APIs and never had a problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:28 AM
it is being used in a Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:37 AM
Perhaps check your qualtrics outbound rest message. There might be a character limit on that field there.
Maybe try adjusting your script and run it in background scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:36 AM
I am pretty well convinced it has something to do with the question mark.