Routing rules (vectorrules)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/vectorrules

Creating a new routing rule

GET

/rest/v1/uc/vectorrules

Getting a list of routing rules

GET

/rest/v1/uc/vectorrules/<id>

Obtaining routing rule data

PATCH

/rest/v1/uc/vectorrules/<id>

Changing routing rule data

DELETE

/rest/v1/uc/vectorrules/<id>

Deleting a routing rule

LOOKUP

/rest/v1/uc/vectorrules

Searching for a routing rule identifier


Creating a new routing rule

Request

Field Description: vectrorule entity

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

vectrorule entity

Response

Field Description: vectrorule entity

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

{
  "id": "ca54ed9e-016c-b377-cb5a-50e54938780c",
  "vector": "default",
  "priority": 100,
  "action": "internal",
  "dir": "inner",
  "fromdomain": "",
  "fromextaccount": "",
  "fromnumber": "",
  "tonumber": "",
  "toextaccount": "",
  "todomain": "",
  "routecode": "",
  "modfromnumber": "T",
  "modtonumber": "T",
  "modroutecode": "",
  "schedule": "work",
  "periods": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-21T09:17:48.25Z",
    "lwt": "2019-08-21T09:17:48.25Z"
  }
}

Getting a list of routing rules

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, vector, priority, action, dir, fromnumber, fromdomain, fromextaccount, tonumber, todomain, toextaccount, modfromnumber, modtonumber, 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/uc/vectorrules?offset=0&limit=2 HTTP/1.1

Response

Field Description: vectrorule entity

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

[
  {
    "id": "ca54ed9e-016c-b377-cb5a-50e54938780c",
    "vector": "default",
    "priority": 100,
    "action": "internal",
    "dir": "inner",
    "fromdomain": "",
    "fromextaccount": "",
    "fromnumber": "",
    "tonumber": "",
    "toextaccount": "",
    "todomain": "",
    "routecode": "",
    "modfromnumber": "T",
    "modtonumber": "T",
    "modroutecode": "",
    "schedule": "work",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-21T09:17:48.25Z",
      "lwt": "2019-08-21T09:17:48.25Z"
    }
  },
  {
    "id": "e8d844ab-016c-beb3-f4ec-50e54938780c",
    "vector": "default",
    "priority": 555,
    "action": "crossdomain",
    "dir": "cross",
    "fromnumber": "",
    "fromdomain": "test.rootdomain.ru",
    "fromextaccount": "",
    "tonumber": "",
    "todomain": "",
    "toextaccount": "",
    "routecode": "",
    "modfromnumber": "T",
    "modtonumber": "T",
    "modroutecode": "*",
    "schedule": "all",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-23T13:39:20.42Z",
      "lwt": "2019-08-23T13:39:20.42Z"
    }
  }
]

Obtaining routing rule 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/vectorrules/ca54ed9e-016c-b377-cb5a-50e54938780c HTTP/1.1

Response

Field Description: vectrorule entity

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

{
  "id": "ca54ed9e-016c-b377-cb5a-50e54938780c",
  "vector": "default",
  "priority": 100,
  "action": "internal",
  "dir": "inner",
  "fromdomain": "",
  "fromextaccount": "",
  "fromnumber": "",
  "tonumber": "",
  "toextaccount": "",
  "todomain": "",
  "routecode": "",
  "modfromnumber": "T",
  "modtonumber": "T",
  "modroutecode": "",
  "schedule": "work",
  "periods": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-21T09:17:48.25Z",
    "lwt": "2019-08-21T09:17:48.25Z"
  }
}

Changing routing rule data

Fields prohibited for modification: id

Request

Field Description: vectrorule entity

Request example
PATCH /rest/v1/uc/vectorrules/ca54ed9e-016c-b377-cb5a-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

vectrorule entity

Response

Field Description: vectrorule entity

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

{
  "id": "ca54ed9e-016c-b377-cb5a-50e54938780c",
  "vector": "default",
  "priority": 100,
  "action": "cross",
  "dir": "",
  "fromdomain": "",
  "fromextaccount": "",
  "fromnumber": "XXX",
  "tonumber": "XXX",
  "toextaccount": "",
  "todomain": "test.rootdomain.ru",
  "routecode": "",
  "modfromnumber": "14T",
  "modtonumber": "/X/XXX",
  "modroutecode": "*",
  "schedule": "work",
  "periods": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-21T09:17:48.25Z",
    "lwt": "2019-08-21T09:17:48.25Z"
  }
}

Deleting a routing rule

Request

Request example
DELETE /rest/v1/uc/vectorrules/ca54ed9e-016c-b377-cb5a-50e54938780c HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for a routing rule identifier

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

Key fields to search for: id

Request

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

"b6edc9b1-016c-b372-63a5-50e54938780c"

Response

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

[
  "b6edc9b1-016c-b372-63a5-50e54938780c"
]
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"
}