Engineering BlogRSS Feed

Jarrett Streebin

Node Wrapper and CLI

by Jarrett Streebin

Good news! @niftylettuceopens in new tab over at Teelaunchopens in new tab wrote a fantastic node.js wrapper for the EasyPost API, plus a super cool command line interface. Check it out!

https://github.com/EasyPost/easypost-nodeopens in new tab

Not familiar with Node? That's okay, it's dead simple.

  1. Download Node.js: http://nodejs.org/download/
  2. Enter the following in your Terminal (you may need to 'sudo' this): npm install -g easypostjs
  3. Sign up for an account or login to your existing account and grab your Test API key. (Best to start with test, then once you get used to everything you can use your Secret API key to buy real postage.)
  4. Enter the following in your Terminal with <your-api-key> replaced by your Test API key: easypost <your-api-key> Boom! You're off and running with the EasyPost API.
  5. Choose an option:
    • Verify a single address
    • Verify multiple addresses
    • Get multiple shipment rates
    • Get shipment rates
    • Buy postage
    • Lookup individual label purchased
    • Get full list of labels purchased
  6. Want to use this in your app? Simply require it and utilize the API endpoints:
    var easypost = require('easypostjs')('your-api-key')
    
    ## Verify an address
    easypost.address.verify(data, cb)
    function cb(err, response){
      if (err) return console.log(err)
      console.log(response)
    }

Let us know if you have any feedback or questions!

Note: we're hiring like mad and we need your help building EasyPost. Drop us a line!

Get started in minutes and build the shipping infrastructure of the internet with our Official Client Libraries. We’re excited to see what you build!