borderrules (borderrules)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/master/borderrules

Creating a new rule

GET

/rest/v1/master/borderrules

Getting the list of rules

GET

/rest/v1/master/borderrules/<id>

Obtaining rule data

PATCH

/rest/v1/master/borderrules/<id>

Changing the rule data

DELETE

/rest/v1/master/borderrules/<id>

Deleting a rule

LOOKUP

/rest/v1/master/borderrules

Searching for a rule identifier


Creating a new rule

Request

Field Description: borderrule entity

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

borderrule entity

Response

Field Description: borderrule entity

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

{
  "id": "9a7a73b7-016c-cd10-9ca9-50e54938780c",
  "enabled": 1,
  "priority": 91,
  "site": "*",
  "service": "sip",
  "domain": "docs[.]rootdomain[.]ru",
  "username": "",
  "useragent": "",
  "remoteipmask": "0.0.0.0/0",
  "action": "allow",
  "opts": {
    "title": "",
    "comment": ""
  },
  "ext": {
    "ct": "2019-08-26T08:35:13.70Z",
    "lwt": "2019-08-26T08:35:13.70Z"
  }
}

Getting the list of 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, priority, site, domain, username, useragent, remoteipmask, 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/master/borderrules?offset=0&limit=5 HTTP/1.1

Response

Field Description: borderrule entity

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

[
  {
    "id": "9a7a73b7-016c-cd10-9ca9-50e54938780c",
    "enabled": 1,
    "priority": 91,
    "site": "",
    "service": "sip",
    "domain": "docs[.]rootdomain[.]ru",
    "username": "",
    "useragent": "",
    "remoteipmask": "0.0.0.0/0",
    "action": "allow",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-26T08:35:13.70Z",
      "lwt": "2019-08-26T08:35:13.70Z"
    }
  },
  {
    "id": "592aac52-016c-cd11-5ca7-50e54938780c",
    "enabled": 1,
    "priority": 92,
    "site": "",
    "service": "sip",
    "domain": "",
    "username": "abcde",
    "useragent": "",
    "remoteipmask": "0.0.0.0/0",
    "action": "deny",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-27T09:36:14.81Z",
      "lwt": "2019-08-27T09:36:14.81Z"
    }
  },
  {
    "id": "50b2cff8-016d-1bb6-0054-02004c4f4f50",
    "enabled": 1,
    "priority": 93,
    "site": "",
    "service": "sip",
    "domain": "",
    "username": "",
    "useragent": "friendly-scanner.\",
    "remoteipmask": "0.0.0.0/0",
    "action": "drop",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-28T10:37:15.92Z",
      "lwt": "2019-08-28T10:37:15.92Z"
    }
  },
  {
    "id": "9f2605a4-016d-1bb7-d504-02004c4f4f50",
    "enabled": 1,
    "priority": 94,
    "site": "SITE1",
    "service": "sip",
    "domain": "",
    "username": "",
    "useragent": "",
    "remoteipmask": "212.53.40.40/4",
    "action": "allow",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-29T11:38:16.03Z",
      "lwt": "2019-08-29T11:38:16.03Z"
    }
  },
  {
    "id": "0a2cce0d-016d-1bb7-f46b-02004c4f4f50",
    "enabled": 1,
    "priority": 95,
    "site": "SITE2",
    "service": "sip",
    "domain": "^.test.$",
    "username": "test[A-Z]*",
    "useragent": "...endly-scann..",
    "remoteipmask": "192.168.0.0/24",
    "action": "drop",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-30T12:39:17.14Z",
      "lwt": "2019-08-30T12:39:17.14Z"
    }
  }
]

Obtaining 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/master/borderrules/9a7a73b7-016c-cd10-9ca9-50e54938780c HTTP/1.1

Response

Field Description: borderrule entity

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

{
  "id": "9a7a73b7-016c-cd10-9ca9-50e54938780c",
  "enabled": 1,
  "priority": 91,
  "site": "*",
  "service": "sip",
  "domain": "docs[.]rootdomain[.]ru",
  "username": "",
  "useragent": "",
  "remoteipmask": "0.0.0.0/0",
  "action": "allow",
  "opts": {
    "title": "",
    "comment": ""
  },
  "ext": {
    "ct": "2019-08-26T08:35:13.70Z",
    "lwt": "2019-08-26T08:35:13.70Z"
  }
}

Changing the rule data

Fields prohibited for modification: id

Request

Field Description: borderrule entity

Request example
PATCH /rest/v1/master/borderrules/9a7a73b7-016c-cd10-9ca9-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

borderrule entity

Response

Field Description: borderrule entity

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

{
  "id": "9a7a73b7-016c-cd10-9ca9-50e54938780c",
  "enabled": 1,
  "priority": 91,
  "site": "",
  "service": "sip",
  "domain": "docs[.]rootdomain[.]ru",
  "username": "",
  "useragent": "friendly-scanner.",
  "remoteipmask": "0.0.0.0/0",
  "action": "allow",
  "opts": {
    "title": "",
    "comment": ""
  },
  "ext": {
    "ct": "2019-08-26T08:35:13.70Z",
    "lwt": "2019-09-10T15:20:51.48Z"
  }
}

Deleting a rule

Request

Request example
DELETE /rest/v1/master/borderrules/9a7a73b7-016c-cd10-9ca9-50e54938780c HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for a 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/master/borderrules HTTP/1.1
Content-Type: application/json; charset=utf-8

"9a7a73b7-016c-cd10-9ca9-50e54938780c"

Response

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

[
  "9a7a73b7-016c-cd10-9ca9-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"
}