The Sapience Society The advice of a self-proclaimed technological ninjician

15Jun/113

Shipping Tracking – UPS and USPS Violate Best Practice PRG Pattern

This is probably just me shaking my fist at the sky, but maybe someone from one of these companies will look at this and fix their code!

Both USPS and UPS use POST requests when you enter a tracking number which means that if you refresh the tracking page your browser will most likely ask you if you really want to resubmit the form. There are many problems with this, chief among them being the fact that you can't bookmark the page. Also, from a developer viewpoint this way of doing it violates the PRG pattern that is commonly thought of as a best practices technique. PRG can be summarized as follows: (excerpt taken from this page)

Never show pages in response to POST
Always load pages using GET
Navigate from POST to GET using REDIRECT

Fedex on the other hand, stores the form information (tracking numbers and preferences) in the URL - you can bookmark this url, you can refresh, and it follows best practice guidelines.

Little things like this surprise me because we are talking about companies worth tens of billions of dollars. They have a very robust web-infrastructures built, and yet they have small problems like this that affect a large portion of their user-base - which could be fixed in an hour or two.

Comments (3) Trackbacks (0)
  1. Completely agree. The inability to bookmark the page is infuriating. Sad thing is – this is a fairly recent change on both their sites. Not long ago I could bookmark their tracking pages. Hope someone will hear you at UPS and USPS and take action.

  2. http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?strOrigTrackNum=123456

    Server isn’t distinguishing between GET and POST .. you can still the pass the number in the URL

  3. Regardless, their default form methods are POST and they don’t implement a PRG pattern. Sure, it’s possible to submit the forms through GET if you know what you’re doing, but why not make it that way by default?


Leave a comment

No trackbacks yet.