Microservices (mservices)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/domain/mservices

Creating a new microservice

GET

/rest/v1/domain/mservices

Getting the list of microservices

GET

/rest/v1/domain/mservices/<id>

Retrieving microservice data

PATCH

/rest/v1/domain/mservices/<id>

Changing microservice data

DELETE

/rest/v1/domain/mservices/<id>

Removing a microservice

LOOKUP

/rest/v1/domain/mservices

Searching for microservice identifier


Creating a new microservice

Request

Field Description: mservice entity

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

mservice entity

Response

Field Description: mservice entity

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

{
  "id": "b12bd5ef-0179-9df2-701b-7cd30a921f58",
  "name": "callcenter",
  "cmdline": "node index.js callcenter",
  "cmdparam": "'{\"domain\":\"%DOMAIN%\",\"http_servers\":%WEBSERVERS%,\"token\":\"b12b22f40b1c71da84320a95ccb3b2b8\",\"logpath\":\"%LOGPATH%\",\"servername\":\"%SERVERNAME%\"}'",
  "enabled": true,
  "archive": {
    "_links": {
      "self": {
        "href": "/rest/v1/domain/mservices/b12bd5ef-0179-9df2-701b-7cd30a921f58/attachment"
      }
    }
  },
  "opts": {
    "title": "",
    "comment": "",
    "mode": "active-passive",
    "heartbeat_interval": 5000,
    "site_mode": "all",
    "selected_sites": [],
    "restart_mode": "permanent",
    "attachment_info": {
      "hasha": "md5;9A29CC52D6BC1EE0D4417AB3C604F3E6",
      "mtime": "2021-06-24T09:41:23Z",
      "size": 378
    }
  },
  "ext": {
    "ct": "2021-05-24T10:36:21.91Z",
    "lwt": "2021-06-24T09:41:27.78Z"
  }
}

Getting the list of microservices

Request

Table 1. Request parameters
Name Type Description

filter

object

Filter by field values.

mask

str

List of fields to output. Available fields for output: id, name, cmdline, cmdparam, enabled, opts.title, ext.lwt, ext.ct.

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/domain/mservices?offset=0&limit=2 HTTP/1.1

Response

Field Description: mservice entity

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

[
  {
    "id": "b12bd5ef-0179-9df2-701b-7cd30a921f58",
    "name": "callcenter",
    "cmdline": "node index.js callcenter",
    "cmdparam": "'{\"domain\":\"%DOMAIN%\",\"http_servers\":%WEBSERVERS%,\"token\":\"b12b22f40b1c71da84320a95ccb3b2b8\",\"logpath\":\"%LOGPATH%\",\"servername\":\"%SERVERNAME%\"}'",
    "enabled": true,
    "archive": {
      "_links": {
        "self": {
          "href": "/rest/v1/domain/mservices/b12bd5ef-0179-9df2-701b-7cd30a921f58/attachment"
        }
      }
    },
    "opts": {
      "title": "",
      "comment": "",
      "mode": "active-passive",
      "heartbeat_interval": 5000,
      "site_mode": "all",
      "selected_sites": [],
      "restart_mode": "permanent",
      "attachment_info": {
        "hasha": "md5;9A29CC52D6BC1EE0D4417AB3C604F3E6",
        "mtime": "2021-06-24T09:41:23Z",
        "size": 378
      }
    },
    "ext": {
      "ct": "2021-05-24T10:36:21.91Z",
      "lwt": "2021-06-24T09:41:27.78Z"
    }
  },
  {
    "id": "d670bca8-8f07-4e98-adc3-eba1d1933cd1",
    "name": "era_tester",
    "cmdline": "node index.js tester",
    "cmdparam": "'{\"domain\":\"%DOMAIN%\",\"http_servers\":%WEBSERVERS%,\"token\":\"b12b22f40b1c71da84320a95ccb3b2b8\",\"logpath\":\"%LOGPATH%\",\"servername\":\"%SERVERNAME%\"}'",
    "enabled": true,
    "archive": {
      "_links": {
        "self": {
          "href": "/rest/v1/domain/mservices/d670bca8-8f07-4e98-adc3-eba1d1933cd1/attachment"
        }
      }
    },
    "opts": {
      "attachment_info": {
        "hasha": "md5;8096AD694C44EE1F205DE865C6D62A5C",
        "mtime": "2021-07-08T21:34:50Z",
        "size": 2186028
      },
      "comment": "",
      "heartbeat_interval": 5000,
      "mode": "active-passive",
      "restart_mode": "permanent",
      "selected_sites": [],
      "site_mode": "all",
      "title": ""
    },
    "ext": {
      "ct": "2021-07-08T21:34:36.68Z",
      "lwt": "2021-07-08T21:36:20.99Z"
    }
  }
]

