TapHoaMMO API
REST API để truy cập dữ liệu sản phẩm, danh mục và biến thể. Tất cả endpoints đều yêu cầu API Key.
Base URL:
https://taphoammo.fun
🔐 Authentication
Tất cả API requests đều yêu cầu API Key. Gửi key qua header hoặc query parameter:
Header (khuyến nghị)
X-API-Key: YOUR_API_KEY_HERE
Query Parameter
GET /api/products?api_key=YOUR_API_KEY_HERE
⚠ Bắt buộc Nếu thiếu hoặc sai API key, server sẽ trả về 401 Unauthorized.
Danh Sách Sản Phẩm
GET
/api/products
Lấy danh sách sản phẩm đang bán với phân trang và bộ lọc.
Query Parameters
| Param | Type | Default | Mô tả |
|---|---|---|---|
page | integer | 1 | Số trang |
per_page | integer | 20 | Số item/trang (max: 100) |
category_id | integer | — | Lọc theo danh mục (bao gồm danh mục con) |
seller_id | integer | — | Lọc theo người bán |
search | string | — | Tìm kiếm theo tên (tối thiểu 3 ký tự) |
sort | string | newest | newest, oldest, lowest_price, highest_price, highest_rating, most_sales |
min_price | number | — | Giá tối thiểu (số thập phân) |
max_price | number | — | Giá tối đa (số thập phân) |
Response
{
"status": true,
"data": [
{
"id": 1,
"title": "Tên sản phẩm",
"slug": "ten-san-pham-1",
"product_type": "digital",
"price": 150000,
"price_discounted": 120000,
"currency": "VND",
"discount_rate": 20,
"stock": 50,
"rating": 4.5,
"total_sales": 120,
"image": "https://...",
"seller": { "username": "shop1", "slug": "shop1" },
"created_at": "2026-01-15 10:30:00"
}
],
"pagination": {
"current_page": 1,
"per_page": 20,
"total": 150,
"total_pages": 8
}
}
Chi Tiết Sản Phẩm
GET
/api/products/{id}
Lấy thông tin chi tiết của một sản phẩm bao gồm mô tả, hình ảnh, danh mục.
Path Parameters
| Param | Type | Mô tả |
|---|---|---|
id | integer | ID sản phẩm |
Response bổ sung so với list
| Field | Type | Mô tả |
|---|---|---|
description | string | Mô tả HTML đầy đủ |
short_description | string | Mô tả ngắn |
images[] | array | Danh sách hình ảnh (small, default, big) |
category | object | Thông tin danh mục (id, name, slug) |
variations_count | integer | Số lượng biến thể |
vat_rate | number | Thuế VAT (%) |
demo_url | string | Link demo |
Biến Thể Sản Phẩm
GET
/api/products/{id}/variations
Lấy danh sách biến thể và options của sản phẩm.
Response
{
"status": true,
"data": [
{
"id": 10,
"label": "Loại tài khoản",
"type": "radio_button",
"use_different_price": true,
"options": [
{
"id": 101,
"name": "1 tháng",
"stock": 25,
"price": 50000,
"price_discounted": 45000,
"is_default": true
}
]
}
]
}
Danh Mục
GET
/api/categories
Lấy danh sách danh mục. Mặc định trả về danh mục gốc (parent). Truyền parent_id để lấy danh mục con.
Query Parameters
| Param | Type | Mô tả |
|---|---|---|
parent_id | integer | ID danh mục cha (để lấy danh mục con) |
Response
{
"status": true,
"data": [
{
"id": 5,
"name": "Tài khoản MMO",
"slug": "tai-khoan-mmo",
"parent_id": 0,
"has_subcategories": true,
"image": "https://..."
}
]
}
Sản Phẩm Theo Danh Mục
GET
/api/categories/{id}/products
Lấy sản phẩm theo danh mục. Response giống /api/products với filter category_id. Hỗ trợ tất cả query params của endpoint products.
⚠️ Error Codes
| HTTP Code | Ý nghĩa | Khi nào |
|---|---|---|
200 | OK | Request thành công |
400 | Bad Request | Thiếu hoặc sai tham số |
401 | Unauthorized | Thiếu hoặc sai API Key |
404 | Not Found | Không tìm thấy resource |
500 | Server Error | Lỗi server |
{
"status": 401,
"error": 401,
"messages": {
"error": "Invalid or missing API key."
}
}
💡 Lưu ý: Giá tiền trong response là giá thập phân (đã chia 100). Ví dụ:
150000 = 150,000 VND. Hình ảnh trả về URL đầy đủ.
TapHoaMMO API v1.0 © 2026