Thẻ kho
Theo dõi biến động tồn (nhập/xuất/…) của một sản phẩm trong khoảng thời gian. Domain InventoryCard.
1. Thông tin API
- Endpoint:
/api/v6.1/inventory_cards - Method:
GET - Authentication:
X-API-KEY
2. Tham số Request
2.1. Filtering
| Trường | Bắt buộc | Hỗ trợ | Kiểu | Mô tả |
|---|---|---|---|---|
product_id | Có | eq | integer | ID sản phẩm (số nguyên dương) |
sheet_date:gte | Không* | gte | datetime | Từ ngày (Public API: nếu không gửi → mặc định 2000-01-01 00:00:00) |
sheet_date:lte | Không* | lte | datetime | Đến ngày (Public API: nếu không gửi → mặc định thời điểm hiện tại) |
* Service public tự gán mặc định trước khi gọi domain; client vẫn nên gửi rõ khoảng ngày để kết quả có ý nghĩa.
| Trường (tùy chọn) | Hỗ trợ | Kiểu | Mô tả |
|---|---|---|---|
store_id | eq | integer | Kho |
category_id | eq | integer | Danh mục |
product_name | eq, contains | string | Tên SP |
product_code | eq, contains | string | Mã SP |
(các product_* khác + custom field SP) | Theo domain | — | Giống cấu hình filter sản phẩm trên domain |
2.2. Search
search— phạm vi:product_name.
2.3. Fields
fieldsdạng CSV (needed_info).- Mặc định: chỉ
id. - Các trường có thể yêu cầu (domain):
| Trường | Mô tả |
|---|---|
id | Định danh dòng thẻ kho |
product_code | Mã sản phẩm |
product_name | Tên sản phẩm |
product_featured_image | Ảnh SP |
store_name | Tên kho |
period_start_quantity | Tồn đầu kỳ |
in_quantity | Nhập trong kỳ |
out_quantity | Xuất trong kỳ |
period_end_quantity | Tồn cuối kỳ |
inventory_card_detail | Chi tiết các phiếu liên quan trong kỳ — nặng, chỉ thêm khi cần |
variants | Biến thể — bắt buộc kèm inventory_card_detail trong fields |
2.4. Pagination
| Tham số | Kiểu | Mô tả |
|---|---|---|
limit | integer | Giới hạn |
offset | integer | Phân trang |
3. Response mẫu
{
"data": [
{
"id": "101-1",
"product_code": "SP001",
"product_name": "Sản phẩm mẫu",
"store_name": "Kho chính",
"period_start_quantity": 50,
"in_quantity": 30,
"out_quantity": 10,
"period_end_quantity": 70
}
],
"has_more": false,
"offset": 0,
"limited": 100
}
(Giá trị id có thể là composite identity product_id + store_id tùy phiên bản — kiểm tra response thực tế.)
4. Ghi chú
- Khi cần chi tiết từng phiếu trong kỳ, thêm
inventory_card_detailvàofields(có thể làm tăng độ phức tạp xử lý). - Nếu dùng
variants, luôn kèminventory_card_detail.
Ví dụ curl
curl -g --location 'https://example.getflycrm.com/api/v6.1/inventory_cards?filtering[product_id]=101&filtering[sheet_date:gte]=2026-01-01&filtering[sheet_date:lte]=2026-03-31&fields=id,product_code,product_name,period_start_quantity,in_quantity,out_quantity,period_end_quantity&limit=100' \
--header 'X-API-KEY: <your_api_key>'