多个发货日期的UPS Rates API问题

时间:2017-09-25 16:34:10

标签: json api ups

我正在使用UPS Rates API(基于JSON,选项Shoptimeintransit)来获取所提供发货日期的可用交货日期。

https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_CA

在DeliveryTimeInformation中,我正在设置取件信息。

{
  "Security": {
    "UsernameToken": {
      "Username": "xxxxxxx",
      "Password": "xxxxxxx"
    },
    "UPSServiceAccessToken": {
      "AccessLicenseNumber": "xxxxxxxxxxx"
    }
  },
  "RateRequest": {
    "Request": {
      "RequestOption": "Shoptimeintransit",
      "TransactionReference": {
        "CustomerContext": "Your Customer Context"
      }
    },
    "CustomerClassification": {
      "Code": "00" 
    },
    "PickupType": {
      "Code": "06" 
    },
    "Shipment": {
      "DeliveryTimeInformation": {
        "PackageBillType": "07",
        "Pickup": {
          "Date": "20170925",
          "Time": "1140"
        }
      },
      "Shipper": {

        "ShipperNumber": "xxxxxxx",
        "Address": {
          "City": "Kansas City",
          "StateProvinceCode": "MO",
          "CountryCode": "US",
          "PostalCode": "xxxx"
        }
      },
      "ShipTo": {

        "Address": {
          "City": "Redwood",
          "StateProvinceCode": "CA",
          "CountryCode": "US",
          "PostalCode": "xxxx"
        }
      },
      "ShipFrom": {

        "Address": {
          "City": "Kansas City",
          "StateProvinceCode": "MO",
          "CountryCode": "US",
          "PostalCode": "xxxx"
        }
      },
      "Package": {
        "PackagingType": {
          "Code": "02" 
        },
        "Dimensions": {
          "UnitOfMeasurement": {
            "Code": "IN" 
          },
          "Length": "5",
          "Width": "4",
          "Height": "3"
        },
        "PackageWeight": {
          "UnitOfMeasurement": {
            "Code": "LBS" 
          },
          "Weight": "1"
        }
      },

      "NumOfPieces": "3",
      "ShipmentRatingOptions": {
        "NegotiatedRatesIndicator": ""
      }
    }
  }
}

问题是,我需要下一个N个发货日期的可用交货日期,但API仅在DeliveryTimeInformation>中采用单个发货日期。皮卡部分。

因此,一种可能性是调用API N次并合并结果,这似乎不是一个好主意。

任何人都知道用于将取件日期作为列表的任何相关API,并返回所有可能的交付日期,所提供数据的服务代码。

1 个答案:

答案 0 :(得分:2)

文档状态Max Allowed: 1代表DeliveryTimeInformation,所以没有。

您可以通过客户服务申请下一次API更新(每年1月和7月),但在此之前您必须提出N次请求。