Сценарии IVR (ivrscripts)

Запросы

HTTP verb Endpoint Описание

POST

/rest/v1/uc/ivrscripts

Создание нового сценария IVR

GET

/rest/v1/uc/ivrscripts

Получение списка сценариев IVR

GET

/rest/v1/uc/ivrscripts/<id>

Получение данных сценария IVR

PATCH

/rest/v1/uc/ivrscripts/<id>

Изменение данных сценария IVR

DELETE

/rest/v1/uc/ivrscripts/<id>

Удаление сценария IVR

LOOKUP

/rest/v1/uc/ivrscripts

Поиск идентификатора сценария IVR


Создание нового сценария IVR

Запрос

Описание полей: IVR script’s entity

Пример запроса
POST /rest/v1/uc/ivrscripts HTTP/1.1
Content-Type: application/json; charset=utf-8

IVR script’s entity

Ответ

Описание полей: IVR script’s entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "88e149e4-016c-b477-0c3d-50e54938780c",
  "code": "play_test",
  "name": "PlayOut",
  "scriptdata": {
    "objects": [
      {
        "oId": 1,
        "oLeft": 32,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:22:51",
        "oLayer": 0,
        "oType": 101,
        "type": 0,
        "defineVars": 1,
        "implementedTime": 60000,
        "transfer": 2,
        "name": "Старт",
        "info": ""
      },
      {
        "oId": 2,
        "oLeft": 116,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:23:00",
        "oLayer": 0,
        "oType": 202,
        "transfer": 3,
        "name": "Ответ",
        "info": ""
      },
      {
        "oId": 3,
        "oLeft": 208,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:16",
        "oLayer": 0,
        "oType": 103,
        "timeoutMs": {
          "argType": 1,
          "varType": 2,
          "value": "700"
        },
        "transfer": 4,
        "name": "Пауза",
        "info": ""
      },
      {
        "oId": 4,
        "oLeft": 288,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:20",
        "oLayer": 0,
        "oType": 204,
        "playerId": "default",
        "mode": 0,
        "randomize": 1,
        "file": {
          "selectMode": 0,
          "localFile": "oktell_1_ny.wav"
        },
        "loop": 0,
        "clearDtmfBuffer": 1,
        "interruptSymbols": "*",
        "clearInterrupt": 1,
        "name": "Воспроизведение",
        "info": ""
      }
    ],
    "variables": [
      {
        "id": "6745e9fc-cd6c-40ab-92f2-bcf78a220b0c",
        "name": "var1",
        "type": 1,
        "location": 0
      },
      {
        "id": "ce834e56-be72-4069-9eec-fc7df61c4a75",
        "name": "result",
        "type": 2,
        "location": 0
      }
    ],
    "scriptVersion": 170105
  },
  "projectid": "00000000-0000-0000-0000-000000000000",
  "lwt": "2019-08-21T13:59:39Z",
  "opts": {
    "title": "",
    "comment": "Hello world ivrscript",
    "loglevel": 0,
    "variables": {
      "var1": 0
    }
  },
  "ext": {
    "ct": "2019-08-21T13:59:39.83Z",
    "lwt": "2019-08-21T13:59:39.83Z"
  }
}

Получение списка сценариев IVR

Запрос

Table 1. Параметры запроса
Имя Тип Описание

filter

object

Фильтр по значениям полей.

mask

str

Список полей для вывода. Доступные поля для выдачи: id, code, name, projectid, ext.lwt, ext.ct.

offset

int

Смещение в списке ресурсов, подлежащих выдаче.

limit

int

Максимальное количество ресурсов в списке.

order

array<object|str>

Порядок сортировки ресурсов в списке.

flat

bool

Преобразование в плоский вид составных полей.

Пример запроса
GET /rest/v1/uc/ivrscripts?offset=0&limit=2 HTTP/1.1

Ответ

Описание полей: IVR script’s entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "88e149e4-016c-b477-0c3d-50e54938780c",
    "code": "play_test",
    "name": "PlayOut",
    "projectid": "00000000-0000-0000-0000-000000000000",
    "ext": {
      "ct": "2019-08-21T13:59:39.83Z",
      "lwt": "2019-08-21T13:59:39.83Z"
    }
  },
  {
    "id": "95e55d64-016c-b845-7a80-50e54938780c",
    "code": "1002",
    "name": "PlayNumbers",
    "projectid": "00000000-0000-0000-0000-000000000000",
    "ext": {
      "ct": "2019-08-22T07:40:56.83Z",
      "lwt": "2019-08-22T07:40:56.83Z"
    }
  }
]

Получение данных сценария IVR

Запрос

Table 2. Параметры запроса
Имя Тип Описание

mask

str

Список полей для вывода.

flat

bool

Преобразование в плоский вид составных полей.

Пример запроса
GET /rest/v1/uc/ivrscripts/88e149e4-016c-b477-0c3d-50e54938780c HTTP/1.1

Ответ

