Use this server class to create a SimpleRestRequest object.
restRequestV1(requestName, methodName)
Use this method to create a SimpleRestRequest object.
The parameters of this method are passed into the new SimpleRestRequest object.
Optionally, it is possible to omit specifying the parameters. In this case, the user has to configure the SimpleRestRequest object manually by calling its methods.
Read this article to learn how to provide values for the requestName and methodName parameters.
Parameters:
Name
Type
Mandatory
Default value
requestName
String
N
empty string
methodName
String
N
empty string
Return:
Type
Description
SimpleRestRequest object
This method returns a SimpleRestRequest object initiated by the given parameters or an empty object.
Example:
restRequestV1()
/* Create a 'Telegram' request in the REST Requests (sys_rest_requests) table
and a 'Send Message' method in the REST Request Methods (sys_rest_request_method) table related to the 'Telegram' request.
Also, create 'chat_id' and 'text' Rest Request Method Param (sys_rest_request_method_param) related to the 'Send Message' method.
*/
const request = sws.restRequestV1('Telegram', 'Send Message');
request.setStringParameter('chat_id', '123456789');
request.setStringParameter('text', 'telegram');
const response = request.execute();
// OR
const request = sws.restRequestV1();
request.setRequestUrl('https://api.telegram.org/bot1860462740:AAHyP6BMH2Mh-cXezrTVu2sJUoNYvimMRMQ/sendMessage');
request.setQueryParameter('chat_id', '123456789');
request.setQueryParameter('text', 'telegram');
const response = request.execute();