Lấy token xác thực
Để lấy Token xác thực cho các API của API.socdo.vn, bạn cần gửi api_key và api_secret của mình lên endpoint dưới đây.
Ví dụ minh họa: Lấy token xác thực
Ví dụ minh họa: Lấy token xác thực
POST https://api.socdo.vn/v1/get_token
Trường truyền lên:
api_key(bắt buộc): Mã API Key của bạnapi_secret(bắt buộc): Mã API Secret của bạn
Dữ liệu truyền lên (JSON):
{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}
Ví dụ kết nối bằng cURL:
curl -X POST "https://api.socdo.vn/v1/get_token" -H "Content-Type: application/json" -d '{"api_key": "your_api_key", "api_secret": "your_api_secret"}'
Ví dụ kết nối bằng PHP:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.socdo.vn/v1/get_token");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"api_key" => "your_api_key",
"api_secret" => "your_api_secret"
]));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Dữ liệu trả về mẫu:
{
"success": true,
"message": "Lấy token thành công",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
Lưu ý: Sau khi lấy được token, bạn sử dụng token này để xác thực cho các API khác bằng cách thêm vào header
Để xem hướng dẫn chi tiết từng API, vui lòng chọn chức năng ở menu bên trái.
Authorization: Bearer <Token>.Để xem hướng dẫn chi tiết từng API, vui lòng chọn chức năng ở menu bên trái.