Skip to content

lob/lob-java

 
 

Repository files navigation

lob-java

Lob

  • API version: 1.3.0

The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our previous documentation?

For more information, please visit https://support.lob.com/

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.lob</groupId>
  <artifactId>lob-java</artifactId>
  <version>13.0.0</version>
</dependency>

Projects using the Spring framework

Some versions of the Spring framework introduce a dependency collision that prevents the Lob SDK from functioning correctly. In order to correct this, please add the following two blocks to your project's POM along with the dependency mentioned above.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.9.1</version>
        </dependency>
    </dependencies>
</dependencyManagement>

and

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.9.1</version>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.github.lob:lob-java:13.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/lob-java-13.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

package com.company.app;
 
import com.lob.api.ApiClient;
import com.lob.api.ApiException;
import com.lob.api.Configuration;
import com.lob.api.auth.*;
import org.openapitools.client.model.*;
import com.lob.api.client.AddressesApi;
 
public class App
{
    public static void main( String[] args )
    {
       
        ApiClient lobClient = Configuration.getDefaultApiClient();

        // Configure HTTP basic authorization: basicAuth
        HttpBasicAuth basicAuth = (HttpBasicAuth) lobClient.getAuthentication("basicAuth");
        basicAuth.setUsername("<YOUR_LOB_API_KEY>");

        AddressesApi apiInstance = new AddressesApi(lobClient);
        AddressEditable addressEditable = new AddressEditable();
        addressEditable.setDescription("Harry - Office");
        addressEditable.setName("Harry Zhang");
        addressEditable.setCompany("Lob");
        addressEditable.setAddressLine1("210 King St");
        addressEditable.setAddressCity("San Francisco");
        addressEditable.setAddressState("CA");
        addressEditable.setAddressZip("94107");
        addressEditable.setAddressCountry(CountryExtended.US);
        addressEditable.setPhone("555-555-5555");
        addressEditable.setEmail("[email protected]");

        try {
            Address result = apiInstance.create(addressEditable);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AddressesApi#addressCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
 } 

Documentation for API Endpoints

All URIs are relative to https://api.lob.com/v1

Class Method HTTP request Description
AddressesApi addressCreate POST /addresses create
AddressesApi addressDelete DELETE /addresses/{adr_id} delete
AddressesApi addressRetrieve GET /addresses/{adr_id} get
AddressesApi addressesList GET /addresses list
BankAccountsApi bankAccountCreate POST /bank_accounts create
BankAccountsApi bankAccountDelete DELETE /bank_accounts/{bank_id} delete
BankAccountsApi bankAccountRetrieve GET /bank_accounts/{bank_id} get
BankAccountsApi bankAccountVerify POST /bank_accounts/{bank_id}/verify verify
BankAccountsApi bankAccountsList GET /bank_accounts list
BillingGroupsApi billingGroupCreate POST /billing_groups create
BillingGroupsApi billingGroupRetrieve GET /billing_groups/{bg_id} get
BillingGroupsApi billingGroupUpdate POST /billing_groups/{bg_id} update
BillingGroupsApi billingGroupsList GET /billing_groups list
CardOrdersApi cardOrderCreate POST /cards/{card_id}/orders create
CardOrdersApi cardOrdersRetrieve GET /cards/{card_id}/orders get
CardsApi cardCreate POST /cards create
CardsApi cardDelete DELETE /cards/{card_id} delete
CardsApi cardRetrieve GET /cards/{card_id} get
CardsApi cardUpdate POST /cards/{card_id} update
CardsApi cardsList GET /cards list
ChecksApi checkCancel DELETE /checks/{chk_id} cancel
ChecksApi checkCreate POST /checks create
ChecksApi checkRetrieve GET /checks/{chk_id} get
ChecksApi checksList GET /checks list
IntlVerificationsApi bulkIntlVerifications POST /bulk/intl_verifications verifyBulk
IntlVerificationsApi intlVerification POST /intl_verifications verifySingle
LettersApi letterCancel DELETE /letters/{ltr_id} cancel
LettersApi letterCreate POST /letters create
LettersApi letterRetrieve GET /letters/{ltr_id} get
LettersApi lettersList GET /letters list
PostcardsApi postcardCreate POST /postcards create
PostcardsApi postcardDelete DELETE /postcards/{psc_id} cancel
PostcardsApi postcardRetrieve GET /postcards/{psc_id} get
PostcardsApi postcardsList GET /postcards list
ReverseGeocodeLookupsApi reverseGeocodeLookup POST /us_reverse_geocode_lookups lookup
SelfMailersApi selfMailerCreate POST /self_mailers create
SelfMailersApi selfMailerDelete DELETE /self_mailers/{sfm_id} delete
SelfMailersApi selfMailerRetrieve GET /self_mailers/{sfm_id} get
SelfMailersApi selfMailersList GET /self_mailers list
TemplateVersionsApi createTemplateVersion POST /templates/{tmpl_id}/versions create
TemplateVersionsApi templateVersionDelete DELETE /templates/{tmpl_id}/versions/{vrsn_id} delete
TemplateVersionsApi templateVersionRetrieve GET /templates/{tmpl_id}/versions/{vrsn_id} get
TemplateVersionsApi templateVersionUpdate POST /templates/{tmpl_id}/versions/{vrsn_id} update
TemplateVersionsApi templateVersionsList GET /templates/{tmpl_id}/versions list
TemplatesApi createTemplate POST /templates create
TemplatesApi templateDelete DELETE /templates/{tmpl_id} delete
TemplatesApi templateRetrieve GET /templates/{tmpl_id} get
TemplatesApi templateUpdate POST /templates/{tmpl_id} update
TemplatesApi templatesList GET /templates list
UsAutocompletionsApi autocompletion POST /us_autocompletions autocomplete
UsVerificationsApi bulkUsVerifications POST /bulk/us_verifications verifyBulk
UsVerificationsApi usVerification POST /us_verifications verifySingle
ZipLookupsApi zipLookup POST /us_zip_lookups lookup

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

[email protected]

About

Java Wrapper for Lob API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages