ups

UPS Rating API Error: 111546 (Invalid Weight)


First time posting here, hope I'll ask my questions the right way :D

What I am doing I'm currently trying to integrate the UPS API's into an internal web application (using the Yii2-Framework) for my company. It's been quite the journey handling this documentation and finding (correct) information... UPS Shipping works fine, but I'm stuck with the Rating-API, when I try to rate a shipment in Shop-Option with TimeInTransit. I've been using JSON for all API's up until now.

What is wrong No matter what RequestOption or weight I try, it always responds with "Invalid Weight".

What I have tried As per the documentation, the string for the package weight must be exactly 6 characters long (odd, as that isn't the case for the Shipping API). With UnitOfMeasurement set to KGS, I tried every combination of 1, 10, 100 and 1000kg with Decimalpoints and -commas, both considering the Decimaldelimiter as a character and not,(even just having a 1, because that works fine when not including the TimeInTransit-Options) but the response is always the same. I tried googling the Error to see if somebody has had the same issue, or if find more information on this, but I haven't found anything usefull (or oversaw it). I've included my JSON below, did I do something wrong and don't see it?

JSON-Request

{ 
  "RateRequest": {
    "Request": {
      "SubVersion": "v2205",
      "RequestOption": "shoptimeintransit",
      "TransactionReference": {
        "CustomerContext": "TEST"
      }
    },
  "Shipment": {
    "Shipper": {
      "Name": "[CompanyName",
      "AttentionName": "[ContactName]",
      "Phone": {
        "Number": "[Number]"
      },
      "ShipperNumber": "[Number]",
      "Address": {
        "AddressLine": "[Some Address]",
        "City": "[Some City]",
        "PostalCode": "[Some ZIP]",
        "CountryCode": "DE"
      } 
    },
    "ShipTo": {
      "Name": "Mustermann GmbH",
      "Address": {
        "AddressLine": "Mustergasse 11",
        "City": "Musterstadt",
        "PostalCode": "123456",
        "CountryCode": "DE"
      }
    },
    "PaymentDetails": {
      "ShipmentCharge": {
        "Type": "01",
        "BillShipper": {
          "AccountNumber": "[Number]"
        }
      }
    },
    "Package": [ 
      {
        "PackagingType": {
          "Code": "02"
        },
        "Dimensions": {
          "UnitOfMeasurement": {
            "Code": "CM",
            "Description": "Centimeters"
          },
          "Length": "10",
          "Width": "10",
          "Height": "10"
        },
        "PackageWeight": {
          "UnitOfMeasurement": {
            "Code": "KGS",
            "Description": "Kilograms"
          },
          "Weight": "10.000"
        }
      }
    ],
    "DeliveryTimeInformation": {
      "PackageBillType": "03"
    }
   }
  }
}

Parameters version: v2205
RequestOption: shoptimeintransit
transactionSrc: testing

Used in the "Try It"-Section on developer.ups.com

If some Info's missing, I'll happily abide, this has been a dreadful ride till now...


Solution

  • If you are doing an international shipment, you need to add the ShipmentTotalWeight field under the Shipment field.

    {
        "Shipment": {
            "ShipmentTotalWeight": {
                "UnitOfMeasurement": {
                    "Code": "KGS",
                    "Description": "Kilograms"
                },
                "Weight": "10"
            }
        }
    }
    

    According to the UPS document for this field:

    Shipment Total Weight Container. This container is only applicable for "ratetimeintransit" and "shoptimeintransit" request options. Required for all international shipments when retreiving time in transit information, including letters and documents shipments.