For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 します。

エンドポイント

Method
Path
用途

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)を返します。


エラー

エンドポイント固有:

Status
条件
レスポンス例

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 列)。集計 view lm_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?