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

ParamTypeDefaultMô tả
pageinteger1Số trang
per_pageinteger20Số item/trang (max: 100)
category_idintegerLọc theo danh mục (bao gồm danh mục con)
seller_idintegerLọc theo người bán
searchstringTìm kiếm theo tên (tối thiểu 3 ký tự)
sortstringnewestnewest, oldest, lowest_price, highest_price, highest_rating, most_sales
min_pricenumberGiá tối thiểu (số thập phân)
max_pricenumberGiá 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

ParamTypeMô tả
idintegerID sản phẩm

Response bổ sung so với list

FieldTypeMô tả
descriptionstringMô tả HTML đầy đủ
short_descriptionstringMô tả ngắn
images[]arrayDanh sách hình ảnh (small, default, big)
categoryobjectThông tin danh mục (id, name, slug)
variations_countintegerSố lượng biến thể
vat_ratenumberThuế VAT (%)
demo_urlstringLink 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

ParamTypeMô tả
parent_idintegerID 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ĩaKhi nào
200OKRequest thành công
400Bad RequestThiếu hoặc sai tham số
401UnauthorizedThiếu hoặc sai API Key
404Not FoundKhông tìm thấy resource
500Server ErrorLỗ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