Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Justintime50/easypost-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyPost CLI

The EasyPost API on the CLI.

Build Version Licence

Showcase

Written in pure Bash and only requiring cURL, the EasyPost CLI is incredibly portable for both users and developers and simple to use. View the official EasyPost documentation for more information about the API or visit the EasyPost CLI website.

NOTE: This project was created as a proof of concept to craft an entire library out of Shell scripts that could be easily ported to Windows and is not intended for production use.

What Can it Do?

At a high level, the EasyPost CLI can:

  • Create and retrieve addresses, parcels, insurance, shipments, pickups, trackers, webhooks, batches, and more
  • Buy labels and USPS stamps, refund shipments, and rate against all your carriers
  • Create and retrieve custom reports
  • Lookup EasyPost account details, create child users, and more

Install on macOS & Linux

# Setup the tap
brew tap justintime50/formulas

# Install the EasyPost CLI
brew install easypost-cli

# Configure the EasyPost CLI with your API key
echo "EASYPOST_CLI_API_KEY=123..." > ~/.easypost-cli-config

Install on Windows

The EasyPost CLI on Windows requires that the Chocolatey package manager be installed first which will install jq allowing for formatted JSON.

:: 1) Download and run the install script
curl -LJOs https://raw.githubusercontent.com/justintime50/easypost-cli/main/utils/windows-install.bat && windows-install.bat

:: 2) Setup the config file with your API key
@echo set EASYPOST_CLI_API_KEY=123... > C:/easypost-cli/easypost-cli-config.bat
:: Hide the config file (optional but recommended)
attrib +h C:/easypost-cli/easypost-cli-config.bat

:: 3) Edit your path to allow the EasyPost CLI to be called from anywhere
setx \m PATH %PATH%;C:\easypost-cli

Usage

The EasyPost CLI allows you to run dozens of commands to create or retrieve records from EasyPost. Each command will interactively prompt you for details about that record. View a complete list of commands available in the EasyPost CLI documentation

# Create a shipment with a single command, you will be prompted for details
ep create_shipment

Buying USPS Stamps

You can buy single, domestic USPS stamps from the command line by configuring an additional environment variable:

# macOS and Linux
echo "USPS_CARRIER_ACCOUNT_ID=ca_123..." >> ~/.easypost-cli-config

# Windows
@echo set USPS_CARRIER_ACCOUNT_ID=ca_123... >> C:/easypost-cli/easypost-cli-config.bat

Documentation

View the full accompanying EasyPost CLI Docs for a comprehensive list of commands that can be used.

Development

For a full breakdown of how the EasyPost CLI works under the hood, see the accompanying EasyPost CLI Developer Docs.

Building the EasyPost CLI

Build the EasyPost CLI, passing in the version number as the first parameter and an optional shell target as the second

./utils/build.sh 1.1.2 bash