Forwarding rules (redirectrules)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/redirectrules

Creating a new forwarding rule

GET

/rest/v1/uc/redirectrules

Getting the list of forwarding rules

GET

/rest/v1/uc/redirectrules/<id>

Obtaining forwarding rule data

PATCH

/rest/v1/uc/redirectrules/<id>

Changing forwarding rule data

DELETE

/rest/v1/uc/redirectrules/<id>

Deleting a forwarding rule

LOOKUP

/rest/v1/uc/redirectrules

Searching for the forwarding rule identifier


Creating a new forwarding rule

Request

Field Description: redirectrule entity

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

redirectrule entity

Response

Field Description: redirectrule entity

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

{
  "id": "df684c6d-016c-d25c-23f0-50e54938780c",
  "type": "busy",
  "filter_number": "16",
  "filter_fromnumber": "*",
  "tran_number": "15",
  "priority": 100,
  "enabled": 1,
  "schedule": "all",
  "periods": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-27T09:15:49.61Z",
    "lwt": "2019-08-27T09:15:49.61Z"
  }
}

Getting the list of forwarding 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, type, filter_number, tran_number, priority, enabled, schedule, 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/redirectrules?filter={"schedule":"non-work","enabled":1}&offset=0&limit=2 HTTP/1.1

Response

Field Description: redirectrule entity

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

[
  {
    "id": "90082f72-016c-d268-a209-50e54938780c",
    "type": "busy",
    "filter_number": "2XX",
    "filter_fromnumber": "",
    "tran_number": "205",
    "priority": 55,
    "enabled": 1,
    "schedule": "non-work",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-27T09:29:28.32Z",
      "lwt": "2019-08-27T09:29:28.32Z"
    }
  },
  {
    "id": "c4e35f4b-016c-d267-ebfa-50e54938780c",
    "type": "absolute",
    "filter_number": "2XX",
    "filter_fromnumber": "",
    "tran_number": "203",
    "priority": 99,
    "enabled": 1,
    "schedule": "non-work",
    "opts": {
      "title": ""
    },
    "ext": {
      "ct": "2019-08-27T09:28:41.72Z",
      "lwt": "2019-08-27T09:28:41.72Z"
    }
  }
]

Obtaining forwarding 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/redirectrules/df684c6d-016c-d25c-23f0-50e54938780c HTTP/1.1

Response

Field Description: redirectrule entity

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

{
  "id": "df684c6d-016c-d25c-23f0-50e54938780c",
  "type": "busy",
  "filter_number": "16",
  "filter_fromnumber": "*",
  "tran_number": "15",
  "priority": 100,
  "enabled": 1,
  "schedule": "all",
  "periods": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-27T09:15:49.61Z",
    "lwt": "2019-08-27T09:15:49.61Z"
  }
}

Changing forwarding rule data

Fields prohibited for modification: id

Request

Field Description: redirectrule entity

Request example
PATCH /rest/v1/uc/redirectrules/df684c6d-016c-d25c-23f0-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

redirectrule entity

Response

Field Description: redirectrule entity

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

{
  "id": "df684c6d-016c-d25c-23f0-50e54938780c",
  "type": "absolute",
  "filter_number": "16",
  "filter_fromnumber": "*",
  "tran_number": "15",
  "priority": 100,
  "enabled": 1,
  "schedule": "custom",
  "periods": [
    {
      "daystart": 6,
      "timestart": 1080,
      "daystop": 7,
      "timestart": 1440
    },
    {
      "daystart": 1,
      "timestart": 0,
      "daystop": 1,
      "timestart": 480
    }
  ],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2019-08-27T09:15:49.61Z",
    "lwt": "2019-09-09T08:47:39.22Z"
  }
}

Deleting a forwarding rule

Request

Request example
DELETE /rest/v1/uc/redirectrules/df684c6d-016c-d25c-23f0-50e54938780c HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for the forwarding rule identifier

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

Key fields to search for: id, filter_number

Request

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

"16"

Response

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

[
  "df684c6d-016c-d25c-23f0-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"
}