Authoritative Tutorial on the Jushuitan Allocate Order Query API Field Handbook: From Multi-Scenario Practice to Qeasy Cloud Configuration
What Problem This API Solves
The Jushuitan Allocate Order Query API (/open/allocate/query) is used to pull cross-warehouse transfer data (transfer-out and transfer-in) from the Jushuitan system by time window or document number, and write it into local data sources such as MySQL. Typical scenarios include cross-warehouse inventory transfer tracking, transfer-out/in reconciliation, FBA restock synchronization, financial cost accounting, and data integration with ERP/WMS. In the multiple customer projects we have worked on, this is the foundational data API for warehouse balancing and inventory visibility.
API Capability Overview
- Authentication: Standard signature authentication for the Jushuitan Open Platform (appkey + token + sign), typically encapsulated by the Qeasy Cloud adapter.
- Request structure:
POSTJSON body containing pagination parameterspage_index/page_size(max 50), time windowmodified_begin/modified_end,date_type(0 = modification time, 2 = inbound/outbound time),type(transfer-out/transfer-in),io_idsorso_ids(cannot be empty at the same time as the time range). - Response structure: The top-level
data.datasis an array of documents; each document contains main table fields, anitemsdetail array, and nestedlabels/snsobjects. - Pagination/Incremental: Standard cursor pagination, incremental by modification time or inbound/outbound time; typical schedule is
10 */2 * * *, rolling pull every 2 hours.
Typical Field Mapping
| Field Name | Type | Meaning | Practical Notes |
|---|---|---|---|
| io_id | string | Allocate order number (primary key) | Both number and id in metadata point to this field; recommended as MySQL primary key. |
| type | string | Transfer type (transfer-out/transfer-in) | The same API can query both transfer-out and transfer-in; default is "transfer-out". |
| status / f_status | string | Document status / financial status | Transfer-out "Confirmed" + transfer-in "Confirmed" is considered completed. |
| io_date / modified | string | Inbound/outbound date / modification time | The incremental window is based on this field; combine with date_type to differentiate. |
| wh_id / link_wh_id | string | Outbound warehouse / target warehouse | In transfer-out scenario wh_id→link_wh_id; reversed in transfer-in. |
| co_id / wms_co_id | string | Company / sub-warehouse code | Must be differentiated in multi-owner scenarios, otherwise warehouses will be confused. |
| link_io_id | string | Related allocate order number | The association key between paired transfer-out and transfer-in documents. |
| out_io_id | string | Outbound order number | The actual outbound document number in the transfer-out scenario. |
| so_id | string | Online order number | Bound to sales orders in scenarios such as FBA restocking. |
| receiver_* | string | Receiver state/city/district/address | In transfer scenarios, it refers to the target warehouse or receiver, different from sales outbound. |
| items_sku_id / items_qty / items_cost_price | string | Detail SKU / quantity / cost price | The items array needs to be flattened into items_* fields for the target table. |
| bfn_id / bfn_num / bfn_line | string | Batch ID / batch number / batch line number | Required for batch management scenarios, affects subsequent cost accounting. |
How to Configure on Qeasy Cloud
In the Qeasy Cloud Data Integration Platform, the call to this API typically uses the "Jushuitan Open Platform Adapter" to uniformly encapsulate authentication and signing. Developers only need to select /open/allocate/query on the data source configuration page and fill in AppKey/Secret. The incremental window is automatically bound through variable placeholders {{LAST_SYNC_TIME}} and {{CURRENT_TIME}}, eliminating the need to manually write cron expressions.
For field mapping, the Qeasy Cloud field mapper automatically expands the items array into flat items_* fields and supports the "REPLACE INTO" batch write mode. The write strategy for the target table jst_allocate_query can be configured with an AfterTargetGenerate hook script that unifies empty strings into null and filters emoji and four-byte characters, avoiding MySQL errors caused by character set issues.
Cross-Scenario Practical Points
- Incremental field must be one or the other:
date_type=0uses modified,date_type=2uses io_date; mixing them will cause documents in the same window to be missed or duplicated. - Transfer-out/in written as a pair: Transfer-out and transfer-in are two independent documents, linked through
link_io_id; it is recommended to build an index in the target table for easier reconciliation. - Multi-owner must carry co_id: We have seen cases in customer projects where omitting the owner code caused cross-warehouse data to mix together; the safe practice is to always pass it through.
- When to flatten items: Flattening at the Source end makes the configuration cleaner, but loses the original array structure; it is recommended to flatten before writing to Target, making it easier for subsequent SKU-dimensional analysis.
- Time window and specified document number are mutually exclusive:
io_ids/so_idsandmodified_begin/endcannot be empty at the same time, but you cannot pass specified document numbers and a time range together; the platform parameter validation has covered this. - Pagination cap of 50: The default page_size is 30; in actual scenarios it is recommended to explicitly set it to 50 to reduce the number of requests.
Troubleshooting Replay
- Empty string write to MySQL fails: Fields returned by Jushuitan often appear as
"", and writing directly to MySQL in strict mode will fail. This is a common pitfall; the safe practice is to useCOALESCEor platform hooks to convert empty strings tonullbefore writing. - Four-byte character truncation: If the receiver's name contains emoji or rare characters, the target table
utf8(not utf8mb4) will lose data. Be sure to filter before writing, or upgrade the target table character set. - Status field semantic confusion: Transfer-out "in transfer" corresponds to transfer-in "pending receipt"; making downstream business judgments based on a single status field will lead to misjudgment, and combined queries are needed to identify "completed".
- Incremental missed documents: In customer projects we have encountered cases where an allocate order is modified at a boundary time point, causing a "missed document" that is neither pulled in the previous window nor in the next window. It is recommended to add a 1–2 minute buffer at both ends of the window.
- Multi-warehouse code conflict: The semantics of
wh_idandlink_wh_idare reversed in transfer-out and transfer-in scenarios. If the in/out marker is not recorded when the document is written, subsequent warehouse balance reports will calculate the direction incorrectly.
When to Choose This
This API is suitable for scenarios that require cross-warehouse transfer visualization, transfer-out/in reconciliation, FBA restock synchronization, and batch-level cost accounting; if you only need single-warehouse inventory query or sales outbound synchronization, you should use the Jushuitan inventory query API or sales outbound order API instead, to avoid introducing an unnecessary complex state machine.