Introduction
Api для сервиса Booking.
Authenticating requests
Для выполнения запросов необходимо авторизоваться
Auth
Авторизация пользователя
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8870/api/v1/auth/login';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'email' => 'test@gmail.com',
'password' => 'qweRTY12345',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"token": "6|szwnqeoJUBuaImP1PzHl8eHytU5GwRPXDw6nWhyy4b720a8e"
}
}
Example response (403):
{
"status": "error",
"message": "Неверные учетные данные."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Device
Все устройства пользователя
requires authentication
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8870/api/v1/user/devices';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer your_token',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": [
{
"device_id": 27766,
"serial_number": "R4665200",
"hwid": "01D2-46A5-F4B3-29FA"
},
{
"device_id": 27766,
"serial_number": "R4665200",
"hwid": "01D2-46A5-F4B3-29FA"
},
...
]
}
Example response (401):
{
"message": "Unauthenticated"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Id устройства пользователя по серийнику и hwid
requires authentication
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8870/api/v1/device/id';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer your_token',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'serial_number' => 'R1234567',
'hwid' => '21D2-43A5-F4B3-29F4',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": [
{
"device_id": 12345
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
User
Выход пользователя
requires authentication
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8870/api/v1/auth/logout';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer your_token',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"message": "Successfully logged out"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Получение данных текущего пользователя
requires authentication
Example request:
$client = new \GuzzleHttp\Client();
$url = 'http://localhost:8870/api/v1/user';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {your_token}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": [
{
"id": 1234,
"name": "Название клуба",
"adress": "Адрес",
"description": "Описание",
"login": "test@gmail.com",
"isPhisical": 0,
"website": "Ссылка на сайт",
"last_date": "Дата захода в ЛК",
"last_ip": "Ip с которого заходили",
"reg_date": "2019-11-26 14:47:46",
"flags": 0,
"confirmed": 1,
"lang": "ru",
"photo": "60a745e0414b88f2ca65038858ebb703.jpg",
"mail_stat": 0,
"currency_code": 826
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.