Reputation: 115
I am using UPS API for CANADA and USA countries, the shipment origin will always be Canada.
The below is a request I am passing to get the UPS rates and to get an Estimated Arrival Time. If I pass the below request parameters for Canada address it works fine in response, but if I pass an US address in UPS API request parameters it throws an Invalid Shipment Contents Value
error.
Here are the UPS API Request and its Response that works fine for the Canada address, but does not work for any US addresses:
Request
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>******</AccessLicenseNumber>
<UserId>*****</UserId>
<Password>*****</Password>
</AccessRequest><?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Shoptimeintransit</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
<Description>Regular Daily Pickup</Description>
</PickupType>
<Shipment> <Shipper><ShipperNumber>****</ShipperNumber> <Address>
<City>Scarborough</City>
<PostalCode>M1G 0A6</PostalCode>
<CountryCode>CA</CountryCode>
<StateProvinceCode>ON</StateProvinceCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>14304</PostalCode>
<CountryCode>US</CountryCode>
<ResidentialAddress>02</ResidentialAddress>
<StateProvinceCode>NY</StateProvinceCode> </Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>M1G 0A6</PostalCode>
<CountryCode>CA</CountryCode>
<StateProvinceCode>ON</StateProvinceCode>
</Address>
</ShipFrom>
<DeliveryTimeInformation>
<PackageBillType>03</PackageBillType>
</DeliveryTimeInformation>
<Package>
<PackagingType>
<Code>00</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>0.2</Weight>
</PackageWeight>
</Package>
<ShipmentTotalWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>0.2</Weight>
</ShipmentTotalWeight><RateInformation><NegotiatedRatesIndicator/></RateInformation> </Shipment>
</RatingServiceSelectionRequest>
RESPONSE
<RatingServiceSelectionResponse>
<Response>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<ResponseStatusCode>0</ResponseStatusCode>
<ResponseStatusDescription>Failure</ResponseStatusDescription>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>111549</ErrorCode>
<ErrorDescription>Invalid Shipment Contents Value.</ErrorDescription>
</Error>
</Response>
</RatingServiceSelectionResponse>
What am I doing wrong in the above request for the US address?
Upvotes: 4
Views: 2248
Reputation: 115
Finally I found the solution for my problem from this source.
https://medium.com/@soni.manthan0/ups-api-get-estimated-delivery-date-456f00e70742
As per the above link, it says it requires to add new <InvoiceLineTotal>
section in <shipment>
section and <city>
is required in <ShipTo>
section.
Upvotes: 5
Reputation: 528
It seems pretty frequent error when using this API. I did some googling and these are some links with info I've found.
https://twitter.com/shippo/status/952965049840054272
https://www.ups.com/lk/en/help-center/sri/apishippingerror.page
There is also this guide, maybe it could be usefull.
Upvotes: 2