WHY is the Rest Message URL being truncated?

lonesoac01
Giga Guru

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.

8 REPLIES 8

The Machine
Kilo Sage

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.

it is being used in a Script Include.

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.

var r = new sn_ws.RESTMessageV2();
r.setHttpMethod('post');
r.setEndpoint('YOUR QUALTRICS ENDPOINT');

I am pretty well convinced it has something to do with the question mark.