
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:11 AM
function testMe()
{
var r = new sn_ws.RESTMessageV2('test', 'get');
console.debug("r: " + r);
var response = r.execute();
console.debug("response: " + response);
var responseBody = response.getBody();
console.debug("responseBody: " + responseBody);
var httpStatus = response.getStatusCode();
console.debug("httpStatus: " + httpStatus);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:16 AM
Hi David,
Can you do a test from scripts background and see if it runs all by itself? Just copy and paste the code above and call your testMe() function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:18 AM
Just to verify... where is this code being called from? It's server side code and should not be in a client script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2016 06:21 AM
I'm not-so-bright today. I was doing this in a UI Page Client Script. It needs to be server side. doh!!
This is what worked: (UI Page Client Script)
function testMe()
{
var gaj = new GlideAjax('REST_API_CALL');
gaj.addParam('sysparm_name', 'getData');
gaj.getXMLWait();
var answer = gaj.getAnswer();
console.debug("answer: " + answer);
}
Script Include:
var REST_API_CALL = Class.create();
REST_API_CALL.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getData: function()
{
var r = new sn_ws.RESTMessageV2('test', 'get');
var response = r.execute();
var responseBody = response.getBody();
return responseBody;
}
});