Qeasy Cloud
Get Started
POSThttps://api.wangdian.cn/openapi2/stock_query.phpsid + appkey + MD5 签名

Stock Query (stock_query)

旺店通企业版库存查询接口,按仓库与货品维度分页拉取库存量、可用量与在途量,用于全渠道库存下发、超卖防控与补货计算。

## Overview stock_query.php reads SKU-level stock in WDT Enterprise ERP, returning on-hand, available and locked quantities per warehouse and item. It is the key extraction point for unified-inventory setups where WDT is the stock ledger and sellable quantities are written back to each sales channel by shop/platform quota. ### Request essentials 1. Build common parameters per the signing rules; submit business parameters as form fields. 2. Paginate with pageno + pagesize; iterate per warehouse (warehouse_no) so a single warehouse's full scan cannot time out. 3. spec_no pins the query to one SKU — handy for stock-calibration jobs. 4. On status = 0, data.stocks carries warehouse_no, spec_no, goods_no, stock_num (on hand), available_num (available) and lock_num (locked). ### Semantics and pitfalls - The sellable figure is available_num, not stock_num; also subtract an occupancy buffer for unpaid in-flight orders before pushing to marketplaces. - Stock is a snapshot; incremental sync needs snapshot diffing or the stock-change companion APIs. Qeasy's "scheduled snapshot + delta push" strategy cuts write volume to sales channels by an order of magnitude. - In multi-warehouse setups, watch transfer-in-transit to avoid double counting. ### Relationship to stock-sync APIs stock_query reads stock. A self-owned mall loop also needs the stock-change query (api_goods_stock_change_query.php) and the stock-sync acknowledgment endpoints to carry ERP changes into platform sellable quantities. Define the semantic gap between ERP book stock and platform sellable stock explicitly during solution design — otherwise the first week online will be spent explaining inventory mismatches to the business.

Code examples

curl
curl -X POST "https://api.wangdian.cn/openapi2/stock_query.php" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "sid=myshop&appkey=AK123&timestamp=1780000000&sign=SIGN" \
  -d "warehouse_no=WH001&pageno=0&pagesize=100"

Error codes

CodeMessageMeaning
100sign 校验失败签名错误
102appkey 无权限未开通 stock_query 接口授权