Skip to content

goshippo/shippo-java-sdk

Repository files navigation

Shippo logo Shippo Java SDK

Shippo is a shipping API that connects you with multiple shipping carriers (such as USPS, UPS, DHL, Canada Post, Australia Post, and many others) through one interface.

You must register for a Shippo account to use our API. It's free to sign up. Only pay to print a live label, test labels are free.

To use the API, you must generate an API Token. In the following examples, replace <YOUR_API_KEY_HERE> with your own token.

For example.

Shippo sdk = Shippo.builder()
    .apiKeyHeader("shippo_test_595d9cb0c0e14497bf07e75ecfec6c6d")
    .build();

Summary

Shippo external API.: Use this API to integrate with the Shippo service

Table of Contents

SDK Installation

Getting started

JDK 11 or later is required.

The samples below show how a published SDK artifact is used:

Gradle:

implementation 'com.shippo:sdk:0.4.0'

Maven:

<dependency>
    <groupId>com.shippo</groupId>
    <artifactId>sdk</artifactId>
    <version>0.4.0</version>
</dependency>

How to build

After cloning the git repository to your file system you can build the SDK artifact from source to the build directory by running ./gradlew build on *nix systems or gradlew.bat on Windows systems.

If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally):

On *nix:

./gradlew publishToMavenLocal -Pskip.signing

On Windows:

gradlew.bat publishToMavenLocal -Pskip.signing

SDK Example Usage

Example

package hello.world;

import com.shippo.sdk.Shippo;
import com.shippo.sdk.models.components.*;
import com.shippo.sdk.models.components.Security;
import com.shippo.sdk.models.operations.*;
import com.shippo.sdk.utils.EventStream;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Shippo sdk = Shippo.builder()
                .apiKeyHeader("<YOUR_API_KEY_HERE>")
                // the API version can be globally set, though this is normally not required
                // .shippoApiVersion("<YYYY-MM-DD>")
                .build();

            ListAddressesResponse res = sdk.addresses().list()
                .page(1L)
                .results(5L)
                .call();

            if (res.addressPaginatedList().isPresent()) {
                // handle response
            }
        } catch (com.shippo.sdk.models.errors.SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }
    }
}

Documentation

Review our full guides and references at https://docs.goshippo.com/.

Available Resources and Operations

Available methods
  • list - List all addresses
  • create - Create a new address
  • get - Retrieve an address
  • validate - Validate an address
  • list - List all carrier parcel templates
  • get - Retrieve a carrier parcel templates
  • list - List all customs declarations
  • create - Create a new customs declaration
  • get - Retrieve a customs declaration
  • list - List all customs items
  • create - Create a new customs item
  • get - Retrieve a customs item
  • list - List all manifests
  • create - Create a new manifest
  • get - Retrieve a manifest
  • list - List all orders
  • create - Create a new order
  • get - Retrieve an order
  • list - List all parcels
  • create - Create a new parcel
  • get - Retrieve an existing parcel
  • create - Create a refund
  • list - List all refunds
  • get - Retrieve a refund
  • list - List all service groups
  • create - Create a new service group
  • update - Update an existing service group
  • delete - Delete a service group
  • list - List all shipments
  • create - Create a new shipment
  • get - Retrieve a shipment
  • list - List all Shippo Accounts
  • create - Create a Shippo Account
  • get - Retrieve a Shippo Account
  • update - Update a Shippo Account
  • create - Register a tracking webhook
  • get - Get a tracking status
  • list - List all shipping labels
  • create - Create a shipping label
  • get - Retrieve a shipping label
  • list - List all user parcel templates
  • create - Create a new user parcel template
  • delete - Delete a user parcel template
  • get - Retrieves a user parcel template
  • update - Update an existing user parcel template

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

SDK Created by Speakeasy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages