[{"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":"метод"}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"ресурс"}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"данные"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"PUT"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/call_control_group/"}]},{"type":"paragraph","content":[]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"{"},{"type":"hardBreak"},{"type":"text","text":"\"allow_all\": false,"},{"type":"hardBreak"},{"type":"text","text":"\"pickup_all\": true,"},{"type":"hardBreak"},{"type":"text","text":"\"groups\":"},{"type":"hardBreak"},{"type":"text","text":" {"},{"type":"hardBreak"},{"type":"text","text":" \"support\": [\"100\", \"101\"],"},{"type":"hardBreak"},{"type":"text","text":" \"sales\": [\"102\", \"101\"],"},{"type":"hardBreak"},{"type":"text","text":" \"hr\": [\"100\", \"101\", \"103\"]"},{"type":"hardBreak"},{"type":"text","text":" },"},{"type":"hardBreak"},{"type":"text","text":"\"pickup_share_groups\": [\"support\", \"sales\"],"}]},{"type":"paragraph","content":[{"type":"text","text":"\"phone_replace_groups\": [\"support\"],"},{"type":"hardBreak"},{"type":"text","text":"\"eavesdrop_100\": [\"support\"],"},{"type":"hardBreak"},{"type":"text","text":"\"whisper_101\": [\"sales\", \"hr\"]"},{"type":"hardBreak"},{"type":"text","text":"}"}]}]}]}]},{"type":"paragraph","content":[]}]},"id":"1ab97921-e7ca-452f-965a-4a763b57f8d3","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":{"language":"shell"},"content":[{"type":"text","text":"curl \\\r\n-H \"Authorization: Bearer ${access_token}\" \\\r\n-H \"Content-Type: application/json\" \\\r\n-d '{\r\n \"allow_all\": false,\n \"pickup_all\": true,\n \"groups\": {\n \"support\": [\"100\", \"101\"],\n \"sales\": [\"102\", \"101\"],\n \"hr\": [\"100\", \"101\", \"103\"]\n },\n \"pickup_share_groups\": [\n \"support\",\n \"sales\"\n ],\n \"eavesdrop_100\": [\n \"support\"\n ],\n \"whisper_101\": [\n \"sales\",\n \"hr\"\n ]\n}' \\\r\n-X PUT ${url}/client/@me/call_control_group/"}]}]},"id":"59f02ace-6798-4ee6-8ed3-7c878969f35b","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":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\r\n\r\nimport requests\r\n\r\nurl = f'{URL}/client/@me/call_control_group/'\r\nheaders = {\r\n 'Authorization': f'Bearer {ACCESS_TOKEN}',\r\n 'Content-Type': 'application/json'\r\n}\r\ndata = '''{\r\n \"allow_all\": false,\n \"pickup_all\": true,\n \"groups\": {\n \"support\": [\"100\", \"101\"],\n \"sales\": [\"102\", \"101\"],\n \"hr\": [\"100\", \"101\", \"103\"]\n },\n \"pickup_share_groups\": [\n \"support\",\n \"sales\"\n ],\n \"eavesdrop_100\": [\n \"support\"\n ],\n \"whisper_101\": [\n \"sales\",\n \"hr\"\n ]\n}'''\r\nresponse = requests.put(url, headers=headers, data=data)\r\nprint(response.text)"}]}]},"id":"fe3b5416-5aa2-4f51-b4b2-2d3f3e4d8438","label":"На языке Python3 ","type":"tab"}] |