Processing of incoming requests (exec)
Overview
Processes incoming requests using service scripts.
The following processing options are possible.
Role Application Handler
The request must be authorized under the account user, the service script roleapp is run as a handler]. The role application is selected based on the Referer header, which contains the URI of the role application:
Referer: http://<ServerIP[:Port]>/app/<RoleappFolder>
This header is automatically generated by the browser when requests are made from a web application.
Handler of webhooks of external systems.
The request must contain an Authorization header with the value Bearer <local_token>
where <local_token> is the value of the token_local field from integration channel.
A service script corresponding to integration channel is run as a handler].
Authorization: Bearer cabcf10d692d5f8f386974d435997ea5
Requests
HTTP verb | Endpoint | Description |
---|---|---|
|
|
Starting the handler of incoming requests with body transfer |
|
|
Starting the handler of incoming requests with body transfer
Request
An arbitrary JSON object is placed in the request body. It will be available in the handler of the initiated service script as a start parameter 4.
Parameters are available at any time through the startparam(N)
expression function, where N
is the parameter number.
The script handler in the startup parameters will get:
Function | Description |
---|---|
|
Representation of the JSON object of the associated request entity roleapp or integration channel. |
|
The name of the method from the HTTP request. Always |
|
URL from an HTTP request. Always |
|
JSON-object with a request body. If something else is passed in the body, it will also be available. |
|
List of headers from HTTP request. |
|
IP-HTTP request sender address. |
|
HTTP Request Protocol. Always |
POST /exec HTTP/1.1
Referer: http://192.168.1.2:5800/app/folder/index.html
Content-Type: application/json; charset=utf-8
{
"method": "myMethod1",
"m_param": 1,
"dt": "2019-11-01T11:01:59Z",
"abc": "Coo-coo",
"isSmth": true,
"a": [
1,
5,
"aaa"
],
"o": {
"x": 1,
"y": "abc",
"z": {
"z1": [],
"z2": {},
"z3": null
}
}
}
Request parameters
A query may have an optional parameter ?timeout=<sec>
in the query string of the URL. If it is present, integer values greater than zero are accepted.
This parameter can only reduce the waiting time for the script to complete. The maximum wait time is configured in the opts.recv_timeout
field of the corresponding
entity (roleapp or integration_point for type public
) or
in the recv_timeout field of the section of the corresponding file type (not public
) webservices.json.
Response
The response is returned after the initiated script handler completes. As a result of running a scenario or a group of nested scenarios, the values of local variables take their final values. Part of the variable values are used when preparing an HTTP response. Matching is performed by variable names:
Variable name | Assignment |
---|---|
|
HTTP response code, default |
|
Additional response headers in JSON format. Defaults to an empty string and only standard HTTP headers. If there is no standard |
|
Response Body. None by default. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Some-Header: header value
Response Body
Launching the incoming requests handler
Request
The script handler in the startup parameters will get:
Function | Description |
---|---|
|
Representation of the JSON object of the associated request entity roleapp or integration channel. |
|
The name of the method from the HTTP request. Always |
|
URL from an HTTP request. Always |
|
List of headers from HTTP request. |
|
IP-HTTP request sender address. |
|
HTTP Request Protocol. Always |
GET /exec HTTP/1.1
Referer: http://192.168.1.2:5800/app/folder/index.html
Content-Type: application/json; charset=utf-8
Request parameters
A query may have an optional parameter ?timeout=<sec>
in the query string of the URL. If it is present, integer values greater than zero are accepted.
This parameter can only reduce the waiting time for the script to complete. The maximum wait time is configured in the opts.recv_timeout
field of the corresponding
entity (roleapp or integration_point for type public
) or
in the recv_timeout field of the section of the corresponding file type (not public
) webservices.json.
Response
The response is returned after the initiated script handler completes. As a result of running a scenario or a group of nested scenarios, the values of local variables take their final values. Part of the variable values are used when preparing an HTTP response. Matching is performed by variable names:
Variable name | Assignment |
---|---|
|
HTTP response code, default |
|
Additional response headers in JSON format. Defaults to an empty string and only standard HTTP headers. If there is no standard |
|
Response Body. None by default. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Some-Header: header value
Response Body