Giới thiệu
Tài liệu mô tả các endpoint API của hệ thống.
Tài liệu này mô tả toàn bộ endpoint API hiện có.
Xác thực sử dụng Bearer token (Laravel Sanctum).
Xác thực request
Để xác thực, gửi header Authorization với giá trị "Bearer {TOKEN}".
Tất cả endpoint cần xác thực sẽ có nhãn requires authentication trong tài liệu bên dưới.
Lấy token qua POST /api/v1/auth/login, sau đó gửi header Authorization: Bearer <token>.
Cài đặt
Công khai
Danh sách setting công khai
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/public" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/public"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Quản trị
Danh sách tất cả setting
requires authentication
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings" \
--header "Authorization: Bearer {TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings"
);
const headers = {
"Authorization": "Bearer {TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Upsert settings (bulk)
requires authentication
Ví dụ request:
curl --request PUT \
"http://laravel-core.test/api/v1/settings" \
--header "Authorization: Bearer {TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"items\": [
{
\"key\": \"site_name\",
\"value\": \"Core API\",
\"group\": \"general\",
\"is_public\": true,
\"description\": \"Tên website\"
}
]
}"
const url = new URL(
"http://laravel-core.test/api/v1/settings"
);
const headers = {
"Authorization": "Bearer {TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"items": [
{
"key": "site_name",
"value": "Core API",
"group": "general",
"is_public": true,
"description": "Tên website"
}
]
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Hàng đợi
Thống kê queue
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/stats" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/stats"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Danh sách job (jobs)
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/jobs?sort=-id&page=1&per_page=20" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/jobs"
);
const params = {
"sort": "-id",
"page": "1",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Chi tiết job
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/jobs/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/jobs/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Danh sách failed jobs
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/failed-jobs?sort=-id&page=1&per_page=20" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/failed-jobs"
);
const params = {
"sort": "-id",
"page": "1",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Chi tiết failed job
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Retry failed job
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562/retry" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562/retry"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Xoá failed job khỏi failed_jobs
Ví dụ request:
curl --request DELETE \
"http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/failed-jobs/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Danh sách job batches
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/batches?sort=-created_at&page=1&per_page=20" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/batches"
);
const params = {
"sort": "-created_at",
"page": "1",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Chi tiết batch
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/queue/batches/consequatur" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/queue/batches/consequatur"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Theo key
Lấy setting theo key
Nếu setting là public: không cần đăng nhập. Nếu setting không public: yêu cầu user_type là ADMIN hoặc SYSTEM.
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/settings/!public$)!queue$^//^" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/settings/!public$)!queue$^//^"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Tài khoản
Quản trị
Danh sách tài khoản
Hỗ trợ query:
- filter[name], filter[email], filter[user_type], filter[phone]
- sort=id,name,email,user_type,created_at,updated_at (có thể thêm dấu "-" để desc)
- page, per_page
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/users?include=consequatur&sort=-id&page=1&per_page=20" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/users"
);
const params = {
"include": "consequatur",
"sort": "-id",
"page": "1",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Chi tiết tài khoản
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/users/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/users/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Tạo tài khoản
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/users" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Demo User\",
\"email\": \"demo2@example.com\",
\"password\": \"123456789\",
\"user_type\": \"USER\",
\"phone\": \"0986420994\",
\"avatar_url\": \"http:\\/\\/kunze.biz\\/iste-laborum-eius-est-dolor.html\",
\"date_of_birth\": \"2026-03-18T07:06:46\",
\"gender\": \"dtdsufvyvddqamnii\",
\"address_line1\": \"hfqcoynlazghdtqtqxbaj\",
\"address_line2\": \"wbpilpmufinllwloauydl\",
\"ward\": \"smsjuryvojcybzvrbyick\",
\"district\": \"znkygloigmkwxphlvazjr\",
\"province\": \"HCM\",
\"country\": \"cn\",
\"postal_code\": \"fbaqywuxhgjjmzuxj\",
\"company\": \"ubqouzswiwxtrkimfcatb\",
\"job_title\": \"xspzmrazsroyjpxmqesed\",
\"timezone\": \"Pacific\\/Guam\",
\"locale\": \"en_MP\",
\"bio\": \"consequatur\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/users"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Demo User",
"email": "demo2@example.com",
"password": "123456789",
"user_type": "USER",
"phone": "0986420994",
"avatar_url": "http:\/\/kunze.biz\/iste-laborum-eius-est-dolor.html",
"date_of_birth": "2026-03-18T07:06:46",
"gender": "dtdsufvyvddqamnii",
"address_line1": "hfqcoynlazghdtqtqxbaj",
"address_line2": "wbpilpmufinllwloauydl",
"ward": "smsjuryvojcybzvrbyick",
"district": "znkygloigmkwxphlvazjr",
"province": "HCM",
"country": "cn",
"postal_code": "fbaqywuxhgjjmzuxj",
"company": "ubqouzswiwxtrkimfcatb",
"job_title": "xspzmrazsroyjpxmqesed",
"timezone": "Pacific\/Guam",
"locale": "en_MP",
"bio": "consequatur"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Cập nhật tài khoản
Ví dụ request:
curl --request PUT \
"http://laravel-core.test/api/v1/users/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Nguyễn Văn A\",
\"email\": \"demo@example.com\",
\"user_type\": \"USER\",
\"phone\": \"0900000000\",
\"avatar_url\": \"http:\\/\\/kunze.biz\\/iste-laborum-eius-est-dolor.html\",
\"date_of_birth\": \"2026-03-18T07:06:46\",
\"gender\": \"dtdsufvyvddqamnii\",
\"address_line1\": \"hfqcoynlazghdtqtqxbaj\",
\"address_line2\": \"wbpilpmufinllwloauydl\",
\"ward\": \"smsjuryvojcybzvrbyick\",
\"district\": \"znkygloigmkwxphlvazjr\",
\"province\": \"cnfbaqywuxhgjjmzuxjub\",
\"country\": \"qo\",
\"postal_code\": \"uzswiwxtrkimfcatb\",
\"company\": \"xspzmrazsroyjpxmqesed\",
\"job_title\": \"yghenqcopwvownkbamlnf\",
\"timezone\": \"Asia\\/Colombo\",
\"locale\": \"en_PH\",
\"bio\": \"Mô tả ngắn về user\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/users/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Nguyễn Văn A",
"email": "demo@example.com",
"user_type": "USER",
"phone": "0900000000",
"avatar_url": "http:\/\/kunze.biz\/iste-laborum-eius-est-dolor.html",
"date_of_birth": "2026-03-18T07:06:46",
"gender": "dtdsufvyvddqamnii",
"address_line1": "hfqcoynlazghdtqtqxbaj",
"address_line2": "wbpilpmufinllwloauydl",
"ward": "smsjuryvojcybzvrbyick",
"district": "znkygloigmkwxphlvazjr",
"province": "cnfbaqywuxhgjjmzuxjub",
"country": "qo",
"postal_code": "uzswiwxtrkimfcatb",
"company": "xspzmrazsroyjpxmqesed",
"job_title": "yghenqcopwvownkbamlnf",
"timezone": "Asia\/Colombo",
"locale": "en_PH",
"bio": "Mô tả ngắn về user"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Đổi user_type
Ví dụ request:
curl --request PATCH \
"http://laravel-core.test/api/v1/users/1562/user-type" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_type\": \"ADMIN\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/users/1562/user-type"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_type": "ADMIN"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Reset mật khẩu
Ví dụ request:
curl --request PATCH \
"http://laravel-core.test/api/v1/users/1562/password" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"password\": \"123456789\",
\"password_confirmation\": \"123456789\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/users/1562/password"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"password": "123456789",
"password_confirmation": "123456789"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Xoá tài khoản (soft delete)
Ví dụ request:
curl --request DELETE \
"http://laravel-core.test/api/v1/users/1562" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/users/1562"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Khôi phục tài khoản đã xoá
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/users/1562/restore" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/users/1562/restore"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Xác thực
API đăng ký/đăng nhập/cập nhật profile sử dụng Bearer token (Sanctum).
Tài khoản
Các thao tác đăng ký/đăng nhập.
Đăng ký
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/auth/register" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Demo User\",
\"email\": \"demo@example.com\",
\"password\": \"password123\",
\"device_name\": \"postman\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/auth/register"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Demo User",
"email": "demo@example.com",
"password": "password123",
"device_name": "postman"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Đăng nhập
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/auth/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"demo@example.com\",
\"password\": \"password123\",
\"device_name\": \"postman\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/auth/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "demo@example.com",
"password": "password123",
"device_name": "postman"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Hồ sơ
Các thao tác xem/cập nhật hồ sơ.
Thông tin tài khoản
requires authentication
Lấy thông tin user đang đăng nhập.
Ví dụ request:
curl --request GET \
--get "http://laravel-core.test/api/v1/auth/me" \
--header "Authorization: Bearer {TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/auth/me"
);
const headers = {
"Authorization": "Bearer {TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Cập nhật profile
requires authentication
Cập nhật thông tin profile của user hiện tại.
Ví dụ request:
curl --request PUT \
"http://laravel-core.test/api/v1/auth/profile" \
--header "Authorization: Bearer {TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Demo User\",
\"phone\": \"0900000000\",
\"avatar_url\": \"https:\\/\\/example.com\\/avatar.png\",
\"date_of_birth\": \"1990-01-01\",
\"gender\": \"male\",
\"address_line1\": \"123 Street\",
\"address_line2\": \"Apt 4\",
\"ward\": \"Ward 1\",
\"district\": \"District 1\",
\"province\": \"HCM\",
\"country\": \"VN\",
\"postal_code\": \"700000\",
\"company\": \"Core Co\",
\"job_title\": \"Engineer\",
\"timezone\": \"Asia\\/Ho_Chi_Minh\",
\"locale\": \"vi\",
\"bio\": \"Hello\"
}"
const url = new URL(
"http://laravel-core.test/api/v1/auth/profile"
);
const headers = {
"Authorization": "Bearer {TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Demo User",
"phone": "0900000000",
"avatar_url": "https:\/\/example.com\/avatar.png",
"date_of_birth": "1990-01-01",
"gender": "male",
"address_line1": "123 Street",
"address_line2": "Apt 4",
"ward": "Ward 1",
"district": "District 1",
"province": "HCM",
"country": "VN",
"postal_code": "700000",
"company": "Core Co",
"job_title": "Engineer",
"timezone": "Asia\/Ho_Chi_Minh",
"locale": "vi",
"bio": "Hello"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.
Phiên
Quản lý phiên và token.
Đăng xuất
requires authentication
Thu hồi token hiện tại.
Ví dụ request:
curl --request POST \
"http://laravel-core.test/api/v1/auth/logout" \
--header "Authorization: Bearer {TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"http://laravel-core.test/api/v1/auth/logout"
);
const headers = {
"Authorization": "Bearer {TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Đã nhận response:
Request bị lỗi:
Gợi ý: Kiểm tra kết nối mạng.
Nếu bạn là người vận hành API, hãy đảm bảo API đang chạy và đã bật CORS.
Có thể mở DevTools Console để debug.