擷取訂單詳情

使用 GraphQL 擷取您的訂單詳情。

若要擷取 Zonos 系統中國際訂單的詳情,您可以查詢 GraphQL API。這可讓您擷取訂單詳情和與訂單相關的任何適用資訊,例如運費報價、落地成本報價等。

1

取得您的 API 金鑰

首先,在 Zonos Dashboard 中註冊 Zonos 帳戶並設定您的帳戶。之後,您可以取得 API 金鑰,以便使用 Zonos API 進行驗證。

由於 GraphQL 的運作方式,您可以只要求感興趣的欄位,或可選擇要求系統中與訂單相關的所有資訊——選擇權在您。請查閱 GraphQL API 參考以了解可用的欄位。

與訂單相關的資訊(例如 落地成本報價詳情、運費報價詳情、購物車詳情等)可以通過將這些物件中的欄位新增到您的 order 查詢中來透過圖表進行查詢。

至少,您需要訂單號碼才能查詢 API。這通過 GraphQL 請求中變數內的 orderId 欄位傳遞。

1query order($orderId: String!) {
2 order(orderId: $orderId) {
3 # ... other field names here
4 }
5}

現在您已建立並設定了請求,可以將 POST 請求傳送至 Zonos API。請確保使用 API 金鑰進行驗證,並在請求中提供正確的版本標題。

POST https://api.zonos.com/graphql

1query order($orderId: String!) {
2 order(orderId )
3 accountOrderNumber
4 amountSubtotals
5 duties
6 taxes
7 fees
8 shipping
9 items
10 
11 landedCosts
12 id
13 rootId
14 tariffRate
15 duties
16 amount
17 currency
18 formula
19 item
20 id
21 description
22 
23 exchangeRate
24 rate
25 sourceCurrencyCode
26 targetCurrencyCode
27 
28 
29 fees
30 amount
31 currency
32 description
33 note
34 formula
35 
36 item
37 id
38 description
39 
40 exchangeRate
41 rate
42 
43 
44 taxes
45 amount
46 currency
47 formula
48 item
49 id
50 description
51 
52 exchangeRate
53 rate
54 
55 
56 deMinimis
57 formula
58 method
59 note
60 threshold
61 
62 
63 shipmentRating
64 id
65 amount
66 currencyCode
67 displayName
68 minTransitAt
69 maxTransitAt
70 details
71 amount
72 carrierCode
73 
74 
75 amountSubtotals
76 shipping
77 fuelSurcharge
78 insuranceCost
79 otherSurcharge
80 
81 shipmentRatingCartons
82 chargeableWeight
83 carton
84 length
85 width
86 height
87 weight
88 
89 
90 shippingProfile
91 id
92 customServiceLevelCode
93 landedCostMethod
94 serviceLevel
95 code