REST · JSON · CORS · UTF-8 · v1.0.1
Header X-API-Key: dhm_xxx hoặc query ?key=dhm_xxx. Lấy key tại Dashboard.
Tìm sản phẩm theo từ khóa. Tham số: q (bắt buộc), shop (tuỳ chọn — tìm live trong 1 shop), limit (1–100, mặc định 20), page.
GET https://data.duchuymedia.com/api/v1/search?q=iphone&limit=2
{
"ok": true, "q": "iphone", "count": 2,
"quota": { "used": 15, "limit": 1000, "remaining": 985 },
"items": [
{ "title": "iPhone 16 Pro Max 256GB", "price": 30990000, "compare_price": 34990000,
"currency": "VND", "url": "https://...", "image": "https://...", "brand": "Apple",
"stock": "InStock", "shop": "example.vn" }
]
}Lấy nhanh danh sách sản phẩm của 1 shop (tối đa 250/lần). Tham số: url, limit, page.
Xem gói, quota, số request đã dùng hôm nay.
401 sai key · 402 gói hết hạn · 429 vượt quota ngày · 400 thiếu tham số.
const r = await fetch("https://data.duchuymedia.com/api/v1/search?q=" + encodeURIComponent("tai nghe"), {
headers: { "X-API-Key": "dhm_xxx" }
});
const data = await r.json();
console.log(data.items);$ch = curl_init("https://data.duchuymedia.com/api/v1/search?q=" . urlencode("laptop"));
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: dhm_xxx"]]);
$data = json_decode(curl_exec($ch), true);