RSS
 

USPS Shipping XML API Testing Idiosyncrasies

20 May

If you’re a web developer and happen to develop software for use in e-commerce, chances are, somewhere along the lines you’ll need or want to integrate with the big 4 shippers’ (UPS, USPS, FedEx, DHL) APIs.  You’ll find right off the bat that they all offer rather robust APIs, so your options are sufficient.

Then you’ll get to programming and realize that the documentation is pretty crappy, but specifically I want to address the idiosyncrasies of the USPS “test” environment.  Effectively, what USPS means when they say “test” is not a test of robustness of your application, but simply whether or not your application can build a sample request (an EXACT sample request), and send it to their server.  Yeah — it’s like asking a math teacher to write the numbers 1 to 30 on a sheet of paper (in order) before he/she can get hired.

The problem is, the USPS docs don’t tell you this, nor do they show you the sample request.  So, for others who are about to embark on a few hour journey finding these details on Google (or worse, emailing USPS directly …eeek) I’m going to sum up a few facts here.

The most laborious for me so far is the one I already mentioned above.  For a rate request, the docs show you a RateV3Request, but in testing you can only use a RateV2 request (which does not support package dimensions).  Also, you must use the zip codes 10022 and 20008 for origination and zip, as well as 10 lbs. 5 oz. for the weight, and “LARGE” for the size.  Everything else (LAUGH) you have leeway with.

If you don’t use these exact values, you’ll get responses like “Please enter a valid zip code for the sender” (which of course makes you think you wrote the XML incorrectly) or “The package size must be ‘Regular’, ‘Large’, or ‘Oversize.’” (even though you have “regular” quite clearly in the request.

The advice is to get to production as soon as possible, though why USPS would design things this way is beyond me, but them’s the cards, you gotta play ‘em.

I will add more here as I find them obstaclicious enough (yeah I just made up that word).

Amendment 1:  I should add that the issues about the documentation not mentioning the “canned” requests is only applicable to the PDF documentation.  It is stated quite clearly in the HTML versions.  Go figure …

 

Tags: , , , , , , , , , , , , , , , , , , ,

Leave a Reply

 

 
  1. Ibanez Af-105 Sm Spalted Hollowbody Electric Guitar | Electric Guitar Sales

    May 20, 2010 at 7:22 pm

    [...] Coffee Cup Half Moons » Blog Archive » USPS Shipping XML API Testing Idiosyncrasies [...]

     
  2. Tom

    May 21, 2010 at 12:13 pm

    OMG! Thank you! What was USPS thinking!

     
  3. Kevin

    September 7, 2010 at 11:46 pm

    Thanks, I had been struggling with this for days before coming across your site. One other thing to note is that even after USPS moves you to production server you still have to request authorization from this link – http://www.usps.com/webtools/webtoolsapirequestform.htm – geez, they wouldn’t want to make it easy or well documented.

    Thanks again for your post.

     
  4. roy

    November 20, 2010 at 4:56 pm

    Great article. I’m in the process of setting this up for my website, and it has been frustrating to say the least. I don’t understand. If i want to test various combination’s, e.g and express package shipping internationally – do I have to wait to get production access to test this? It seem ridiculous. And will I be charged for these requests? Would love to hear from you.

    -Roy

     
    • Jeremy

      November 23, 2010 at 1:53 pm

      Yeah it’s pretty much useless until you get production access, but the truth is, getting production access is easy. Essentially all their test environment does from their perspective is prove that you can connect to it. The rest of the testing is in production, but it is free of charge, so don’t fret it.