WebService
An object that represents a combination of node and web service definition, that will be used for requests.
Instance attributes
- id: int
-
Web service id
- name: String
-
Web service name
- description: String
-
Web service description
Instance methods
- get(…) ⇒ WebServiceResponse
-
Execute GET request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.
Table 1. Parameters acceptCached
Boolean
Optional named parameter. If True, response stored in agent’s cache will be used (cache retention time is taken from the web service definition). Default: false.
…
Strings
Optional additional parameter(s) that will be used in web service definition to expand %1, %2… macro.
ReturnInstance of WebServiceResponse with request result.
webSvc = $node.getWebService("webSvcName"); result = webSvc.get(); println(result.document); // will print result result = webSvc.get("additional", "parameters"); println(result.document); // will print result result = webSvc.get(acceptCached: true, "additional", "parameters"); println(result.document); // will print result
- delete(…) ⇒ WebServiceResponse
-
Execute DELETE request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.
Table 2. Parameters …
Strings
Optional additional parameter(s) that will be used in web service definition to expand %1, %2… macro.
ReturnInstance of WebServiceResponse with request result.
webSvc = $node.getWebService("webSvcName"); result = webSvc.delete(); println(result.success); //will print "true" if request was successful or "false" otherwise result = webSvc.delete("additional", "parameters"); println(result.success); //will print "true" if request was successful or "false" otherwise
- patch(data, contentType, …) ⇒ WebServiceResponse
-
Execute PATCH request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.
Table 3. Parameters data
String, JsonObject, JsonArray, or
nullData that will be sent to the web service. JSON objects and arrays are serialized to JSON text. If
null, request data from the web service definition is used.contentType
String
Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".
…
Strings
Optional additional parameter(s) that will be used in web service definition to expand %1, %2… macro. Can be given only after
contentType.ReturnInstance of WebServiceResponse with request result.
webSvc = $node.getWebService("webSvcName"); result = webSvc.patch("{ \"id\":10 }"); println(result.success); //will print "true" if request was successful or "false" otherwise json = new JsonObject(); json.set("id", 42); result = webSvc.patch(json,"application/json", "additional", "parameters"); println(result.success); //will print "true" if request was successful or "false" otherwise
- post(data, contentType, …) ⇒ WebServiceResponse
-
Execute POST request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.
Table 4. Parameters data
String, JsonObject, JsonArray, or
nullData that will be sent to the web service. JSON objects and arrays are serialized to JSON text. If
null, request data from the web service definition is used.contentType
String
Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".
…
Strings
Optional additional parameter(s) that will be used in web service definition to expand %1, %2… macro. Can be given only after
contentType.ReturnInstance of WebServiceResponse with request result.
webSvc = $node.getWebService("webSvcName"); result = webSvc.post("{ \"id\":10 }"); println(result.success);//will print "true" if request was successful or "false" otherwise json = new JsonObject(); json.set("id", 42); result = webSvc.post(json,"application/json", "additional", "parameters"); println(result.success); //will print "true" if request was successful or "false" otherwise
- put(data, contentType, …) ⇒ WebServiceResponse
-
Execute PUT request from agent on associated node. Associated node is the node on which getWebService method was executed. This node is used for macro expansion.
Table 5. Parameters data
String, JsonObject, JsonArray, or
nullData that will be sent to the web service. JSON objects and arrays are serialized to JSON text. If
null, request data from the web service definition is used.contentType
String
Optional parameter. Type of provided data that will be set to "Content-Type" header of request. Default type is "application/json".
…
Strings
Optional additional parameter(s) that will be used in web service definition to expand %1, %2… macro. Can be given only after
contentType.ReturnInstance of WebServiceResponse with request result.
webSvc = $node.getWebService("webSvcName"); result = webSvc.put("{ \"id\":10 }"); println(result.success); //will print "true" if request was successful or "false" otherwise json = new JsonObject(); json.set("id", 42); result = webSvc.put(json,"application/json", "additional", "parameters"); println(result.success); //will print "true" if request was successful or "false" otherwise