MENU navbar-image

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": "Неверные учетные данные."
}
 

Request      

POST api/v1/auth/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Email(login) из ЛК. Example: test@gmail.com

password   string   

Пароль из ЛК. Example: qweRTY12345

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"
}
 

Request      

GET api/v1/user/devices

Headers

Authorization      

Example: Bearer your_token

Content-Type      

Example: application/json

Accept      

Example: application/json

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
        }
    ]
}
 

Request      

GET api/v1/device/id

Headers

Authorization      

Example: Bearer your_token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

serial_number   string   

Example: R1234567

hwid   string   

Example: 21D2-43A5-F4B3-29F4

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"
}
 

Request      

POST api/v1/auth/logout

Headers

Authorization      

Example: Bearer your_token

Content-Type      

Example: application/json

Accept      

Example: application/json

Получение данных текущего пользователя

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
        }
    ]
}
 

Request      

GET api/v1/user

Headers

Authorization      

Example: Bearer {your_token}

Content-Type      

Example: application/json

Accept      

Example: application/json