Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Протестировать методы API можно на странице интерактивного обозревателя API и без написания кода
Некоторые ресурсы, описанные на странице, по умолчанию могут быть не доступны из-за типа приложения (см. Создание и авторизация приложений)

Данный ресурс предназначен для получения помесячной(время UTC) статистики записей разговоров клиента.

Описание структур данных

Expand
titleРазвенуть

Имя

Тип

Описание

year_month

string

Ключ, представляющий месяц и год в формате "YYYY-MM".

call_records_size

long

Количество записей звонков за указанный месяц.

call_records_count

long

Общий размер всех записей звонков за указанный месяц в байтах.

Пример

Получим информацию о записях разговоров клиента. Для этого необходимо отправить следующий запрос:

Tabs
data[{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"В разделе "},{"type":"text","text":"authentication","marks":[{"type":"strong"}]},{"type":"text","text":" в поля "},{"type":"text","text":"client_id","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"client_secret","marks":[{"type":"strong"}]},{"type":"text","text":"  необходимо ввести полученные при регистрации приложения значения "},{"type":"text","text":"Application_ID","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"Application_Secret","marks":[{"type":"strong"}]},{"type":"text","text":", затем нажать на кнопку \""},{"type":"text","text":"Try it out!","marks":[{"type":"strong"}]},{"type":"text","text":"\". Если данные приложения верны, в ответ вернётся токен доступа ("},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":"). Полученный токен доступа следует ввести в поле \""},{"type":"text","text":"Access Token Field","marks":[{"type":"strong"}]},{"type":"text","text":"\" вверху страницы и сохранить его нажатием кнопки \""},{"type":"text","text":"Set Token","marks":[{"type":"strong"}]},{"type":"text","text":"\"."}]},{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"GET"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/records_stats/?end_datetime=2024-12"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[]}]}]}]},{"type":"paragraph","content":[]}]},"id":"07f34935-2e1d-48cd-8064-156fcf711184","label":"Интерактивный обозреватель API","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов с помощью программы cURL установим значения переменных "},{"type":"text","text":"url ","marks":[{"type":"strong"}]},{"type":"text","text":"и "},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":":"}]},{"type":"paragraph","content":[{"type":"text","text":"export url=\"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"export access_token=\"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"paragraph","content":[{"type":"text","text":"Отправим запрос:"}]},{"type":"codeBlock","attrs":{},"content":[{"type":"text","text":"curl \\ -H \"Authorization: Bearer ${access_token}\" \\ \n-X GET ${url}/client/@me/records_stats/?end_datetime=2024-12"}]}]},"id":"9704813e-bbed-49a9-9445-3ef487cddc91","label":"Программа cURL","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов на языке Python установим значения переменных URL и ACCESS_TOKEN:"}]},{"type":"paragraph","content":[{"type":"text","text":"URL = \"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"ACCESS_TOKEN = \"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"codeBlock","attrs":{},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests \n\nurl = f\"{URL}/client/@me/records_stats/?end_datetime=2024-12\" \nheaders = {\n'Authorization':f'Bearer {ACCESS_TOKEN}'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"}]}]},"id":"4c0d4dcd-d773-4bcf-8f12-c9101e8c613f","label":"На языке Python3","type":"tab"}]
tabsConfiguration{"position":"top"}
[{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"В разделе "},{"type":"text","text":"authentication","marks":[{"type":"strong"}]},{"type":"text","text":" в поля "},{"type":"text","text":"client_id","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"client_secret","marks":[{"type":"strong"}]},{"type":"text","text":"  необходимо ввести полученные при регистрации приложения значения "},{"type":"text","text":"Application_ID","marks":[{"type":"strong"}]},{"type":"text","text":" и "},{"type":"text","text":"Application_Secret","marks":[{"type":"strong"}]},{"type":"text","text":", затем нажать на кнопку \""},{"type":"text","text":"Try it out!","marks":[{"type":"strong"}]},{"type":"text","text":"\". Если данные приложения верны, в ответ вернётся токен доступа ("},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":"). Полученный токен доступа следует ввести в поле \""},{"type":"text","text":"Access Token Field","marks":[{"type":"strong"}]},{"type":"text","text":"\" вверху страницы и сохранить его нажатием кнопки \""},{"type":"text","text":"Set Token","marks":[{"type":"strong"}]},{"type":"text","text":"\"."}]},{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"метод","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"GET"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/records_stats/?end_datetime=2024-12"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[]}]}]}]},{"type":"paragraph","content":[]}]},"id":"07f34935-2e1d-48cd-8064-156fcf711184","label":"Интерактивный обозреватель API","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов с помощью программы cURL установим значения переменных "},{"type":"text","text":"url ","marks":[{"type":"strong"}]},{"type":"text","text":"и "},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":":"}]},{"type":"paragraph","content":[{"type":"text","text":"export url=\"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"export access_token=\"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"paragraph","content":[{"type":"text","text":"Отправим запрос:"}]},{"type":"codeBlock","attrs":{},"content":[{"type":"text","text":"curl \\ -H \"Authorization: Bearer ${access_token}\" \\ \n-X GET ${url}/client/@me/records_stats/?end_datetime=2024-12"}]}]},"id":"9704813e-bbed-49a9-9445-3ef487cddc91","label":"Программа cURL","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Для отправки запросов на языке Python установим значения переменных URL и ACCESS_TOKEN:"}]},{"type":"paragraph","content":[{"type":"text","text":"URL = \"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(где hostname — hostname API-сервера провайдера IP-телефонии),"}]},{"type":"paragraph","content":[{"type":"text","text":"ACCESS_TOKEN = \"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(полученный токен доступа)."}]},{"type":"codeBlock","attrs":{},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests \n\nurl = f\"{URL}/client/@me/records_stats/?end_datetime=2024-12\" \nheaders = {\n'Authorization':f'Bearer {ACCESS_TOKEN}'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers)\n\nprint(response.text)"}]}]},"id":"4c0d4dcd-d773-4bcf-8f12-c9101e8c613f","label":"На языке Python3","type":"tab"}]
Expand
titleОтвет системы:
Code Block
[
  {
    "year_month": "2024-05",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-06",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-07",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-08",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-09",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-10",
    "call_records_count": 3,
    "call_records_size": 925040
  },
  {
    "year_month": "2024-11",
    "call_records_count": 0,
    "call_records_size": 0
  },
  {
    "year_month": "2024-12",
    "call_records_count": 0,
    "call_records_size": 0
  }
]

Ресурсы раздела "Клиент"

Expand
titleGET /client/{client_id}/records_stats/

GET /client/{client_id}/records_stats/

Получить статистику записей разговоров клиента помесячно.

Параметры URL

Имя

Тип

Пример

Обязательный

client_id

string

3609

да

end_datetime

string

2024-06-05 23:59:59

2024-06-05

2024-06

нет

Поля ответа

Имя

Тип

year_month

string

call_records_count

long

call_records_size

long