Lấy token
Tạo lại token mới cho Người dùng khi token cũ đã bị hết hạn
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/accounts/token' \
--header 'Content-Type: application/json' \
--data '{
    "mobile": "849xxxxxxxx",
    "api_key": "<API_KEY_STG>"
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
const raw = JSON.stringify({
  mobile: '849xxxxxxxx',
  api_key: '<API_KEY_STG>',
});
const requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/accounts/token', requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
HTTP Request
POST https://partner-apistg.ahamove.com/v3/accounts/token
Query Parameters
| Parameter | Loại | Yêu cầu | Mô tả | 
|---|---|---|---|
| api_key | String | Có | API_KEY đã nhận được sau khi Đối tác đăng ký tích hợp | 
| mobile | String | Có | Số điện thoại đã đăng ký tài khoản | 
Response
JSON response example:
{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhaGEiLCJ0eXAiOiJ1c2VyIiwiY2lkIjoiODQ5MDI5MzMwMjUiLCJzdGF0dXMiOiJPTkxJTkUiLCJlb2MiOiJob2RkQGFoYW1vdmUuY29tIiwibm9jIjoiRG9hbiBEYWkgSG8iLCJjdHkiOiJTR04iLCJhY2NvdW50X3N0YXR1cyI6IkFDVElWQVRFRCIsImV4cCI6MTY5NTI3NjM2OCwicGFydG5lciI6Im9kb28iLCJ0eXBlIjoiYXBpIn0.celDzdkTiNuIjEf_8LDCJHTyK74BuceXB5IYhfHo08I",
  "refresh_token": "0c42af2105249b126b80862e96b3b055"
}
Status-Code: 200 OK
Các lỗi thường gặp
| Mã lỗi | Nội dung | Mô tả | 
|---|---|---|
| 401 | NOT_AUTHORIZED | Tài khoản hiện tại không thuộc Đối tác này | 
| 404 | USER_NOT_FOUND | Tài khoản không tồn tại | 
| 404 | PARTNER_NOT_FOUND | Không tìm thấy api_key, không tìm thấy partner | 
| 406 | INVALID_PHONE_NUMBER | Số điện thoại không hợp lệ | 
| 406 | DEACTIVATED_ACCOUNT | Tài khoản đã bị khóa | 
| 500 | INTERNAL_SERVER_ERROR | Hệ thống của chúng tôi có lỗi xảy ra. Xin thử lại sau | 
| 503 | SERVICE_UNAVAILABLE | Chúng tôi tạm thời đang không hoạt động để bảo trì. Xin vui lòng thử lại sau |