获取预订

本指南将指导您如何通过JUSDA API获取预订信息。

认证方式

JUSDA使用API密钥进行身份验证。目前,API密钥是由JUSDA的技术团队分配的。要获取密钥,请联系您的JUSDA销售代表。

获得API密钥后,要进行身份验证,有必要在每次调用的HTTP header中传递密钥。Header的key为 x-api-key, 将密钥作为值传递。例如: x-api-key=34A81032-979E-4EFC-9A6F-XXXXXXXXXXXX

如果在对您的密钥进行身份验证时有任何问题,则API将在响应中回复HTTP代码401。

测试

JUSDA可能会为您提供测试环境的API密钥。如果您具有生产环境的API密钥,则可以通过在端点的查询字符串中加入环境属性来在任何API调用上使用测试环境。例如:

https://services.jusdausa.com/api/v1/Rates?environment=Test

API端点

JUSDA API的URL为:

https://services.jusdausa.com/api/v1

向此端点添加您正在访问的资源。例如,获取预订的端点是:

https://services.jusdausa.com/api/v1/Bookings

Bookings URL参数

/Bookings API在其查询字符串中接受各种过滤器值,并支持分页。以下是一些API调用示例,并说明了查询的执行方式。

https://services.jusdausa.com/api/v1/Bookings?batchId=52c98625-9340-4bdd-974a-d615bb7b169e

上面的示例将获取与BatchId 52c98625-9340-4bdd-974a-d615bb7b169e相关的所有预订。


https://services.jusdausa.com/api/v1/Bookings?limit=10

上面的示例将获取10个最近的预订。


https://services.jusdausa.com/api/v1/Bookings?limit=10&page=3

Limit指定要返回的最大行数。Page指定页码。在示例情况下,将获取位置20-29的预订。

获取预订的查询字符串参数

在HTTP GET查询字符串中使用以下任何参数,以过滤搜索现有预订。

  • modifiedDateFrom: (可选) 支持搜索在日期范围内创建或更新的预订
  • modifiedDateTo: (可选) 支持搜索在日期范围内创建或更新的预订
  • bookingId: (可选) 根据BookingId获取特定的预订
  • bookingIdentifier: (可选) 根据您在请求中提供的预订标识符获取所有预订
  • batchId: (可选) 根据BatchId获取该批次中的所有预订
  • limit: (可选) 默认值为100
  • page: (可选) 默认值为1
  • environment: (可选) Test或者Production. 默认值为Production.

响应示例


            [
                {
                    "bookingId": "e059ba92-199b-42aa-90f3-45a3a878f89e",
                    "bookingIdentifier": "11001",
                    "batchId": "52c98625-9340-4bdd-974a-d615bb7b169e",
                    "rateResponseId": null,
                    "quoteId": null,
                    "mode": "Parcel",
                    "shipperName": "Test Shipper",
                    "shipperAddress1": "5031 Halison Street",
                    "shipperAddress2": null,
                    "shipperCity": "Torrance",
                    "shipperStateProvince": "CA",
                    "shipperPostalCode": "90503",
                    "shipperCountry": "US",
                    "shipperTelNo": null,
                    "shipToName": "Test Consignee",
                    "shipToAddress1": "847 Spring Creek Court",
                    "shipToAddress2": null,
                    "shipToCity": "Elk Grove Village",
                    "shipToStateProvince": "IL",
                    "shipToPostalCode": "60007",
                    "shipToCountry": "US",
                    "shipToTelNo": null,
                    "residential": false,
                    "shipDate": null,
                    "carrierName": "UPS",
                    "serviceLevel": "Ground",
                    "pickupRemarks": null,
                    "deliverRemarks": null,
                    "goodsDescription": null,
                    "declaredValue": null,
                    "declaredValueCurrencyCode": null,
                    "shipperReferenceNo": null,
                    "shipperReferenceNo2": null,
                    "modifiedDate": "2021-01-09T01:06:21.4679348",
                    "items": [
                        {
                            "description": null,
                            "pieces": 1,
                            "packType": null,
                            "weight": 5,
                            "weightUnit": "LB",
                            "length": 2,
                            "width": 7,
                            "height": 3,
                            "dimensionUnit": "IN",
                            "freightClass": null,
                            "nmfc": null,
                            "hazardous": false,
                            "packageIdentifier": "P10001"
                        }
                    ],
                    "labels": [
                        {
                            "bookingLabelId": "a1ba1231-c0e0-4af1-4fb4-08d7f8717447",
                            "carrierTrackingNo": "1ZE373200197240008",
                            "labelUri": "https://jusda.blob.core.windows.net/upslabel/1ZE373200197240008.jpg?st=2020-05-15T01%3A51%3A19Z&se=2021-05-15T01%3A52%3A19Z&sp=r&spr=https&sv=2019-02-02&sr=b&sig=fDnZAM/hsWoZ5h716TmPWqYtHWbVOx0mc2eAgYjPsN0%3D"
                        }
                    ]
                },
                {
                    "bookingId": "3f54701d-8d46-4827-8043-f19fe34151bc",
                    "bookingIdentifier": "11001",
                    "batchId": "7f289154-9403-4e3c-92f8-55f9746f3370",
                    "rateResponseId": null,
                    "quoteId": null,
                    "mode": "Parcel",
                    "shipperName": "Test Shipper",
                    "shipperAddress1": "5031 Halison Street",
                    "shipperAddress2": null,
                    "shipperCity": "Torrance",
                    "shipperStateProvince": "CA",
                    "shipperPostalCode": "90503",
                    "shipperCountry": "US",
                    "shipperTelNo": null,
                    "shipToName": "Test Consignee",
                    "shipToAddress1": "847 Spring Creek Court",
                    "shipToAddress2": null,
                    "shipToCity": "Elk Grove Village",
                    "shipToStateProvince": "IL",
                    "shipToPostalCode": "60007",
                    "shipToCountry": "US",
                    "shipToTelNo": null,
                    "residential": false,
                    "shipDate": null,
                    "carrierName": "UPS",
                    "serviceLevel": "Ground",
                    "pickupRemarks": null,
                    "deliverRemarks": null,
                    "goodsDescription": null,
                    "declaredValue": null,
                    "declaredValueCurrencyCode": null,
                    "shipperReferenceNo": null,
                    "shipperReferenceNo2": null,
                    "modifiedDate": "2021-01-08T20:58:38.6737778",
                    "items": [
                        {
                            "description": null,
                            "pieces": 1,
                            "packType": null,
                            "weight": 5,
                            "weightUnit": "LB",
                            "length": 2,
                            "width": 7,
                            "height": 3,
                            "dimensionUnit": "IN",
                            "freightClass": null,
                            "nmfc": null,
                            "hazardous": false,
                            "packageIdentifier": "P10001"
                        }
                    ],
                    "labels": [
                        {
                            "bookingLabelId": "e1e266da-a7b1-4895-7621-08d7f9152d53",
                            "carrierTrackingNo": "1ZE373200195450213",
                            "labelUri": "https://jusda.blob.core.windows.net/upslabel/1ZE373200195450213.jpg?st=2020-05-15T21%3A15%3A03Z&se=2021-05-15T21%3A16%3A03Z&sp=r&spr=https&sv=2019-02-02&sr=b&sig=M2MdboAOr4ajQ/TFPkgcywjCcia3tMr6x76ii4noXNw%3D"
                        }
                    ]
                }
            ]