Postman & similar tools

Postman is a great way for developers to get started on using Lob’s APIs. Our public workspace allows you and your team to collaborate and make sure you have everything you need to get familiar with Lob’s APIs.

Watch the video below for an overview or read through the tutorial below.

Postman: How to create & test requests, then export source code

The following will guide you through the process of using Postman to create and test requests for Lob's API and then export the source code in your chosen programming language.

Lob provides an API for automating the sending of postcards, letters, checks, and more. With the help of Postman, we can easily test Lob's API endpoints, understand their behavior, and assist with the development of a custom Lob integration by exporting source code in any modern programming language.

Requirements

Step 1: Launch Postman

Once you’ve downloaded Postman, follow the installation instructions and launch the app once it’s ready.

Step 2: Create a request

  1. Click on the "New" button located in the top left corner of the application.

  2. From the modal that appears, select "HTTP".

  1. Once you’ve configured your request using the instructions below, you can used the “Save” button to select a name and save the request to a collection.

Step 3: Configure your request

  1. You will see a new tab open in Postman.

  2. From the dropdown menu on the left of the URL bar, select the required HTTP method (GET, POST, DELETE, etc.).

  1. Input the desired Lob API endpoint into the URL field (e.g., https://api.lob.com/v1/postcards).

  2. To authenticate, click on the Authorization tab below the URL field. Choose “Basic Auth” ****from the Type dropdown menu. In the Username field, enter your Lob API key, leave the Password field blank.

  1. Depending on the request type, you may need to include additional information. For example, for POST requests, navigate to the "Body" tab, select "raw" and choose "JSON" from the dropdown menu (defaulted to “Text”). Here, you can input the data for your request in JSON format.

For fields that are intended to accept only string values, submitting JSON objects in string format (stringified JSON objects) is not supported. Our system automatically parses and validates incoming data according to their expected types. As a result, providing a stringified JSON object in a field designated for string input can cause parsing errors or lead to unexpected validation results.

  1. If you’d like to send a file in your API request (for example, a PDF file), you can do so by following the instructions below. If you do not need to send a file (e.g. if you are not sending a POST request or you are using HTML templates), you can skip this step.

a. Select the “Body” tab and toggle into “form-data”.

b. From here, you should see a table with columns labelled “Key”, “Value”, and “Description”. In the first empty row, hover on the “Key” field cell to display a dropdown selector with the default datatype option “Text” selected. Click on this dropdown and select “File”.

c. You should se a button labelled “Select Files” appear in the “Value” field cell. Click this button to open the file browser and select the file you’d like to send.

d. Ensure the “Key” cell contains the value “file” (if creating a letter) or “front”/”back” (If creating a postcard or self-mailer).

Step 4: Send your request and test the response

  1. Click on the blue "Send" button to the right of the URL bar.

  2. The response will be displayed in the section below the request fields.

  3. You can review the status, time, size, and headers of the response.

Step 5: Export the source code

  1. Click on the "Code" button located on the far right side (it should look like an empty HTML tag, i.e., ”</>”).

  2. In the Code snippets panel that appears, select your preferred language from the dropdown on the left side.

  3. The right side will display the request code in the selected language.

  4. Click "Copy snippet" or manually select and copy the code.

That’s all you need to test requests for Lob's API, and export the source code in your chosen programming language!

Postman can be an invaluable part of your API development and testing workflows. Always refer to the Lob API documentation for any API-specific information and requirements.

Other tools

curl.se

Usage

cURL is used in command lines or scripts to transfer data. We've included cURL code snippets in our documentation for each resource. By including your API key, you can run these commands from the terminal and see the response from Lob's API.

curl https://api.lob.com/v1/addresses \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:

Explore Lob's API documentation for more cURL examples.

Last updated