Danh sách sản phẩm Shop

API để lấy danh sách sản phẩm của shop với thông tin chi tiết và phân loại

Endpoint
    GET https://api.socdo.vn/mini-app/v1/list-product-shop
        
Request Headers
Token-Seller: YOUR_TOKEN_SELLER
Shop-ID: 31026 (optional, có thể dùng query parameter)

Hoặc:

Authorization: Bearer YOUR_TOKEN_SELLER
Shop-ID: 31026 (optional, có thể dùng query parameter)
        
Query Parameters
Parameter Type Required Description
shop_id int Yes ID của shop (có thể dùng header Shop-ID)
status int No Trạng thái sản phẩm (1: web con, 2: Đăng sàn, 0: Sóc đỏ)
active int No Trạng thái hiển thị (0: Hiển thị, 1: Ẩn hiển thị)
category_shop string No Lọc theo danh mục shop
search string No Tìm kiếm theo tên sản phẩm
include_variants int No Có bao gồm phân loại sản phẩm (1: có, 0: không)
page int No Trang hiện tại (mặc định: 1)
limit int No Số sản phẩm mỗi trang (mặc định: 100, tối đa: 1000)
Response Structure
{
    "success": true,
    "message": "Lấy danh sách sản phẩm thành công",
    "data": {
        "products": [
            {
                "id": 83063,
                "sp_id": 0,
                "shop_id": 23933,
                "title": "Vợt muỗi điện Syntex SM400",
                "image": "/uploads/minh-hoa/vot-muoi-dien-syntex-sm400.jpg",
                "image_url": "https://socdo.vn/uploads/minh-hoa/vot-muoi-dien-syntex-sm400.jpg",
                "link": "vot-muoi-dien-syntex-sm400",
                "link_aff": "",
                "category": "8,394",
                "category_shop": "14629",
                "status": 1,
                "stock": 99,
                "original_price": 500000,
                "current_price": 250000,
                "brand": "2888",
                "color": "0",
                "size": "0",
                "weight": "300",
                "images": "/uploads/minh-hoa/0/sm400-1757578479.jpg",
                "images_list": [
                    "https://socdo.vn/uploads/minh-hoa/0/sm400-1757578479.jpg"
                ],
                "view": 10,
                "date_post": 1757578920,
                "active": 0,
                "weight_ship": 300,
                "warehouse_id": 240,
                "variants": [
                    {
                        "id": 7465,
                        "product_id": 82957,
                        "sku": "1373NW_250908105201_2",
                        "color": "1194",
                        "size": "0",
                        "size_name": "+",
                        "color_name": "60 viên",
                        "weight": 200.00,
                        "original_price": 1500000,
                        "current_price": 1100000,
                        "drop_price": 0,
                        "ctv_price": 770000,
                        "socdo_price": 0,
                        "drop_min": 0,
                        "stock": 10,
                        "weight_ship": 563.00,
                        "date_post": 1757303618,
                        "image": "",
                        "image_url": ""
                    }
                ],
                "variants_count": 1
            }
        ],
        "pagination": {
            "current_page": 1,
            "total_pages": 1,
            "total_records": 3,
            "per_page": 100,
            "has_next": false,
            "has_prev": false
        },
        "filters": {
            "status": 1,
            "active": 0,
            "category": "",
            "category_shop": "",
            "include_variants": 1,
            "search": "",
            "shop_id": 23933
        }
    }
}
        
JavaScript Example
// Lấy danh sách sản phẩm với phân loại
const response = await fetch('/mini-app/v1/list-product-shop?shop_id=23933&include_variants=1&page=1&limit=20', {
    method: 'GET',
    headers: {
        'Token-Seller': 'YOUR_TOKEN_SELLER',
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

// Lấy sản phẩm theo danh mục
const categoryResponse = await fetch('/mini-app/v1/list-product-shop?shop_id=23933&cat=8,394&page=1&limit=50', {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer YOUR_TOKEN_SELLER',
        'Content-Type': 'application/json'
    }
});

// Tìm kiếm sản phẩm
const searchResponse = await fetch('/mini-app/v1/list-product-shop?shop_id=23933&search=Syntex&page=1&limit=100', {
    method: 'GET',
    headers: {
        'Token-Seller': 'YOUR_TOKEN_SELLER',
        'Content-Type': 'application/json'
    }
});

// Lọc theo nhiều điều kiện
const filterResponse = await fetch('/mini-app/v1/list-product-shop?shop_id=23933&cat=8,394&search=Goldsun&status=1&page=1&limit=50', {
    method: 'GET',
    headers: {
        'Token-Seller': 'YOUR_TOKEN_SELLER',
        'Content-Type': 'application/json'
    }
});
        
cURL Example
# Lấy danh sách sản phẩm cơ bản
curl -X GET "https://api.socdo.vn/mini-app/v1/list-product-shop?shop_id=23933" \
  -H "Token-Seller: YOUR_TOKEN_SELLER" \
  -H "Content-Type: application/json"

# Lấy sản phẩm với phân loại và phân trang
curl -X GET "https://api.socdo.vn/mini-app/v1/list-product-shop?shop_id=23933&include_variants=1&page=1&limit=50" \
  -H "Authorization: Bearer YOUR_TOKEN_SELLER" \
  -H "Content-Type: application/json"

# Lọc theo danh mục và tìm kiếm
curl -X GET "https://api.socdo.vn/mini-app/v1/list-product-shop?shop_id=23933&cat=8,394&search=Syntex&status=1" \
  -H "Token-Seller: YOUR_TOKEN_SELLER" \
  -H "Content-Type: application/json"

# Tìm kiếm với nhiều điều kiện
curl -X GET "https://api.socdo.vn/mini-app/v1/list-product-shop?shop_id=23933&search=Goldsun&cat=8,394&page=2&limit=20" \
  -H "Token-Seller: YOUR_TOKEN_SELLER" \
  -H "Content-Type: application/json"
        
Lưu ý quan trọng
  • Logic giá: Nếu có phân loại sản phẩm, API sẽ lấy giá cũ cao nhất và giá mới thấp nhất từ tất cả phân loại
  • Phân loại sản phẩm: Bao gồm thông tin chi tiết về màu sắc, kích thước, giá và tồn kho
  • Hình ảnh: Tự động tạo URL đầy đủ cho hình ảnh chính và danh sách hình ảnh
  • Tìm kiếm: Hỗ trợ tìm kiếm theo tên sản phẩm và tiêu đề
  • Lọc: Có thể lọc theo trạng thái, danh mục, và trạng thái hiển thị
  • Phân trang: Hỗ trợ phân trang với giới hạn tối đa 1000 sản phẩm mỗi trang
  • Thứ tự: Sắp xếp theo thời gian đăng mới nhất
Error Responses
// Token không hợp lệ
{
    "message": "Không tìm thấy Token-Seller"
}

// Shop_ID không khớp
{
    "message": "Shop_ID không khớp với Token-Seller"
}

// Lỗi hệ thống
{
    "success": false,
    "message": "Lỗi hệ thống",
    "error": "Chi tiết lỗi"
}