Документация
В этой документации объясняется, как зарегистрироваться, настроить и разработать приложение, чтобы вы могли успешно использовать наши APIs
Authentication
All API requests require authentication using an access token. You can obtain an access token by registering your application.
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Base URL
All API endpoints are relative to:
https://hi24.co.uk/api/v1
Rate Limiting
API requests are limited to 1000 requests per hour per access token.
Создать приложение
Для того, чтобы ваше приложение смогло получить доступ к нашим APIs, вы должны зарегистрировать свое приложение с помощью Панель инструментов приложения. Регистрация создаёт идентификатор приложения, который позволяет нам знать, кто вы, помогает нам отличить ваше приложение от других приложений.
OAuth Login
Starting the OAuth login process, use a link like this:
<a href="https://hi24.co.uk/api/oauth?app_id=YOUR_APP_ID">Log in With Hi24</a>
Once the user accepted your app, they will be redirected to your App Redirect URL with auth_key:
https://mydomain.com/my_redirect_url.php?auth_key=AUTH_KEY
Токен доступа
To get an access token, make an HTTP POST request to the authorize endpoint:
<?php
$app_id = "YOUR_APP_ID";
$app_secret = "YOUR_APP_SECRET";
$auth_key = $_GET['auth_key'];
$postData = ['app_id' => $app_id, 'app_secret' => $app_secret, 'auth_key' => $auth_key];
$ch = curl_init('https://hi24.co.uk/api/authorize');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$response = curl_exec($ch);
curl_close($ch);
$json = json_decode($response, true);
if (!empty($json['access_token'])) {
$access_token = $json['access_token'];
}
?>
User Endpoints
Get Current User — Retrieve information about the authenticated user:
GET /user/me
Response:
{
"user_id": "",
"user_name": "",
"user_email": "",
"user_firstname": "",
"user_lastname": "",
"user_gender": "",
"user_birthdate": "",
"user_picture": "",
"user_cover": "",
"user_verified": ""
}
You can retrieve user info like this:
$get = file_get_contents("https://hi24.co.uk/api/get_user_info?access_token=$access_token");