/shipengine-js

The official ShipEngine SDK for Javascript.

Primary LanguageTypeScriptApache License 2.0Apache-2.0

ShipEngine

ShipEngine JavaScript SDK

The official ShipEngine JavaScript SDK for Node.js

npm License

Build Status Coverage Status Dependencies

OS Compatibility

Quick Start

Install ShipEngine JavaScript SDK via npm.

npm install shipengine

The only configuration requirement is an API key.

const ShipEngine = require("shipengine");

const shipengine = new ShipEngine("___YOUR_API_KEY_HERE__");

Methods

  • createLabelFromRate - When retrieving rates for shipments using the getRatesWithShipmentDetails method, the returned information contains a rateId property that can be used to purchase a label without having to refill in the shipment information repeatedly.
  • createLabelFromShipmentDetails - Purchase and print a label for shipment.
  • getRatesWithShipmentDetails - Given some shipment details and rate options, this method returns a list of rate quotes.
  • listCarriers - Returns a list of carrier accounts that have been connected through the ShipEngine dashboard.
  • trackUsingLabelId - Track a package by its associated label ID.
  • trackUsingCarrierCodeAndTrackingNumber - Track a package for a given carrier and tracking number.
  • validateAddresses - Indicates whether the provided addresses are valid. If the addresses are valid, the method returns a normalized version based on the standards of the country in which the address resides. If an address cannot be normalized, an error is returned.
  • voidLabelWithLabelId - Void a label with its Label ID.

Contributing

Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.

Building

To build the project locally on your computer:

  1. Clone this repo
    git clone https://github.com/ShipEngine/shipengine-js.git

  2. Install dependencies
    npm install

  3. Build the code
    npm run build

    Or you can use npm run watch to automatically re-build whenever source files change.

  4. Lint the code
    npm run lint

    Or you can use npm run lint:fix to automatically fix most linting errors.

  5. Run the tests
    npm test

    This runs tests in both Node.js and web browsers. Use npm run test:node to only run Node.js tests, or npm run test:browser to only run browser tests.

Committing

This project adheres to the Conventional Commits specification.

Publishing

Publishing new versions of the SDK to NPM is handled on GitHub via the Release Please GitHub Actions workflow. Learn more about about Release PRs, updating the changelog, and commit messages here.