версия от 2023-02-13 |
Группа методов позволяет подключать и отключать телефонные номера, а также управлять переадресациями этих номеров.
Адрес: https://restapi.plusofon.ru
GET
api/v1/number
Метод позволяет получить список всех номеров, подключенных в текущем личном кабинете.
Body
"phone_type"
string"abc"
— городской номер
"def"
— мобильный номер
"800"
— номер 8-800
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"phone_type":"nihil"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"phone_type": "nihil"
}
fetch(url, {
method: "GET",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'phone_type' => 'nihil',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number'
payload = {
"phone_type": "nihil"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()
В ответе возвращается массив "data"
:
"id"
ИД подключенного номера
"number"
номер в международном формате
"phone_type"
тип номера
"abc"
— городской номер
"def"
— мобильный номер
"800"
— номер 8-800
"owner_type"
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"period_price"
абонентская плата
"buy_price"
стоимость подключения
"black_list"
ИД подключенного чёрного списка
"aon_for_sips"
массив SIP-аккаунтов, для которых номер установлен в качестве АОНа
/ "id"
ИД SIP-аккаунта
/ "name"
название SIP-аккаунта
"following"
объект с параметрами переадресации номера
/ "name"
имя сущности
/ "cli_type"
режим показа АОНа
"integration_following"
объект с параметрами переадресации номера для интеграции
/ "host"
адрес хоста интеграции
/ "type"
тип интеграции
/ "cli_type"
режим показа АОНа
{
"current_page": 1,
"data": [
{
"id": 15,
"number": "79309993750",
"phone_type": "def",
"owner_type": "business",
"period_price": 99,
"buy_price": 99,
"black_list": null,
"aon_for_sips": [],
"following": {
"name": "Sip аккаунт test@plusofontest.ru",
"cli_type": "Номер и имя звонящего"
},
"integration_following": {
"host": "test.amocrm.ru",
"type": "amo",
"cli_type": "Переадресующий номер"
}
},
{
"id": 17,
"number": "74951334527",
"phone_type": "abc",
"owner_type": "personal",
"period_price": 150,
"buy_price": 1,
"black_list": null,
"aon_for_sips": [
{
"id": 73,
"name": "test@plusofontest.ru"
}
],
"following": null,
"integration_following": null
}
],
"first_page_url": "http:\/\/localhost\/api\/v1\/number?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http:\/\/localhost\/api\/v1\/number?page=1",
"next_page_url": null,
"path": "http:\/\/localhost\/api\/v1\/number",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2,
"success": true
}
GET
api/v1/number/sms
Метод позволяет получить список всех номеров с подключенной услугой обмена SMS-сообщениями.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/sms" \
-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/number/sms"
);
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/number/sms',
[
'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/number/sms'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается массив "data"
:
"id"
ИД номера
"number"
номер в международном формате
"phone_type"
тип номера
"def"
— мобильный номер"owner_type"
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"sms_packet"
объект со свойствами подключенного пакета SMS
/ "packet"
ИД пакета
/ "packet_name"
название пакета
/ "sms_amount"
квота пакета
/ "price"
абонентская плата за пакет
/ "sms_remaining"
остаток квоты
{
"current_page": 1,
"data": [
{
"id": 22,
"number": "79309992501",
"phone_type": "def",
"owner_type": "personal",
"sms_packet": {
"packet": "8460040d-374c-a7d8-abbe-6241614add81",
"packet_name": "Пакет СМС 500",
"sms_amount": 500,
"price": "300.00",
"sms_remaining": 500
}
}
],
"first_page_url": "http:\/\/localhost\/api\/v1\/number\/sms?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http:\/\/localhost\/api\/v1\/number\/sms?page=1",
"next_page_url": null,
"path": "http:\/\/localhost\/api\/v1\/number\/sms",
"per_page": 15,
"prev_page_url": null,
"to": 1,
"total": 1,
"success": true
}
DELETE
api/v1/number/{number_id}
Метод позволяет удалить телефонный номер, подключенный в текущем личном кабинете.
Path
"number_id"
string"id"
в ответе на запрос получения списка номеров)curl -X DELETE \
"https://restapi.plusofon.ru/api/v1/number/31" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"pin":"quo"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/31"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"pin": "quo"
}
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/number/31',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'pin' => 'quo',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/31'
payload = {
"pin": "quo"
}
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"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Номер успешно удалён:
{
"success": true
}
POST
api/v1/number/follow
Метод позволяет настроить переадресацию с подключенного номера.
Body
"type"
string
* код типа переадресации (см. "type"
в ответе на запрос получения типов переадресации)
"type_default"
string
только для типов "bitrix"
и "amo"
— код типа переадресации по умолчанию (см. "type"
в ответе на запрос получения типов переадресации)
"numbers"
array
* массив ИД номеров, для которых устанавливается переадресация (см. "id"
в ответе на запрос получения списка номеров)
"sip_id"
integer
только для типа "sip"
— ИД SIP-аккаунта, на который устанавливается переадресация (см. "id"
в ответе на запрос получения списка SIP-аккаунтов)
"destination_number"
string
только для типа "number"
— телефонный номер, на который устанавливается переадресация
"group_id"
integer
только для типа "group"
— ИД группы, на которую устанавливается переадресация (см. "id"
в ответе на запрос получения списка групп)
"scenario_id"
integer
только для типа "scenario"
— ИД сценария, на который устанавливается переадресация (см. "id"
в ответе на запрос получения списка сценариев)
"call_queue_id"
integer
только для типа "call_queue"
— ИД очереди вызовов, на которую устанавливается переадресация (см. "id"
в ответе на запрос получения списка очередей)
"destination_uri"
string
только для типа "sip_uri"
— адрес SIP URI, на который устанавливается переадресация
"host"
string
только для типов "bitrix"
и "amo"
— адрес хоста интеграции
"cli_type"
string
* для всех типов, кроме "empty"
— код типа показа АОНа при переадресации
"Y"
— отображать в АОНе номер звонящего
"N"
— отображать в АОНе переадресующий номер
"cli_type_default"
string"bitrix"
и "amo"
— код типа показа АОНа при переадресации"Y"
— отображать в АОНе номер звонящего
"N"
— отображать в АОНе переадресующий номер
curl -X POST \
"https://restapi.plusofon.ru/api/v1/number/follow" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"type":"eligendi","type_default":"tempora","numbers":[6],"sip_id":7,"destination_number":"voluptatem","group_id":16,"scenario_id":5,"call_queue_id":4,"destination_uri":"molestias","host":"quas","cli_type":"ut","cli_type_default":"iure"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/follow"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"type": "eligendi",
"type_default": "tempora",
"numbers": [
6
],
"sip_id": 7,
"destination_number": "voluptatem",
"group_id": 16,
"scenario_id": 5,
"call_queue_id": 4,
"destination_uri": "molestias",
"host": "quas",
"cli_type": "ut",
"cli_type_default": "iure"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/number/follow',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'type' => 'eligendi',
'type_default' => 'tempora',
'numbers' => [
6,
],
'sip_id' => 7,
'destination_number' => 'voluptatem',
'group_id' => 16,
'scenario_id' => 5,
'call_queue_id' => 4,
'destination_uri' => 'molestias',
'host' => 'quas',
'cli_type' => 'ut',
'cli_type_default' => 'iure',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/follow'
payload = {
"type": "eligendi",
"type_default": "tempora",
"numbers": [
6
],
"sip_id": 7,
"destination_number": "voluptatem",
"group_id": 16,
"scenario_id": 5,
"call_queue_id": 4,
"destination_uri": "molestias",
"host": "quas",
"cli_type": "ut",
"cli_type_default": "iure"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Переадресация успешно настроена:
{
"success": true
}
PATCH
api/v1/number/contact-list
Метод позволяет назначить чёрный список для подключенного номера.
Body
"contact_list_id"
integer
* ИД списка контактов (см. "id"
в ответе на запрос получения всех списков)
numbers
array
* массив ИД номеров, на которые назначается список (см. "id"
в ответе на запрос получения списка номеров)
Для отключения чёрного списка необходимо передать запрос без указания "contact_list_id"
.
curl -X PATCH \
"https://restapi.plusofon.ru/api/v1/number/contact-list" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"contact_list_id":15,"numbers":[22]}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/contact-list"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"contact_list_id": 15,
"numbers": [
22
]
}
fetch(url, {
method: "PATCH",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->patch(
'https://restapi.plusofon.ru/api/v1/number/contact-list',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'contact_list_id' => 15,
'numbers' => [
22,
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/contact-list'
payload = {
"contact_list_id": 15,
"numbers": [
22
]
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('PATCH', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Список успешно назначен:
{
"success": true
}
GET
api/v1/number/follow-types
Метод позволяет получить список всех доступных типов переадресации.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/follow-types" \
-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/number/follow-types"
);
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/number/follow-types',
[
'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/number/follow-types'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается массив "follow_types"
:
"type"
код переадресации
"title"
название переадресации
"owner_types"
массив режимов аренды, для которых доступна переадресация
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
{
"follow_types": [
{
"type": "sip",
"title": "Sip аккаунт",
"owner_types": [
"personal",
"business"
]
},
{
"type": "number",
"title": "Номер",
"owner_types": [
"personal",
"business"
]
},
{
"type": "group",
"title": "Группа",
"owner_types": [
"business"
]
},
{
"type": "scenario",
"title": "Сценарий",
"owner_types": [
"business"
]
}
]
}
GET
api/v1/number/cli-types
Метод позволяет получить список всех доступных типов работы определителя номера (АОН) для входящих вызовов.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/cli-types" \
-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/number/cli-types"
);
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/number/cli-types',
[
'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/number/cli-types'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается массив "cli_types"
:
"type"
код типа АОНа
"title"
название типа АОНа
{
"cli_types": [
{
"type": "Y",
"title": "Номер и имя звонящего"
},
{
"type": "N",
"title": "Переадресующий номер"
}
]
}
GET
api/v1/number/search
Метод позволяет найти на витрине подходящий номер для подключения.
Body
"owner_type"
string"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"region"
integer
ИД региона (см. "id"
в ответе на запрос получения списка кодов)
"city_code"
integer
код города (см. "code"
в ответе на запрос получения списка кодов)
"phone_number"
string
маска поиска номера телефона (без кода города)
можно использовать поиск по маске номера, используя спецсимволы ?
(замена одного любого символа) и *
(замена последовательности любых символов)
"number_type"
string
категория красивости номера
"0"
— «простой» номер
"5"
— «бронзовый» номер
"1"
— «серебряный» номер
"2"
— «золотой» номер
"3"
— «платиновый» номер
"4"
— «эксклюзивный» номер
"phone_type"
string"abc"
— городской номер
"def"
— мобильный номер
"800"
— номер 8-800
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/search" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"owner_type":"business","region":4,"city_code":4,"phone_number":"error","number_type":"0","phone_type":"abc"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/search"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"owner_type": "business",
"region": 4,
"city_code": 4,
"phone_number": "error",
"number_type": "0",
"phone_type": "abc"
}
fetch(url, {
method: "GET",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number/search',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'owner_type' => 'business',
'region' => 4,
'city_code' => 4,
'phone_number' => 'error',
'number_type' => '0',
'phone_type' => 'abc',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/search'
payload = {
"owner_type": "business",
"region": 4,
"city_code": 4,
"phone_number": "error",
"number_type": "0",
"phone_type": "abc"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()
"number_type"
"0"
— «простой» номер
"5"
— «бронзовый» номер
"1"
— «серебряный» номер
"2"
— «золотой» номер
"3"
— «платиновый» номер
"4"
— «эксклюзивный» номер
"number"
номер телефона с кодом города
"buy_price"
стоимость подключения
"period_price"
абонентская плата
"owner_type"
режим работы номера
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"phone_type"
"abc"
— городской номер
"def"
— мобильный номер
"800"
— номер 8-800
Найдены номера по выбранным критериям:
{
"current_page": 100,
"data": [
{
"number_type": 0,
"number": "4951332210",
"buy_price": "99.00",
"period_price": "99.00",
"owner_type": "personal",
"phone_type": "abc"
},
{
"number_type": 0,
"number": "4951332211",
"buy_price": "99.00",
"period_price": "99.00",
"owner_type": "personal",
"phone_type": "abc"
},
...
],
"first_page_url": "http:\/\/localhost\/api\/v1\/number\/search?page=1",
"from": 1981,
"next_page_url": "http:\/\/localhost\/api\/v1\/number\/search?page=101",
"path": "http:\/\/localhost\/api\/v1\/number\/search",
"per_page": 20,
"prev_page_url": "http:\/\/localhost\/api\/v1\/number\/search?page=99",
"to": 2000,
"success": true
}
GET
api/v1/number/code-regions
Метод позволяет получить список всех доступных кодов регионов.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/code-regions" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"type":"rerum"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/code-regions"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"type": "rerum"
}
fetch(url, {
method: "GET",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number/code-regions',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'type' => 'rerum',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/code-regions'
payload = {
"type": "rerum"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()
В ответе возвращается массив "code_regions"
:
"id"
ИД региона
"title"
название региона
"code"
массив телефонных кодов региона
{
"code_regions": [
{
"id": 65,
"title": "Улан-Удэ (301)",
"code": [
"301"
]
},
{
"id": 23,
"title": "Ижевск(341)",
"code": [
"341"
]
}
],
"success": true
}
POST
api/v1/number/reserve
Метод позволяет зарезервировать (но не подключить) телефонный номер.
Body
"number"
integer
* номер телефона с кодом города (см. "number"
в ответе на запрос поиска номеров)
"owner_type"
string
* режим работы номера
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"short"
integer"1"
— резерв на один часcurl -X POST \
"https://restapi.plusofon.ru/api/v1/number/reserve" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"number":11,"owner_type":"sit","short":17}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/reserve"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"number": 11,
"owner_type": "sit",
"short": 17
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/number/reserve',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'number' => 11,
'owner_type' => 'sit',
'short' => 17,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/reserve'
payload = {
"number": 11,
"owner_type": "sit",
"short": 17
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Номер успешно зарезервирован:
{
"success": true
}
DELETE
api/v1/number/reserve/{reserve_number_id}
Метод позволяет отменить резервирование номера.
Path
"reserve_number_id"
string"id"
в ответе на запрос получения списка зарезервированных номеров)curl -X DELETE \
"https://restapi.plusofon.ru/api/v1/number/reserve/42" \
-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/number/reserve/42"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://restapi.plusofon.ru/api/v1/number/reserve/42',
[
'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/number/reserve/42'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
В ответе может возвращаться:
"success"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Номер успешно удалён из резерва:
{
"success": true
}
GET
api/v1/number/reserve
Метод позволяет получить список всех зарезервированных (но не подключенных) номеров текущего личного кабинета.
Не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/number/reserve" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"phone_type":"natus"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/reserve"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"phone_type": "natus"
}
fetch(url, {
method: "GET",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://restapi.plusofon.ru/api/v1/number/reserve',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'phone_type' => 'natus',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/reserve'
payload = {
"phone_type": "natus"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()
В ответе возвращается массив "data"
:
"id"
ИД подключенного номера
"number"
номер в международном формате
"reserved_untill"
дата и время окончания резерва
"phone_type"
тип номера
"abc"
— городской номер
"def"
— мобильный номер
"800"
— номер 8-800
"owner_type"
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
"buy_price"
стоимость подключения
"period_price"
абонентская плата
{
"current_page": 1,
"data": [
{
"id": 5,
"number": "74951919036",
"reserved_untill": "2022-06-08 15:42:21",
"phone_type": "abc",
"owner_type": "personal",
"buy_price": 99,
"period_price": 99
},
{
"id": 6,
"number": "74951919034",
"reserved_untill": "2022-06-08 15:43:54",
"phone_type": "abc",
"owner_type": "business",
"buy_price": 790,
"period_price": 150
}
],
"first_page_url": "http:\/\/localhost\/api\/v1\/number\/reserve?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http:\/\/localhost\/api\/v1\/number\/reserve?page=1",
"next_page_url": null,
"path": "http:\/\/localhost\/api\/v1\/number\/reserve",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2,
"success": true
}
POST
api/v1/number/buy
Метод позволяет подключить телефонные номера, которые были зарезервированы.
Body
"numbers"
array
* массив подключаемых номеров (см. "number"
в ответе на запрос поиска номеров)
"owner_type"
string
* режим работы номера
"business"
— многоканальный, номер для использования в логике АТС
"personal"
— одноканальный, номер для персонального использования одним пользователем
curl -X POST \
"https://restapi.plusofon.ru/api/v1/number/buy" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"numbers":[],"owner_type":"minus"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/number/buy"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"numbers": [],
"owner_type": "minus"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/number/buy',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'numbers' => [],
'owner_type' => 'minus',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/number/buy'
payload = {
"numbers": [],
"owner_type": "minus"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
"success"
признак успешно выполненного запроса
"message"
сообщение об ошибке
Номера успешно подключены:
{
"success": true
}