Đăng ký tài khoản qua API
Để đăng ký tài khoản trên API.socdo.vn, bạn cần gửi họ và tên và số điện thoại và mật khẩu kèm theo token xác thực (JWT) vào endpoint dưới đây.
Ví dụ minh họa: Đăng nhập tài khoản
Ví dụ minh họa: Đăng nhập tài khoản
POST https://api.socdo.vn/v1/register
các trường cần truyền lên:
- full_name: tên của bạn
- phone_number: số điện thoại của bạn (sẽ là tên đăng nhập)
- password: nhập mạt khẩu
- re_password: nhập lại mật khẩu
Dữ liệu mẫu truyền lên (JSON):
{
"full_name" : "your_full_name",
"phone_number" : "your_phone_number",
"password" : "your_password ",
"re_password" : "your_password"
}
Ví dụ kết nối bằng cURL:
curl -X POST "https://api.socdo.vn/v1/register" -H "Content-Type: application/json" -H "Authorization: Bearer <token>" -d '{"full_name": "your_full_name", "phone_number": "your_phone_number", "password": "your_password", "re_password": "your_password"}'
Ví dụ kết nối bằng PHP:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.socdo.vn/v1/register");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer <token>"
]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"full_name" => "your_full_name",
"phone_number" =>"your_phone_number",
"password" => "your password",
"re_password" => "your password"
]));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Dữ liệu trả về mẫu:
{
"success": true,
"message": "Đăng ký tài khoản thành công",
"data": {
"full_name": "ABC",
"phone_number": "0123456789",
"password": "XYZ"
}
}
Lưu ý: Bạn cần lấy token xác thực trước khi gọi API này (xem hướng dẫn lấy token ở mục Get token xác thực).
Trường phone_number sẽ là tên đăng nhập, là số điện thoại.
Để 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.
Trường phone_number sẽ là tên đăng nhập, là số điện thoại.
Để 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.