Profile API cho phép bạn quản lý thông tin người dùng, bao gồm việc lấy thông tin, cập nhật hồ sơ và thay đổi mật khẩu. Tất cả các request đều yêu cầu xác thực bằng JWT token.
Để lấy thông tin profile của người dùng:
GET: https://copecute.minhgiang.pro/api/profile/index.php
Authorization: Bearer {your_jwt_token}
{
"success": true,
"data": {
"user_id": 1,
"username": "user123",
"email": "user@example.com",
"full_name": "Nguyễn Văn A",
"phone": "0912345678",
"gender": "male",
"birthday": "1990-01-01",
"address": "Hà Nội, Việt Nam",
"avatar": "https://example.com/avatar.jpg",
"created_at": "2024-03-10T15:30:00Z",
"quota": 100
}
}
Để cập nhật thông tin profile:
POST: https://copecute.minhgiang.pro/api/profile/update.php
Authorization: Bearer {your_jwt_token}
Content-Type: application/json
{
"full_name": "Nguyễn Văn A",
"phone": "0912345678",
"gender": "male",
"birthday": "1990-01-01",
"address": "Hà Nội, Việt Nam",
"avatar": "https://example.com/avatar.jpg"
}
{
"success": true,
"message": "Cập nhật thông tin thành công"
}
Lưu ý: Bạn chỉ cần gửi các trường cần cập nhật.
Để thay đổi mật khẩu:
POST: https://copecute.minhgiang.pro/api/profile/change_password.php
Authorization: Bearer {your_jwt_token}
Content-Type: application/json
{
"current_password": "mật_khẩu_hiện_tại",
"new_password": "mật_khẩu_mới",
"confirm_password": "xác_nhận_mật_khẩu_mới"
}
{
"success": true,
"message": "Đổi mật khẩu thành công"
}
Token không hợp lệ hoặc đã hết hạn
Dữ liệu gửi lên không hợp lệ
Không có quyền thực hiện hành động
Không tìm thấy tài nguyên