سؤال

I need to get shipping rates from USPS.

I have signed up with them, got myself a user id and trying to use the sample request XML as shown on page - https://www.usps.com/webtools/htm/Rate-Calculators-v1-3.htm , but keeping getting following error response.

<Error>
<Number>80040b1a</Number>
<Description>API Authorization failure. RateV4 is not a valid API name for this protocol.</Description>
<Source>UspsCom::DoAuth</Source>

I cant figure out where I am missing the point. Google has not been helpful as well :-(

I am passing the API name as RateV4. I have tried with the international shipping API as well - IntlRateV2. And yes, I have tried the Secure https://secure.shippingapis.com/ShippingAPITest.dll api as well. And I have mailed to support staff. Nothing has worked.

Once this basic thing works, I plan to get the classes and use custom serialization to serialize my request and then deserialize the response. That would be better than using XMLs directly. But that would probably more suitable as other question. Getting the basic thing working is a concern right now. Thanks

هل كانت مفيدة؟

المحلول

It means the server you are targeting does not support the RateV4. I think you need to use the production server for RateV4 even when doing tests.

نصائح أخرى

At the present time, no version of the Rate API actually works on the USPS test servers (as noted by CountMurphy on a previous comment). However, you need several successful API requests on the test server before your account will be approved for access to the production server. After some back and forth with USPS, they pointed me to certifying the TrackV2 API instead. This gives you access to the Rate API as well.

Here are two example TrackV2 requests I was given by USPS support. Be sure to include your actual USERID value. You must use these exact label numbers.

Example #1

http://production.shippingapis.com/ShippingAPITest.dll?API=TrackV2
&XML=<TrackRequest USERID="xxxxxxxx">
<TrackID ID="EJ958083578US"></TrackID></TrackRequest>

Example #2

http://production.shippingapis.com/ShippingAPITest.dll?API=TrackV2
&XML=<TrackRequest USERID="xxxxxxxx">
<TrackID ID="EJ958088694US"></TrackID></TrackRequest>

When you try V2, that's what you will get

<Error>
<Number>80040b1a</Number>
<Description>API Disabled: RateV2.  </Description>
<Source>UspsCom::DoAuth</Source>

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top