Retrieving microservice data

Request

Table 2. Request parameters
Name Type Description

mask

str

A list of fields to output.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/domain/projects/b12bd5ef-0179-9df2-701b-7cd30a921f58 HTTP/1.1

Response

Field Description: mservice entity

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

{
  "id": "b12bd5ef-0179-9df2-701b-7cd30a921f58",
  "name": "callcenter",
  "cmdline": "node index.js callcenter",
  "cmdparam": "'{\"domain\":\"%DOMAIN%\",\"http_servers\":%WEBSERVERS%,\"token\":\"b12b22f40b1c71da84320a95ccb3b2b8\",\"logpath\":\"%LOGPATH%\",\"servername\":\"%SERVERNAME%\"}'",
  "enabled": true,
  "archive": {
    "_links": {
      "self": {
        "href": "/rest/v1/domain/mservices/b12bd5ef-0179-9df2-701b-7cd30a921f58/attachment"
      }
    }
  },
  "opts": {
    "title": "",
    "comment": "",
    "mode": "active-passive",
    "heartbeat_interval": 5000,
    "site_mode": "all",
    "selected_sites": [],
    "restart_mode": "permanent",
    "attachment_info": {
      "hasha": "md5;9A29CC52D6BC1EE0D4417AB3C604F3E6",
      "mtime": "2021-06-24T09:41:23Z",
      "size": 378
    }
  },
  "ext": {
    "ct": "2021-05-24T10:36:21.91Z",
    "lwt": "2021-06-24T09:41:27.78Z"
  }
}

Changing microservice data

Fields prohibited for modification: id

Request

Field Description: mservice entity

Request example
PATCH /rest/v1/domain/projects/b12bd5ef-0179-9df2-701b-7cd30a921f58 HTTP/1.1
Content-Type: application/json; charset=utf-8

mservice entity

Response

Field Description: mservice entity

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

{
  "id": "b12bd5ef-0179-9df2-701b-7cd30a921f58",
  "name": "callcenter",
  "cmdline": "node index.js callcenter",
  "cmdparam": "'{\"domain\":\"%DOMAIN%\",\"http_servers\":%WEBSERVERS%,\"token\":\"b12b22f40b1c71da84320a95ccb3b2b8\",\"logpath\":\"%LOGPATH%\",\"servername\":\"%SERVERNAME%\"}'",
  "enabled": true,
  "archive": {
    "_links": {
      "self": {
        "href": "/rest/v1/domain/mservices/b12bd5ef-0179-9df2-701b-7cd30a921f58/attachment"
      }
    }
  },
  "opts": {
    "title": "",
    "comment": "New comment",
    "mode": "active-active",
    "heartbeat_interval": 5000,
    "site_mode": "all",
    "selected_sites": [],
    "restart_mode": "transient",
    "attachment_info": {
      "hasha": "md5;9A29CC52D6BC1EE0D4417AB3C604F3E6",
      "mtime": "2021-06-24T09:41:23Z",
      "size": 378
    }
  },
  "ext": {
    "ct": "2021-05-24T10:36:21.91Z",
    "lwt": "2021-06-24T09:41:27.78Z"
  }
}

Removing a microservice

Request

Request example
DELETE /rest/v1/domain/projects/b12bd5ef-0179-9df2-701b-7cd30a921f58 HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for microservice identifier

Searches the resource for the specified key, returns the identifier(s) to build the endpoint.

Key fields to search for: id, code

Request

Request example
LOOKUP /rest/v1/domain/mservices HTTP/1.1
Content-Type: application/json; charset=utf-8

"callcenter"

Response

Example of a successful response
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "b12bd5ef-0179-9df2-701b-7cd30a921f58"
]
Example of an unsuccessful response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{
  "error_code": 1404,
  "error_message": "Lookup failed"
}

Table of Contents (subsidiary resources)