cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Content Loader Functions Tip

No ratings

Remember that when you are calling an external URL to fetch data via an API call to another system that you must encode special characters specifically. For example the URL that you may type into a browser to test may look like this:

but when scripting that into a string variable you'll need to replace the space and the carrot with the proper encoded values (%20 and %5E)

var params = {

username : "me",

password : "password",

ignoreSSLErrors : false,

timeout : 60,

headers : headers

};

var result = Resources['ContentLoaderFunctions'].LoadXML(params);

also note that in this instance we're making a secure connection therefore port 443 (typically the default) was explicitly specified...

Comments

There's actually a build in JavaScript function called encodeURI() that will handle the encoding automatically.

So, we could do:


....

password: "password",

url: encodeURI("https://someserver.somewhere.com:443/apicall?parameter1=test string&parameter2=test^number"),

....


which will result in: https://someserver.somewhere.com:443/apicall?parameter1=test%20string&parameter2=test%5Enumber




Version history
Last update:
‎Nov 01, 2011 08:23 AM
Updated by:
Labels (1)