[{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"sectionIn enter the "},{"type":"text","text":"Application_IDauthentication ","marks":[{"type":"strong"}]},{"type":"text","text":"section enter andthe "},{"type":"text","text":"Application_SecretID","marks":[{"type":"strong"}]},{"type":"text","text":" values obtained during the application registration in the and "},{"type":"text","text":"clientApplication_id Secret","marks":[{"type":"strong"}]},{"type":"text","text":"and "},{" values obtained during the application registration in the "},{"type":"text","text":"client_secretid ","marks":[{"type":"strong"}]},{"type":"text","text":" fields, then click on the \"and "},{"type":"text","text":"Try it out!client_secret","marks":[{"type":"strong"}]},{"type":"text","text":"\" button.fields, Ifthen theclick applicationon data is correct, an access token (the \""},{"type":"text","text":"access_tokenTry it out!","marks":[{"type":"strong"}]},{"type":"text","text":"\") button. willIf bethe returnedapplication indata response.is Thecorrect, receivedan access token should be entered into the \"("},{"type":"text","text":"Access Token Fieldaccess_token","marks":[{"type":"strong"}]},{"type":"text","text":"\") atwill thebe topreturned ofin theresponse. pageThe and saved by clickingreceived access token should be entered into the \""},{"type":"text","text":"SetAccess Token Field","marks":[{"type":"strong"}]},{"type":"text","text":"\" button."}] at the top of the page and saved by clicking the \""},{"type":"tabletext","attrstext":{"isNumberColumnEnabledSet Token":false,"layoutmarks":"default"},"content":[{"type":"tableRowstrong"}]},{"type":"text","text":"\" button."}]},{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Method","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Resourse","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Data","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"PUT"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/extension/54/phone/"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"{"},{"type":"hardBreak"},{"type":"text","text":"\"external_number\": \"+79876543210\""},{"type":"hardBreak"},{"type":"text","text":"}"}]}]}]}]}]},"id":"2b8b1b4c-8a0b-4659-8082-6a2a94082fdf","label":"Interactive API Browser","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"To send requests using the cURL program, set the values of the "},{"type":"text","text":"url ","marks":[{"type":"strong"}]},{"type":"text","text":"and "},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":" variables:"}]},{"type":"paragraph","content":[{"type":"text","text":"export url=\"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(where the hostname — is the hostname of the API-server provider of IP-telephony),"}]},{"type":"paragraph","content":[{"type":"text","text":"export access_token=\"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(the received access token)."}]},{"type":"paragraph","content":[{"type":"text","text":"Send a request:"}]},{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\n-H \"Authorization: Bearer ${access_token}\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\"external_number\": \"+79876543210\"} \\\n-X PUT ${url}/extension/54/phone/"}]}]},"id":"158c382f-6746-4b1e-a278-0b4b8513a8d2","label":"cURL Program","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"To send requests in Python, set the values of the variables URL and ACCESS_TOKEN:"}]},{"type":"paragraph","content":[{"type":"text","text":"URL = \"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(where the hostname — is the hostname of the API-server provider of IP-telephony),"}]},{"type":"paragraph","content":[{"type":"text","text":"ACCESS_TOKEN = \"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(the received access token)."}]},{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\nimport json\n\nurl = f'{URL}/extension/54/phone/'\nheaders = {\n 'Authorization': f'Bearer {ACCESS_TOKEN}',\n 'content-type': 'application/json'\n}\ndata = {\"external_number\": \"+79876543210\"}\nresponse = requests.put(url, headers=headers, data=json.dumps(data))\nprint(response.text)"}]}]},"id":"d9f15ec1-0458-48b7-9618-334dac8ea1bf","label":"In Python3","type":"tab"}] |