Announce Add
از این سرویس برای افزودن آوا استفاده میشود.
#
پارامترهاتوضیحات | داده های تعریف شده | داده های نمونه | پارامترهای ضروری[**]/منطقی[*] | پارامترها |
---|---|---|---|---|
نام | - | test_sound | ** | name |
نام فایلصوتی که در پاسخ به درخواست آپلود برگردانده میشود | - | file-20200624051520-61681-announcement-wiresha- | ** | filename |
توضیحات | - | Just for test | comment |
#
نمونه خروجی درخواست{ "success": 1, "message": "Requested operation is done successfully", "data": { "name": "test_sound", "filename": "file-20200624051520-61681-announcement-wiresha_", "comment": "Just for test", "date": "1399-12-14 07:57:49", "_id": "604092fdadafcf23157cb241" }}
#
نمونه فراخوانی- PHP
- JS
- Linux
<?php
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'http://192.168.51.20/api/v3/pbx/announcements', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "name":"test_sound", "filename":"file-20200624051520-61681-announcement-wiresha_", "comment":"Just for test"}', CURLOPT_HTTPHEADER => array( 'X-APIKEY: vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG', 'Authorization: Basic dGVzdDpBYTEyMzQ1Ng==', 'Content-Type: application/json' ),));
$response = curl_exec($curl);
if (!curl_errno($curl)) { $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); echo 'response code:'.$httpcode, '<br/>';}
curl_close($curl);echo $response;
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <script> var settings = { "url": "http://192.168.51.20/api/v3/pbx/announcements", "method": "POST", "timeout": 0, "headers": { "X-APIKEY": "vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG", "Authorization": "Basic dGVzdDpBYTEyMzQ1Ng==", "Content-Type": "application/json" }, "data": JSON.stringify({ "name": "test_sound", "filename": "file-20200624051520-61681-announcement-wiresha_", "comment": "Just for test" }), };
$.ajax(settings).always(function (jqXHR) { console.log("response code: " + jqXHR.status + " " + jqXHR.statusText); console.log("response body: " + jqXHR.responseText); }); </script> </body></html>
curl --location --request POST 'http://192.168.51.20/api/v3/pbx/announcements' \--header 'X-APIKEY: vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG' \--header 'Authorization: Basic dGVzdDpBYTEyMzQ1Ng==' \--header 'Content-Type: application/json' \--data-raw '{ "name":"test_sound", "filename":"file-20200624051520-61681-announcement-wiresha_", "comment":"Just for test"}'