Quantcast
Channel: Hacker News 50
Viewing all articles
Browse latest Browse all 9433

EasyPost | Blog

$
0
0

Comments:"EasyPost | Blog"

URL:http://blog.geteasypost.com/post/48133423082/stampsfromcommandline


Buy Stamps from the Command Line! April 16, 2013 by easypostco

Did you know you can buy stamps from your command line? Just open your Terminal and paste the following (on Mac):

curl https://www.geteasypost.com/api/postage/buy \
-u cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi: \
-d 'to[name]=Jon Calhoun' \
-d 'to[street1]=388 Townsend St' \
-d 'to[street2]=Apt 20' \
-d 'to[city]=San Francisco' \
-d 'to[state]=CA' \
-d 'to[zip]=94107' \
-d 'from[name]=Jarrett Streebin' \
-d 'from[phone]=3238550394' \
-d 'from[street1]=310 Granelli Ave' \
-d 'from[city]=Half Moon Bay' \
-d 'from[state]=CA' \
-d 'from[zip]=94019' \
-d 'parcel[weight]=1.0' \
-d 'parcel[predefined_package]=Letter' \
-d 'carrier=USPS' \
-d 'service=First'

Boom! There’s your 46 cent stamp minus the trip to the post office. Just copy the URL in the response.

Now, try updating the addresses to real ones. Is that the postage you were looking for?

Want to try it for real now? Sign up for an account, load it with credit, then use your real API key (in place of the cueq…, no quotes). 

Need to ship a box? Just remove “-d ‘parcel[predefined_package]=Letter’ " and add dimensions. It’s always a good idea to do it with a Test API key first, to make sure you’re getting the postage you want. 

If you really want to get fancy, check out the awesome CLI one of our users wrote!

Let us know if you have any questions!

Please enable JavaScript to view the comments powered by Disqus.

Viewing all articles
Browse latest Browse all 9433

Trending Articles