| версия от 2023-02-13 |
Группа методов позволяет управлять направлениями, доступными для вызовов.
Адрес: https://restapi.plusofon.ru
GET api/v1/direction
Метод позволяет получить список всех разрешённых направлений вызовов для текущего личного кабинета.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/direction" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}"
const url = new URL(
"https://restapi.plusofon.ru/api/v1/direction"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/direction',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/direction'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается список направлений:
"directions" |
object | объект с направлениями |
<код направления> |
object | объект со свойствами направления |
"code" |
string | телефонный код направления |
"name" |
string | название направления |
"english_name" |
string | название направления (англ.) |
{
"directions": {
"36": {
"code": "36",
"name": "Венгрия",
"english_name": "Hungary"
},
"58": {
"code": "58",
"name": "Венесуэла",
"english_name": "Venezuela"
}
},
"success": true
}
PUT api/v1/direction
Метод позволяет добавить направление в перечень разрешённых для текущего личного кабинета.
Параметры Body
"direction_ids" |
array | массив ИД направлений (см. "id" в ответе на запрос получения всех направлений) |
curl -X PUT \
"https://restapi.plusofon.ru/api/v1/direction" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"direction_ids":[]}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/direction"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"direction_ids": []
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://restapi.plusofon.ru/api/v1/direction',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'direction_ids' => [],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/direction'
payload = {
"direction_ids": []
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success" |
bool | признак успешно выполненного запроса |
"message" |
string | сообщение об ошибке |
Направления успешно открыты:
{
"success": true
}
DELETE api/v1/direction
Метод позволяет удалить направление из перечня разрешённых для текущего личного кабинета.
Параметры Body
"codes" |
array | массив телефонных кодов направлений (см. "code" в ответе на запрос получения открытых направлений) |
curl -X DELETE \
"https://restapi.plusofon.ru/api/v1/direction" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"codes":[]}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/direction"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"codes": []
}
fetch(url, {
method: "DELETE",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://restapi.plusofon.ru/api/v1/direction',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'codes' => [],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/direction'
payload = {
"codes": []
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('DELETE', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success" |
bool | признак успешно выполненного запроса |
"message" |
string | сообщение об ошибке |
Направления успешно удалены:
{
"success": true
}
GET api/v1/directions
Метод позволяет получить список всех существующих направлений вызовов.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/directions" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}"
const url = new URL(
"https://restapi.plusofon.ru/api/v1/directions"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/directions',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/directions'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается список направлений:
"directions" |
array | массив с направлениями |
"id" |
string | объект со свойствами направления |
"name" |
string | название направления |
"english_name" |
string | название направления (англ.) |
"code" |
integer | телефонный код направления |
{
"directions": [
{
"id": "1",
"name": "Австралийские внеш. террит-и",
"english_name": "Australian External Territorie",
"code": 672
},
{
"id": "2",
"name": "Австралия",
"english_name": "Australia",
"code": 61
},
...
],
"success": true
}