Chuyển tới nội dung chính

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ườngBắt buộcHỗ trợKiểuMô tả
product_ideqintegerID sản phẩm (số nguyên dương)
sheet_date:gteKhông*gtedatetimeTừ ngày (Public API: nếu không gửi → mặc định 2000-01-01 00:00:00)
sheet_date:lteKhông*ltedatetimeĐế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ểuMô tả
store_ideqintegerKho
category_ideqintegerDanh mục
product_nameeq, containsstringTên SP
product_codeeq, containsstringMã SP
(các product_* khác + custom field SP)Theo domainGiống cấu hình filter sản phẩm trên domain
  • search — phạm vi: product_name.

2.3. Fields

  • fields dạng CSV (needed_info).
  • Mặc định: chỉ id.
  • Các trường có thể yêu cầu (domain):
TrườngMô tả
idĐịnh danh dòng thẻ kho
product_codeMã sản phẩm
product_nameTên sản phẩm
product_featured_imageẢnh SP
store_nameTên kho
period_start_quantityTồn đầu kỳ
in_quantityNhập trong kỳ
out_quantityXuất trong kỳ
period_end_quantityTồn cuối kỳ
inventory_card_detailChi tiết các phiếu liên quan trong kỳ — nặng, chỉ thêm khi cần
variantsBiến thể — bắt buộc kèm inventory_card_detail trong fields

2.4. Pagination

Tham sốKiểuMô tả
limitintegerGiới hạn
offsetintegerPhâ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_detail vào fields (có thể làm tăng độ phức tạp xử lý).
  • Nếu dùng variants, luôn kèm inventory_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>'