DOCS

透過 API 連接

連接 DHL 承運商帳戶

安全連接您的 DHL 承運商帳戶,即可取得議定運費,並直接透過 Zonos 建立標籤。

開始使用 

DHL 承運商帳戶連接程序會驗證您的憑證,並確保您的帳戶已正確設定,以便擷取運費及生成運輸標籤。當您連接 DHL 帳戶時,Zonos 會先執行測試評級呼叫,確認連接運作正常,然後才儲存您的憑證。

如要向 DHL Express 註冊,或透過您的 Zonos Dashboard 進行設定,請按照此指南中的步驟操作。

DHL 承運商帳戶連接的運作方式 

連接您的 DHL 承運商帳戶時:

  • 驗證您是否已為 DHL 提供正確的憑證類型
  • 向 DHL API 發出即時評級呼叫,確認憑證有效
  • 將您已連接的帳戶儲存在 Zonos,供日後發貨評級及建立標籤使用
  • 傳回已連接帳戶的詳細資料,包括您的 DHL 帳戶資訊及費率類型

連接後,您的 DHL 承運商帳戶即可用於根據您的議定費率(如適用)取得即時運費,並建立 DHL 運輸標籤。

連接您的 DHL 帳戶 

使用 carrierAccountConnect 變更,透過您的憑證連接 DHL 承運商帳戶。

變更

使用此變更連接您的 DHL 承運商帳戶並驗證您的憑證。

1mutation CarrierAccountConnect($input: CarrierAccountConnectInput!) {
2 carrierAccountConnect(input: $input) {
3 errors
4 carrierAccount {
5 credentialProvider
6 id
7 integrationType
8 organization
9 rateType
10 carrier {
11 id
12 code
13 name
14 }
15 credentials {
16 type
17 value
18 }
19 }
20 }
21}

變數

此變更需要 DHL 承運商代碼、費率類型,以及您的 DHL 帳戶憑證。

1{
2 "input": {
3 "carrierCode": "DHL",
4 "rateType": "NEGOTIATED",
5 "credentials": [
6 {
7 "type": "API_KEY",
8 "value": "actual_api_key_value"
9 },
10 {
11 "type": "API_PASSWORD",
12 "value": "actual_api_password_value"
13 },
14 {
15 "type": "ACCOUNT_NUMBER",
16 "value": "actual_account_number_value"
17 }
18 ]
19 }
20}

DHL 需要以下憑證類型:

  • API_KEY - 您的 DHL API 金鑰
  • API_PASSWORD - 您的 DHL API 密碼
  • ACCOUNT_NUMBER - 您的 DHL 帳戶號碼

您可以在 DHL 帳戶入口網站中找到這些憑證,或聯絡您的 DHL 帳戶代表取得。

回應範例

成功連接

當憑證有效且 DHL 成功傳回費率時:

1{
2 "data": {
3 "carrierAccountConnect": {
4 "errors": [],
5 "carrierAccount": {
6 "credentialProvider": "ORGANIZATION",
7 "id": "carrier_account_123",
8 "integrationType": "REST",
9 "organization": "organization_id",
10 "rateType": "NEGOTIATED",
11 "carrier": {
12 "id": "carrier_123",
13 "code": "dhl",
14 "name": "DHL"
15 },
16 "credentials": [
17 {
18 "type": "API_KEY",
19 "value": "actual_api_key_value"
20 },
21 {
22 "type": "API_PASSWORD",
23 "value": "actual_api_password_value"
24 },
25 {
26 "type": "ACCOUNT_NUMBER",
27 "value": "actual_account_number_value"
28 }
29 ]
30 }
31 }
32 }
33}

錯誤:不支援的憑證類型

如果您提供的憑證類型不受 DHL 支援:

1{
2 "data": {
3 "carrierAccountConnect": {
4 "errors": [
5 "Credential type SITE_ID is not supported by carrier DHL"
6 ],
7 "carrierAccount": null
8 }
9 }
10}

錯誤:憑證無效

如果憑證類型有效,但未能成功通過 DHL 驗證:

1{
2 "data": {
3 "carrierAccountConnect": {
4 "errors": [
5 "Failed to get rating from DHL API"
6 ],
7 "carrierAccount": null
8 }
9 }
10}

連接後會發生什麼事

成功連接您的 DHL 承運商帳戶後:

  • 該帳戶會儲存在您的機構中,並與您的憑證連結
  • 您可以使用議定費率(如適用)擷取 DHL 運費
  • 您可以透過 Zonos API 建立 DHL 運輸標籤
  • 承運商帳戶可用於多次發貨,無需重新連接

下一步 

連接您的 DHL 承運商帳戶後:

GraphQL API ReferenceTypes, inputs, and operations used in this guide
預約演示

這個頁面有幫助嗎?