- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2018 11:33 PM
I have a rest message with POST method, rest message is running and giving result in test run. but when I am trying to run this using scheduled job it gives me error.
I wrote this:
var r = new sn_ws.RESTMessageV2('RestMessage','post');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var parser = new global.JSONParser();
var parsed = parser.parse(responseBody);
I get the error:
REST Msg Outbound - RESTMessageClient : Error constructing REST Message/Method: global.legalholdpro/post: com.glide.generators.InvalidGlideRecordException: REST message/method 'global.legalholdpro/post' not found in table 'sys_rest_message_fn': com.glide.rest.outbound.RESTMessageDAO.getMethodRecord(RESTMessageDAO.java:97)
com.glide.rest.outbound.RESTMessageDAO.<init>(RESTMessageDAO.java:72)
com.glide.rest.outbound.RESTMessageDAO.newInstance(RESTMessageDAO.java:67)
also I need to push the results which is in JSON format in a staging form, which will work after rest gets executed. Please suggest?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2021 07:35 AM
This worked for me:
var Url = 'https://www.testurl.com/';
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('post');
request.setEndpoint(Url);
request.setRequestHeader("Content-type",'application/json');
request.setRequestHeader("Authorization",'Bearer YYNp0IIJozbzfUV9');
var response = request.execute();
var httpResponseStatus = response.getStatusCode();
var httpResponseContentType = response.getHeader('Content-Type');
//Debug the results:
gs.debug("http response status_code: " + httpResponseStatus);
gs.debug("http response content-type: " + httpResponseContentType);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2018 02:58 AM
If it is in scoped app then it should be called via scoped app name to the REST Message.
Also check if your post http method is defined in the related rest message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2018 03:13 AM
It is in global scope, I tried using global.restmsg name also but didn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2019 07:40 PM
Can someone help me with the scrip for the use scheduled job to trigger your REST message in the POST method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2021 07:35 AM
This worked for me:
var Url = 'https://www.testurl.com/';
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('post');
request.setEndpoint(Url);
request.setRequestHeader("Content-type",'application/json');
request.setRequestHeader("Authorization",'Bearer YYNp0IIJozbzfUV9');
var response = request.execute();
var httpResponseStatus = response.getStatusCode();
var httpResponseContentType = response.getHeader('Content-Type');
//Debug the results:
gs.debug("http response status_code: " + httpResponseStatus);
gs.debug("http response content-type: " + httpResponseContentType);