8

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

Upendra
  • 716
  • 9
  • 17
  • Post you code. The error is clear...https://www.usps.com/webtools/htm/Rate-Calculators-v1-3.htm didn't even work for me. The API name would likely be RateV3 not RateV4 based on the htm page. – Security Hound Oct 25 '11 at 12:43
  • USPS test servers do not support V4. Requested access to prod servers, and it is working fine. Thanks. Too bad that it is not clearly mentioned ANYWHERE... (Just executed two dummy requests using V2, and got access to prod servers.) – Upendra Oct 25 '11 at 18:59

3 Answers3

7

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.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • Thanks Simon. That's what I keep thinking. But they have mentioned that "the address to the test server is either http://testing.shippingapis.com/ShippingAPITest.dll or https://secure.shippingapis.com/ShippingAPITest.dll". Will have to again try to contact Customer Care :-( – Upendra Oct 25 '11 at 07:35
  • 2
    Turns out it is not the code which is causing the problem. USPS test servers do not support V4 of the rate API. V2 ran fine. Requested USPS for prod server access and V4 ran perfactly fine. Thanks again. – Upendra Oct 25 '11 at 18:57
  • 3
    And for those who are trying V2 of international shipping rates, that is not supported by test servers. You have to get access to prod servers for testing! – Upendra Oct 25 '11 at 19:00
  • 6
    V2 is no longer supported by the test servers. How they expect anyone to use them is beyond me. – CountMurphy May 30 '12 at 20:27
2

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>
Jeff Lambert
  • 24,395
  • 4
  • 69
  • 96
Loren Paulsen
  • 8,960
  • 1
  • 28
  • 38
  • I just ran into the same problem. When I contacted USPS through their tech support email address, they replied that the tests aren't required for the Rate API and that they could go ahead and move my account to the production server. – arlomedia Apr 08 '13 at 23:24
1

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

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

Hasan Savran
  • 367
  • 2
  • 5
  • When I was trying to do that, the error number was same. Good that they have changed the Description to something that makes sense. :-) – Upendra Jul 28 '12 at 04:35