ColdFusion UPS Package Updated

I’ve updated my ColdFusion UPS Package code today to include the first draft of a service that will return shipping rates. This is not yet feature complete, but for basic (I have a 10 pound package) tasks, it will tell you the rates for various services.

The API is rather complex, so I built an API to return structs of package information in the form the rate information API desires. So this code, for examples, will get rate information on shipping two packages:

<cfset packages = arrayNew(1)> <cfset arrayAppend(packages, st.getPackageStruct(weight=40,width=20,length=40,height=10,packagetype="02"))> <cfset arrayAppend(packages, st.getPackageStruct(weight=10,width=20,length=40,height=10,packagetype="03"))>

<cfset rates = st.getRateInformation(shipperpostalcode=70508,packages=packages,shiptopostalcode=90210)> </code>

There are a few other APIs to help translate UPS codes and package types.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments