Группа методов позволяет управлять доступом к личному кабинету и к другим API-методам.
Метод позволяет получить информацию о текущем пользователе.
GET
api/v1/authuser
https://restapi.plusofon.ru
Метод не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/authuser" \
-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/authuser"
);
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/authuser',
[
'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/authuser'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается:
user
объект — данные пользователя (владельца ЛК)
/ id
ИД пользователя (владельца ЛК)
/ email
email-адрес
/ phone
мобильный номер
/ first_name
имя
/ last_name
фамилия
/ middle_name
отчество
/ role
объект — уровень доступа пользователя
/ / name
код уровня доступа
/ / client_id
код приложения (для ЛК Плюсофон всегда «10553»)
token
токен пользователя
token_expire
срок действия токена (в формате Unix-времени)
refresh_token
refresh-токен
refresh_token_expire
срок действия refresh-токена (в формате Unix-времени)
возможные варианты поля
roles / name
:
lk_user
обычный («пользователь»)
lk_admin
привилегированный («администратор»)
дополнительный токен, который выдаётся вместе с основным и используется для обновления основного токена, время жизни которого истекает (подробнее см. на Хабре)
Данные пользователя:
{
"user": {
"id": 82,
"email": "user@mail.ru",
"phone": "79993332210",
"first_name": null,
"last_name": null,
"middle_name": null,
"role": {
"name": "lk_admin",
"client_id": 10553
}
},
"token": "hsU0XgtVX4sxkLoHZEGk6gheXvDnD8ti",
"token_expire": 1665474011,
"refresh_token": "OeDdqfSCOlXPGSW6kgMPwNL4aUoxLotL",
"refresh_token_expire": 1665556811,
"success": true
}
Метод позволяет зарегистрироваться в личном кабинете Плюсофон (далее — ЛК).
POST
api/v1/register
https://restapi.plusofon.ru
password_confirmation
string
повторение пароля для входа в ЛК
pin
string
пин-код, полученный при звонке FlashCall
promocode
string
промокод
curl -X POST \
"https://restapi.plusofon.ru/api/v1/register" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"email":"user@mail.ru","phone":"79993332210","password":"password","password_confirmation":"password","pin":"1234","promocode":"promo"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/register"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"email": "user@mail.ru",
"phone": "79993332210",
"password": "password",
"password_confirmation": "password",
"pin": "1234",
"promocode": "promo"
}
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/register',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'email' => 'user@mail.ru',
'phone' => '79993332210',
'password' => 'password',
'password_confirmation' => 'password',
'pin' => '1234',
'promocode' => 'promo',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/register'
payload = {
"email": "user@mail.ru",
"phone": "79993332210",
"password": "password",
"password_confirmation": "password",
"pin": "1234",
"promocode": "promo"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе возвращаются данные пользователя, описание см. в методе «Получение своих данных».
Регистрация успешна:
{
"user": {
"id": 82,
"email": "user@mail.ru",
"phone": "79993332210",
"first_name": null,
"last_name": null,
"middle_name": null,
"role": {
"name": "lk_admin",
"client_id": 10553
}
},
"token": "hsU04ZEGk6ghesxkLoVXDnDHXvXgt8ti",
"token_expire": 1665474011,
"refresh_token": "OeDL4aUoqfSCPwNlXPGSxLotOW6kgML",
"refresh_token_expire": 1665556811,
"success": true
}
Метод позволяет авторизоваться в ЛК Плюсофон.
POST
api/v1/login
https://restapi.plusofon.ru
email
string
email-адрес пользователя (если авторизация по email, вариант по умолчанию)
password
string
пароль пользователя (если авторизация по email, вариант по умолчанию)
phone
string
телефон пользователя (если авторизация по телефону)
pin
string
пин-код, полученный при звонке FlashCall (если авторизация по телефону)
curl -X POST \
"https://restapi.plusofon.ru/api/v1/login" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"email":"user@mail.ru","password":"password","phone":"79993332210","pin":"1234"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/login"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"email": "user@mail.ru",
"password": "password",
"phone": "79993332210",
"pin": "1234"
}
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/login',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'email' => 'user@mail.ru',
'password' => 'password',
'phone' => '79993332210',
'pin' => '1234',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/login'
payload = {
"email": "user@mail.ru",
"password": "password",
"phone": "79993332210",
"pin": "1234"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе возвращаются данные пользователя, описание см. в методе «Получение своих данных».
Авторизация прошла успешно:
{
"user": {
"id": 82,
"email": "user@mail.ru",
"phone": "79993332210",
"first_name": null,
"last_name": null,
"middle_name": null,
"role": {
"name": "lk_admin",
"client_id": 10553
}
},
"token": "hsU04sxXgtVXkLoHZEGk6gheXvDnD8ti",
"token_expire": 1665474011,
"refresh_token": "OeDdqftOlXPSCPwNL4aUoxLoGSW6kgML",
"refresh_token_expire": 1665556811,
"success": true
}
Метод позволяет поменять пароль текущего пользователя.
POST
api/v1/update-password
https://restapi.plusofon.ru
curl -X POST \
"https://restapi.plusofon.ru/api/v1/update-password" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"current_password":"password","password":"newpassword","password_confirmation":"newpassword"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/update-password"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"current_password": "password",
"password": "newpassword",
"password_confirmation": "newpassword"
}
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/update-password',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'current_password' => 'password',
'password' => 'newpassword',
'password_confirmation' => 'newpassword',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/update-password'
payload = {
"current_password": "password",
"password": "newpassword",
"password_confirmation": "newpassword"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе возвращается:
token
токен пользователя
token_expire
срок действия токена (в формате Unix-времени)
refresh_token
refresh-токен
refresh_token_expire
срок действия refresh-токена (в формате Unix-времени)
дополнительный токен, который выдаётся вместе с основным и используется для обновления основного токена, время жизни которого истекает (подробнее см. на Хабре)
Токен:
{
"token": "tsGE8V1JnjjL6lARa8WM6MqgnWm1O84H",
"token_expire": 1654883878,
"refresh_token": "uUQxDEcSOS8fK99LPs09SPoi48LEgzOz",
"refresh_token_expire": 1654966678
}
Не указан старый пароль:
{
"message": {
"message": "The current_password field is required.",
"field": "token"
},
"code": 400
}
Указан неверный старый пароль:
{
"message": "Password not right.",
"code": 400
}
Метод позволяет отправить звонок FlashCall для получения пин-кода.
POST
api/v1/flashcall
https://restapi.plusofon.ru
curl -X POST \
"https://restapi.plusofon.ru/api/v1/flashcall" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"phone":"79993332210"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/flashcall"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"phone": "79993332210"
}
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/flashcall',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'phone' => '79993332210',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/flashcall'
payload = {
"phone": "79993332210"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе возвращается:
phone
телефон, на который ушёл звонок
token
токен для проверки
Звонок FlashCall отправлен:
{
"phone": "79993332210",
"token": "n6XXNIHlmUG2mqyYszJ3CTHKKQZtqxzB",
"success": true
}
Метод позволяет отправить звонок FlashCall для получения пин-кода текущему пользователю.
POST
api/v1/authuser/flashcall
https://restapi.plusofon.ru
Метод не имеет параметров.
curl -X POST \
"https://restapi.plusofon.ru/api/v1/authuser/flashcall" \
-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/authuser/flashcall"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/authuser/flashcall',
[
'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/authuser/flashcall'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
В ответе возвращается:
phone
телефон, на который ушёл вызов
token
токен для проверки
Звонок FlashCall отправлен:
{
"phone": "79993332210",
"token": "n6XXNIHlmUG2mqyYszJ3CTHKKQZtqxzB",
"success": true
}
Метод позволяет получить новый токен доступа для текущего пользователя, используя refresh-токен (дополнительный токен, который выдаётся вместе с основным и используется для обновления основного токена, время жизни которого истекает, подробнее см. на Хабре).
POST
api/v1/refresh
https://restapi.plusofon.ru
curl -X POST \
"https://restapi.plusofon.ru/api/v1/refresh" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"token":"cwECB6MhbtLHAz"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/refresh"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"token": "cwECB6MhbtLHAz"
}
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/refresh',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'token' => 'cwECB6MhbtLHAz',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/refresh'
payload = {
"token": "cwECB6MhbtLHAz"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе возвращается:
token
токен пользователя
token_expire
срок действия токена (в формате Unix-времени)
refresh_token
refresh-токен
refresh_token_expire
срок действия refresh-токена (в формате Unix-времени)
дополнительный токен, который выдаётся вместе с основным и используется для обновления основного токена, время жизни которого истекает (подробнее см. на Хабре)
Токены успешно обновлены:
{
"token": "B687X5Mct7qNyQ80fw5HlLfibftliFPn",
"token_expire": 1632746131,
"refresh_token": "iK03RDicCW7NPulz35b7valCUEzU4BgU",
"refresh_token_expire": 1632828931
}
Не передан refresh-токен:
{
"message": {
"message": "The token field is required.",
"field": "token"
},
"code": 400
}
Метод позволяет отправить пользователю письмо с токеном для сброса пароля. Может понадобиться если пользователь забыл свой текущий пароль.
POST
api/v1/restore-token
https://restapi.plusofon.ru
curl -X POST \
"https://restapi.plusofon.ru/api/v1/restore-token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"email":"user@mail.ru","url":"https://lk.plusofon.ru/password-restore"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/restore-token"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"email": "user@mail.ru",
"url": "https://lk.plusofon.ru/password-restore"
}
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/restore-token',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'email' => 'user@mail.ru',
'url' => 'https://lk.plusofon.ru/password-restore',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/restore-token'
payload = {
"email": "user@mail.ru",
"url": "https://lk.plusofon.ru/password-restore"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Отправлено письмо с токеном сброса пароля:
{
"success": true
}
Обязательное поле не заполнено:
{
"message": {
"message": "The email field is required.",
"field": "email"
},
"code": 400
}
Пользователь не найден:
{
"message": "User not found.",
"code": 500
}
Метод позволяет установить новый пароль пользователя, взамен забытого.
POST
api/v1/change-password
https://restapi.plusofon.ru
token
string
токен сброса пароля
curl -X POST \
"https://restapi.plusofon.ru/api/v1/change-password" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-d '{"token":"D9qT7Wf9k8PrMQ","password":"newpassword","password_confirmation":"newpassword"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/change-password"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
};
let body = {
"token": "D9qT7Wf9k8PrMQ",
"password": "newpassword",
"password_confirmation": "newpassword"
}
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/change-password',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
],
'json' => [
'token' => 'D9qT7Wf9k8PrMQ',
'password' => 'newpassword',
'password_confirmation' => 'newpassword',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/change-password'
payload = {
"token": "D9qT7Wf9k8PrMQ",
"password": "newpassword",
"password_confirmation": "newpassword"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
В ответе может возвращаться:
success
признак успешно выполненного запроса
message
сообщение об ошибке
Пароль успешно изменён:
{
"success": true
}
Не указаны обязательные параметры:
{
"message": {
"message": "The token field is required.",
"field": "token"
},
"code": 400
}
Введён некорректный пароль:
{
"message": "Password not right.",
"code": 400
}
Метод позволяет разлогинить текущего пользователя.
POST
api/v1/logout
https://restapi.plusofon.ru
curl -X POST \
"https://restapi.plusofon.ru/api/v1/logout" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Client: 10553" \
-H "Authorization: Bearer {token}" \
-d '{"token":"EALnt6y9rKsUeW"}'
const url = new URL(
"https://restapi.plusofon.ru/api/v1/logout"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
let body = {
"token": "EALnt6y9rKsUeW"
}
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/logout',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Client' => '10553',
'Authorization' => 'Bearer {token}',
],
'json' => [
'token' => 'EALnt6y9rKsUeW',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://restapi.plusofon.ru/api/v1/logout'
payload = {
"token": "EALnt6y9rKsUeW"
}
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
}
Передан некорректный токен:
{
"message": {
"message": "Not logout user.",
"field": "token"
},
"code": 400
}
Метод позволяет получить список токенов для доступа к API.
GET
api/v1/tokens
https://restapi.plusofon.ru
Метод не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/tokens" \
-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/tokens"
);
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/tokens',
[
'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/tokens'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращаются массив data
:
id
ИД токена
token
токен
created_at
дата и время создания токена
Получен список токенов:
{
"current_page": 1,
"data": [
{
"id": 5,
"token": "CSMjBmWW0d41oOESLlFQ0QqGmm4afMQZxDUD",
"created_at": "2022-10-12 11:05:41"
},
{
"id": 6,
"token": "Sn46f3C2YYpreEcOCm5nQSJdZffei3M9Gk3x",
"created_at": "2022-10-12 11:10:26"
}
],
"first_page_url": "http:\/\/localhost\/api\/v1\/tokens?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http:\/\/localhost\/api\/v1\/tokens?page=1",
"next_page_url": null,
"path": "http:\/\/localhost\/api\/v1\/tokens",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2,
"success": true
}
Метод позволяет создать токен для доступа к API.
POST
api/v1/tokens
https://restapi.plusofon.ru
Метод не имеет параметров.
curl -X POST \
"https://restapi.plusofon.ru/api/v1/tokens" \
-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/tokens"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Client": "10553",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://restapi.plusofon.ru/api/v1/tokens',
[
'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/tokens'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers)
response.json()
В ответе может возвращаться:
token
токен
success
признак успешно выполненного запроса
message
сообщение об ошибке
Токен успешно создан:
{
"token": "B687X5McLfibt7qNyQ80fw5HlftliFPn",
"success": true
}
Метод позволяет удалить конкретный токен для доступа к API.
DELETE
api/v1/tokens/{token_id}
https://restapi.plusofon.ru
token_id
curl -X DELETE \
"https://restapi.plusofon.ru/api/v1/tokens/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/tokens/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/tokens/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/tokens/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/manager
https://restapi.plusofon.ru
Метод не имеет параметров.
curl -X GET \
-G "https://restapi.plusofon.ru/api/v1/manager" \
-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/manager"
);
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/manager',
[
'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/manager'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Client': '10553',
'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()
В ответе возвращается:
name
имя менеджера
email
эл. почта менеджера
phone
телефон менеджера
Получены данные менеджера:
{
"name": "Иван Иванов",
"email": "ivan.ivanov@plusofon.ru",
"phone": "+7 495 133-22-11",
"success": true
}