Redirect rules (redirectrules)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/uc/redirectrules

Creating a new redirect rule

GET

/rest/v1/uc/redirectrules

Getting the list of redirect rules

GET

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

Getting data of redirect rule

PATCH

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

Modifying data of redirect rule

DELETE

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

Deleting redirect rule

LOOKUP

/rest/v1/uc/redirectrules

Searching for the identifier of redirect rule


Creating a new redirect rule

Request

Field description: redirectrule entity

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

redirectrule entity

Response

Field description: redirectrule entity

Example response
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 redirect 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 output.

limit

int

Maximum number of resources in the list.

order

array<object|str>

Sorting order of resources in the list.

flat

bool

Transformation of composite fields to flat form.

Example request
GET /rest/v1/uc/redirectrules?filter={"schedule":"non-work","enabled":1}&offset=0&limit=2 HTTP/1.1

Response

Field description: redirectrule entity

Example response
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"
    }
  }
]

Getting data of redirect rule

Request

Table 2. Request parameters
Name Type Description

mask

str

List of fields to output.

flat

bool

Transformation of composite fields to flat form.

Example request
GET /rest/v1/uc/redirectrules/df684c6d-016c-d25c-23f0-50e54938780c HTTP/1.1

Response

Field description: redirectrule entity

Example response
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"
  }
}

Modifying data of redirect rule

Fields prohibited for modification: id

Request

Field description: redirectrule entity

Example request
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

Example response
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 redirect rule

Request

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

Response

Example response
HTTP/1.1 204 No Content

Searching for the identifier of redirect rule

Searches for a resource by the specified key and returns the identifier(s) for building the endpoint.

Key fields for search: id, filter_number

Request

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

"16"

Response

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

[
  "df684c6d-016c-d25c-23f0-50e54938780c"
]
Example failed response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

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