lob-api-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Getting Started with Lob API

Introduction

Lob helps creators extend their applications into the physical world with automated direct mail and address verification APIs.

Get started in the way that works best for you:

  • Watch our 10-minute video walkthrough showing how to get started with Lob API collections.

  • Explore our API documentatation: docs.lob.com

  • Read through our Getting Started guide below

Need more help? Contact us at support@lob.com

Getting Started

Sign up for a free Lob account

Your API keys are located under Settings.

You'll use the SECRET API KEYS that begin with test_. for your Test API key and live_. for your Live API key.

In order to use the collections in this public workspace, you'll select the Lob API collection and fork it into your personal workspace.

You'll also want to setup environment variables. A short cut is to fork Lob Public Env from Lob's public workspace. You also have the option to create them yourself - see the image below.

Set the Current Value for LIVE_API_KEY and TEST_API_KEY to your Lob "live" and "test" API keys and click Save.

Make sure Lob Public Env is selected in the environment menu.

Start exploring Lob's API collection

The Test API key is used for all print & mail related endpoints while the Live API key is used for the address verification endpoint.

Install the Package

Run the following command from your project directory to install the package from npm:

npm install lob-api-sdk@1.0.0

For additional package details, see the Npm page for the lob-api-sdk@1.0.0 npm.

Test the SDK

To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.

To run the tests, navigate to the root directory of the SDK and execute the following command:

npm run test

Or you can also run tests with coverage report:

npm run test:coverage

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

Parameter Type Description
environment Environment The API environment.
Default: Environment.Production
timeout number Timeout for API calls.
Default: 0
httpClientOptions Partial<HttpClientOptions> Stable configurable http client options.
unstableHttpClientOptions any Unstable configurable http client options.
basicAuthCredentials BasicAuthCredentials The credential object for basicAuth

The API client can be initialized as follows:

import { Client, Environment } from 'lob-api-sdk';

const client = new Client({
  basicAuthCredentials: {
    username: 'username',
    password: 'password'
  },
  timeout: 0,
  environment: Environment.Production,
});

Authorization

This API uses the following authentication schemes.

List of APIs

SDK Infrastructure

Configuration

HTTP

Utilities

Readme

Keywords

none

Package Sidebar

Install

npm i lob-api-sdk

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.19 MB

Total Files

800

Last publish

Collaborators

  • developer-sdksio