Managing the execution of service scenarios (svcscript_runtimes)

Overview

Manages the active handlers of service scenarios.
A service script handler is an algorithm that interprets an instance of a service script.

Requests

HTTP verb Endpoint Description

POST

/rest/v1/service/svcscript_runtimes

Starting a new instance of the service scenario

GET

/rest/v1/service/svcscript_runtimes

Getting the list of running instances of service scripts

DELETE

/rest/v1/service/svcscript_runtimes/<id>

Stopping an instance of the service scenario

Starting a new instance of the service scenario

Starts a new service script handler on one of the nodes with role svc, into which a service script with the specified code from the current domain is loaded.

A node on the same site where the API request is served is preferentially selected. Exception, if the current domain is not served on this site or there is no role.

Request

Table 1. Field Description:
Field Description

code

Scenario code

startparam1

Parameter 1, available in the script via the startparam(1) expression function and in the component Start.

startparam2

Parameter 2, available in the script through the expressions function startparam(2).

startparam3

Parameter 3, available in the script through the expressions function startparam(3).

startparam4

Parameter 4, available in the script through the expressions function startparam(4).

startparam5

Parameter 5, available in the script through the expressions function startparam(5).

startparam6

Parameter 6, available in the script through the expressions function startparam(6).

startparam7

Parameter 7, available in the script via the expression function startparam(7).

startparam8

Parameter 8, available in the script via the expression function startparam(8).

startparam9

Parameter 9, available in the script through the expressions function startparam(9).

Request example
POST /rest/v1/service/svcscript_runtimes HTTP/1.1
Content-Type: application/json; charset=utf-8

{
  "code": "123"
}

Response

Returns information about the running service script handler.

Table 2. Field Description
Field Description

id

Scenario handler identifier

site

The site on which the handler is running.

node

Noda, within which the handler ran.

domain

Script Domain.

type

Type of script running.

code

The code of the running script.

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "b7f4ad2f-0624-e7dd-42f5-d000000003e8",
  "site": "SITE1",
  "node": "site1_c@192.168.0.12",
  "domain": "test.rootdomain.ru",
  "type": "svc",
  "code": "code"
}

Getting the list of running instances of service scripts

Returns a list of all service script handlers executed by the system in the current domain at all available sites where it is served.

Request

Table 3. Request parameters
Name Type Description

filter

object

Filter by field values.

mask

str

A list of fields to output.

offset

int

Offset in the list of resources to be issued.

limit

int

The maximum number of resources in the list.

order

array<object|str>

The sort order of the resources in the list.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/service/svcscript_runtimes HTTP/1.1

Response

Returns all detected active running service script handlers.

Table 4. Field Description:
Field Description

id

Scenario handler identifier

site

The site where the handler is executed.

node

Node within which the handler is executed.

domain

Script Domain.

type

Scenario Type.

code

The code of the running script. If the source script has transferred control to a nested script, the code of the nested script is returned.

name

The name of the running scenario. If the source script has transferred control to a nested script, the name of the nested script is returned.

starttime

Date and time of the handler start in RFC3339 format in UTC.

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "fbd617e7-0624-e648-92da-7800000003e8",
    "site": "SITE1",
    "node": "site1_c@192.168.0.12",
    "domain": "test.rootdomain.ru",
    "type": "svc",
    "code": "test pause",
    "name": "TEST PAUSE",
    "starttime": "2019-11-05T08:40:41Z"
  },
  {
    "id": "424123d3-0624-e647-e54b-7800000003e8",
    "site": "SITE1",
    "node": "site1_c@192.168.0.12",
    "domain": "test.rootdomain.ru",
    "type": "svc",
    "code": "send_mail",
    "name": "SEND MAIL",
    "starttime": "2019-11-05T08:40:30Z"
  }
]

Stopping an instance of the service scenario

Forcibly terminates the script handler.

If a post-processing branch corresponding to the External Stop' termination type is specified in the currently executing script, control is passed to it and the handler continues to execute. In this case, another API request will be needed to stop the handler completely `DELETE.

Request

Request example
DELETE /rest/v1/service/svcscript_runtimes/4e7e9ce0-0621-6606-d157-c00000000004 HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

See also