Cancel / Update — 取消・更新
確定済みの受注ルーティング(Routing)に対する 取消(cancel) と 更新(update)。引き当て先の各在庫ロケーションへ、それぞれ専用の action 別 dispatch 設定(Dispatch Config の action: "cancel" / "update")で WMS へ通知します。
Base URL
https://api.lmile.io· 認証x-ingest-secretヘッダー(詳細) ·shopはリクエストボディに含めます(省略するとキーのアカウント)
dispatch のアクション種別: create(出荷指示=通常の
/orders・既定)/ update(注文更新)/ cancel(注文取消)。location ごとに action 別の宛先・テンプレートを登録できます。設定の無い(location, action)は送信を skip します。
エンドポイント
POST
/api/routing/update
注文を最新内容で再ルーティング → update を dispatch
POST
/api/routing/cancel
注文を cancelled にし → cancel を dispatch
POST /api/routing/update
カート変更(SKU 追加・数量変更・宛先/ tag 変更)を全量の最新内容で受け直し、同一出荷元内で再ルーティングしてから各在庫ロケーションへ update を dispatch します。ボディは /api/routing/orders と同一契約(tag / shipTo / fulfillmentSourceLocationId / 任意 inventoryLocationId / lines)。
リクエスト
POST https://api.lmile.io/api/routing/update
x-ingest-secret: {INGEST_SECRET}
Content-Type: application/json{
"shop": "demo-store.myshopify.com",
"sourceSystem": "shopify",
"externalOrderRef": "1001",
"fulfillmentSourceLocationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"tag": "express",
"shipTo": { "name": "山田 太郎", "prefecture": "東京都", "address1": "道玄坂1-2-3" },
"lines": [ { "barcode": "1234567890123", "quantity": 3 } ]
}既存の routing order が前提(無ければ
404)。routingOrderIdを併記すればそれで特定、無ければsourceSystem + externalOrderRef。cancelled済の注文は更新不可(409)。明細単位の
properties(Routing のlines[].properties)も全量の最新内容で受け直し、再ルーティング後の decision / unit / 出荷指示に反映します(同一barcode複数明細のグルーピングも/ordersと同じ挙動)。出荷指示の冪等キーは元注文の
idempotencyKeyを維持(create→update で同一行を更新)。レスポンスは
/ordersと同形(status/shippingInstruction/dispatches[])。dispatchesはupdate設定で送信。
POST /api/routing/cancel
注文を cancelled にし、引き当て済の各在庫ロケーションへ cancel を dispatch します。あわせて内部の出荷状態(出荷元ヘッダ lm_fulfillment_shipments / 単位明細 lm_fulfillment_units / 出荷指示 lm_shipping_instructions)も cancelled に同期します。
リクエスト
shop
string
店舗ドメイン(省略するとキーのアカウント)
routingOrderId
string (uuid)
△
対象注文。無ければ sourceSystem + externalOrderRef で特定
sourceSystem / externalOrderRef
string
△
routingOrderId 未指定時に必須
冪等: 既に
cancelledなら再 dispatch / 再 cascade せずidempotent: trueを返す。取消は SoT 側で常に確定(
status=cancelled)。WMS へのcancel通知は best-effort(失敗はdispatches[]に記録、注文取消自体は確定)。内部 SoT へ cascade:
lm_fulfillment_shipments/lm_fulfillment_unitsをstatus='cancelled'(+cancelled_at)に、lm_shipping_instructionsをdelivery_status='cancelled'に更新します。shipped(出荷完了)は終端として保護し上書きしません(追跡番号・ラベル PDF は監査用に温存)。在庫数量(inventory_levels)は「状態のみ」方針のため変更しません。取消時の cascade 件数はレスポンスの
cancelledShipments/cancelledUnits/shippingInstructionCancelledに返します。
レスポンス
update / cancel 共通で ok / routingOrderId / status / shippingInstruction / dispatches[] を返します。cancel はさらに cascade 結果(cancelledShipments / cancelledUnits / shippingInstructionCancelled)を返します。
エラー
エンドポイント固有:
400
注文特定情報なし / (update)バリデーション失敗
{ "ok": false, "error": "..." }
404
注文が存在しない
{ "ok": false, "error_kind": "not_found", "error": "routing order not found" }
409
取消済の注文を update
{ "ok": false, "error_kind": "order_cancelled", "error": "cancelled order cannot be updated" }
422
(update) 出荷元未解決 / メンバー無し / 指定 location 非メンバー
fulfillment_source_unresolved / fulfillment_source_no_members / location_not_member_of_source
共通エラー(401 / 400 / 403 / 405 / 500 / 503)は Error Codes を参照。
データモデル
sot.lm_routing_orders.statusにcancelledを追加。sot.lm_location_dispatch_config.action(create/update/cancel、UNIQUE(shop, location_id, tag, action))。sot.lm_location_dispatch_log.actionで送信ごとの action を記録。sot.lm_fulfillment_shipments.status/sot.lm_fulfillment_units.statusにcancelledを追加(+cancelled_at列)。集計 viewlm_v_routing_order_fulfillment(cancelled_count)/lm_v_routing_order_unit_fulfillment(cancelled_unit_count)にcancelled分類を追加。sot.lm_shipping_instructions.delivery_statusにcancelledを追加。
Last updated
Was this helpful?