Quick messaging channels (imchannels)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/imchannels

Creating a new channel

GET

/rest/v1/uc/imchannels

Getting a list of channels

GET

/rest/v1/uc/imchannels/<id>

Receiving channel data

PATCH

/rest/v1/uc/imchannels/<id>

Changing channel data

DELETE

/rest/v1/uc/imchannels/<id>

Channel deletion

LOOKUP

/rest/v1/uc/imchannels

Searching for channel ID


Creating a new channel

Request

Field Description: imchannel entity

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

imchannel entity

Response

Field Description: imchannel entity

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

{
  "id": "3005a447-017b-e5f8-472b-7cd30a921f58",
  "code": "telegram",
  "mode": "request",
  "recv_strategy": "",
  "send_strategy": "",
  "opts": {
    "title": "",
    "comment": "",
    "after_read_timeout": 100,
    "max_account_mps": 30,
    "max_remoteparty_mps": 1
  },
  "ext": {
    "ct": "2021-09-14T20:20:58.79Z",
    "lwt": "2021-09-14T20:20:58.79Z"
  }
}

Getting a list of channels

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, code, mode, recv_strategy, send_strategy, opts.title, opts.comment, 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/uc/imchannels?offset=0&limit=2 HTTP/1.1

Response

Field Description: imchannel entity

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

[
  {
    "id": "3005a447-017b-e5f8-472b-7cd30a921f58",
    "code": "telegram",
    "mode": "request",
    "recv_strategy": "",
    "send_strategy": "",
    "opts": {
      "title": "",
      "comment": ""
    },
    "ext": {
      "ct": "2021-09-14T20:20:58.79Z",
      "lwt": "2021-09-14T20:20:58.79Z"
    }
  },
  {
    "id": "3005a447-017b-e5f8-472b-7cd30a921f58",
    "code": "custom_site_messager",
    "mode": "request",
    "recv_strategy": "custom_site_messager_recv",
    "send_strategy": "custom_site_messager_recv",
    "opts": {
      "title": "",
      "comment": ""
    },
    "ext": {
      "ct": "2021-10-22T15:47:30.41Z",
      "lwt": "2021-10-22T15:47:30.41Z"
    }
  }
]

Receiving channel 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/uc/imchannels/3005a447-017b-e5f8-472b-7cd30a921f58 HTTP/1.1

Response

Field Description: imchannel entity

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

{
  "id": "3005a447-017b-e5f8-472b-7cd30a921f58",
  "code": "telegram",
  "mode": "request",
  "recv_strategy": "",
  "send_strategy": "",
  "opts": {
    "title": "",
    "comment": "",
    "after_read_timeout": 100,
    "max_account_mps": 30,
    "max_remoteparty_mps": 1
  },
  "ext": {
    "ct": "2021-09-14T20:20:58.79Z",
    "lwt": "2021-09-14T20:20:58.79Z"
  }
}

Changing channel data

Fields prohibited for modification: id

Request

Field Description: imchannel entity

Request example
PATCH /rest/v1/uc/imchannels/3005a447-017b-e5f8-472b-7cd30a921f58 HTTP/1.1
Content-Type: application/json; charset=utf-8

imchannel entity

Response

Field Description: imchannel entity

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

{
  "id": "3005a447-017b-e5f8-472b-7cd30a921f58",
  "code": "telegram",
  "mode": "request",
  "recv_strategy": "my_telegram_recv_scriptcode",
  "send_strategy": "my_telegram_send_scriptcode",
  "opts": {
    "title": "",
    "comment": "",
    "after_read_timeout": 1000,
    "max_account_mps": 30,
    "max_remoteparty_mps": 1
  },
  "ext": {
    "ct": "2021-09-14T20:20:58.79Z",
    "lwt": "2021-09-14T20:20:58.79Z"
  }
}

Channel deletion

Request

Request example
DELETE /rest/v1/uc/imchannels/3005a447-017b-e5f8-472b-7cd30a921f58 HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for channel ID

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

Key fields to search for: id, code, name

Request

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

"telegram"

Response

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

[
  "3005a447-017b-e5f8-472b-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"
}

See also