Описание полей: IVR script’s entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "88e149e4-016c-b477-0c3d-50e54938780c",
  "code": "play_test",
  "name": "PlayOut",
  "scriptdata": {
    "objects": [
      {
        "oId": 1,
        "oLeft": 32,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:22:51",
        "oLayer": 0,
        "oType": 101,
        "type": 0,
        "defineVars": 1,
        "implementedTime": 60000,
        "transfer": 2,
        "name": "Старт",
        "info": ""
      },
      {
        "oId": 2,
        "oLeft": 116,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:23:00",
        "oLayer": 0,
        "oType": 202,
        "transfer": 3,
        "name": "Ответ",
        "info": ""
      },
      {
        "oId": 3,
        "oLeft": 208,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:16",
        "oLayer": 0,
        "oType": 103,
        "timeoutMs": {
          "argType": 1,
          "varType": 2,
          "value": "700"
        },
        "transfer": 4,
        "name": "Пауза",
        "info": ""
      },
      {
        "oId": 4,
        "oLeft": 288,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:20",
        "oLayer": 0,
        "oType": 204,
        "playerId": "default",
        "mode": 0,
        "randomize": 1,
        "file": {
          "selectMode": 0,
          "localFile": "oktell_1_ny.wav"
        },
        "loop": 0,
        "clearDtmfBuffer": 1,
        "interruptSymbols": "*",
        "clearInterrupt": 1,
        "name": "Воспроизведение",
        "info": ""
      }
    ],
    "variables": [],
    "scriptVersion": 170105
  },
  "projectid": "00000000-0000-0000-0000-000000000000",
  "lwt": "2019-08-21T13:59:39Z",
  "opts": {
    "title": "",
    "comment": "Hello world ivrscript",
    "loglevel": 0,
    "variables": {
      "var1": 0
    }
  },
  "ext": {
    "ct": "2019-08-21T13:59:39.83Z",
    "lwt": "2019-08-21T13:59:39.83Z"
  }
}

Изменение данных сценария IVR

Поля запрещенные для изменения: id

Запрос

Описание полей: IVR script’s entity

Пример запроса
PATCH /rest/v1/uc/ivrscripts/95e55d64-016c-b845-7a80-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

IVR script’s entity

Ответ

Описание полей: IVR script’s entity

Пример ответа
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "88e149e4-016c-b477-0c3d-50e54938780c",
  "code": "play_test",
  "name": "PlayOut",
  "scriptdata": {
    "objects": [
      {
        "oId": 1,
        "oLeft": 32,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:22:51",
        "oLayer": 0,
        "oType": 101,
        "type": 0,
        "defineVars": 1,
        "implementedTime": 60000,
        "transfer": 2,
        "name": "Старт",
        "info": ""
      },
      {
        "oId": 2,
        "oLeft": 116,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2017-01-30 10:23:00",
        "oLayer": 0,
        "oType": 202,
        "transfer": 3,
        "name": "Ответ",
        "info": ""
      },
      {
        "oId": 3,
        "oLeft": 208,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:16",
        "oLayer": 0,
        "oType": 103,
        "timeoutMs": {
          "argType": 1,
          "varType": 2,
          "value": "700"
        },
        "transfer": 4,
        "name": "Пауза",
        "info": ""
      },
      {
        "oId": 4,
        "oLeft": 288,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-21 16:57:20",
        "oLayer": 0,
        "oType": 204,
        "playerId": "default",
        "mode": 0,
        "randomize": 1,
        "file": {
          "selectMode": 0,
          "localFile": "oktell_1_ny.wav"
        },
        "loop": 0,
        "clearDtmfBuffer": 1,
        "interruptSymbols": "*",
        "clearInterrupt": 1,
        "transfer": 5,
        "name": "Воспроизведение",
        "info": ""
      },
      {
        "oId": 5,
        "oLeft": 304,
        "oTop": 16,
        "oWidth": 32,
        "oHeight": 32,
        "oCreationDate": "2019-08-22 10:41:28",
        "oLayer": 0,
        "oType": 201,
        "name": "Отбой",
        "info": ""
      }
    ],
    "variables": [
      {
        "id": "6745e9fc-cd6c-40ab-92f2-bcf78a220b0c",
        "name": "var1",
        "type": 1,
        "location": 0
      },
      {
        "id": "8c35152b-62b4-4986-b139-f76f0f0de878",
        "name": "asdf",
        "type": 2,
        "location": 0
      },
      {
        "id": "478731bc-7de1-435b-a51b-2dc2dc050697",
        "name": "path",
        "type": 2,
        "location": 0
      },
      {
        "id": "ce834e56-be72-4069-9eec-fc7df61c4a75",
        "name": "result",
        "type": 2,
        "location": 0
      }
    ],
    "scriptVersion": 170105
  },
  "projectid": "00000000-0000-0000-0000-000000000000",
  "lwt": "2019-09-09T12:21:04Z",
  "opts": {
    "title": "",
    "comment": "Hello world ivrscript",
    "loglevel": 0,
    "variables": {
      "var1": 123,
      "asdf": "Default value from opts"
    }
  },
  "ext": {
    "ct": "2019-08-21T13:59:39.83Z",
    "lwt": "2019-09-09T12:21:04.51Z"
  }
}

Удаление сценария IVR

Запрос

Пример запроса
DELETE /rest/v1/uc/ivrscripts/95e55d64-016c-b845-7a80-50e54938780c HTTP/1.1

Ответ

Пример ответа
HTTP/1.1 204 No Content

Поиск идентификатора сценария IVR

Производит поиск ресурса по указанному ключу, возвращает идентификатор(ы) для построения endpoint.

Ключевые поля для поиска: id, code

Запрос

Пример запроса
LOOKUP /rest/v1/uc/ivrscripts HTTP/1.1
Content-Type: application/json; charset=utf-8

"play_test"

Ответ

Пример успешного ответа
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "88e149e4-016c-b477-0c3d-50e54938780c"
]
Пример неуспешного ответа
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

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