DOCS

通过 API 连接

连接 DHL 承运人账户

安全地连接您的 DHL 承运人账户,以访问协商运费并通过 Zonos 直接创建标签。

开始使用 

DHL 承运人账户连接过程验证您的凭证并确保您的账户被正确配置以检索运费和生成运单。当您连接您的 DHL 账户时,Zonos 会执行测试评级调用,以验证连接在存储您的凭证之前是否正常工作。

要向 DHL Express 注册或通过您的 Zonos Dashboard 进行设置,请按照本指南中的步骤操作。

DHL 承运人账户连接如何工作 

连接您的 DHL 承运人账户:

  • 验证您为 DHL 提供的凭证类型是否正确
  • 对 DHL API 进行实时评级调用以确认凭证有效
  • 在 Zonos 中存储您的已连接账户,供将来的货运评级和标签创建使用
  • 返回已连接的账户详情,包括您的 DHL 账户信息和运费类型

连接后,您的 DHL 承运人账户可用于获取基于协商运费(如适用)的实时运费,以及创建 DHL 运单。

连接您的 DHL 账户 

使用 carrierAccountConnect mutation 来连接您的 DHL 承运人账户及凭证。

Mutation

使用此 mutation 连接您的 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}

变量

该 mutation 需要 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
预约演示

这个页面有帮助吗?