Skip to content

Latest commit

 

History

History
286 lines (211 loc) · 18.8 KB

File metadata and controls

286 lines (211 loc) · 18.8 KB

Manifests

(manifests)

Overview

A manifest is a single-page document with a barcode that carriers can scan to accept all packages into transit without the need to scan each item individually. They are close-outs of shipping labels of a certain day. Some carriers require manifests to process the shipments.

Manifest Errors

The following codes and messages are the possible errors that may occur when creating Manifests.

Available Operations

  • list - List all manifests
  • create - Create a new manifest
  • get - Retrieve a manifest

list

Returns a list of all manifest objects.

Example Usage

import { Shippo } from "shippo";

const shippo = new Shippo({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const result = await shippo.manifests.list(1, 5);

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ShippoCore } from "shippo/core.js";
import { manifestsList } from "shippo/funcs/manifestsList.js";

// Use `ShippoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const shippo = new ShippoCore({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const res = await manifestsList(shippo, 1, 5);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
page number The page number you want to select
results number The number of results to return per page (max 100, default 5)
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.ManifestPaginatedList>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

create

Creates a new manifest object.

Example Usage

import { Shippo } from "shippo";

const shippo = new Shippo({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const result = await shippo.manifests.create({
    carrierAccount: "adcfdddf8ec64b84ad22772bce3ea37a",
    shipmentDate: "2014-05-16T23:59:59Z",
    transactions: [
      "adcfdddf8ec64b84ad22772bce3ea37a",
    ],
    addressFrom: {
      name: "Shwan Ippotle",
      company: "Shippo",
      street1: "215 Clayton St.",
      street3: "",
      streetNo: "",
      city: "San Francisco",
      state: "CA",
      zip: "94117",
      country: "US",
      phone: "+1 555 341 9393",
      email: "[email protected]",
      isResidential: true,
      metadata: "Customer ID 123456",
      validate: true,
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ShippoCore } from "shippo/core.js";
import { manifestsCreate } from "shippo/funcs/manifestsCreate.js";

// Use `ShippoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const shippo = new ShippoCore({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const res = await manifestsCreate(shippo, {
    carrierAccount: "adcfdddf8ec64b84ad22772bce3ea37a",
    shipmentDate: "2014-05-16T23:59:59Z",
    transactions: [
      "adcfdddf8ec64b84ad22772bce3ea37a",
    ],
    addressFrom: {
      name: "Shwan Ippotle",
      company: "Shippo",
      street1: "215 Clayton St.",
      street3: "",
      streetNo: "",
      city: "San Francisco",
      state: "CA",
      zip: "94117",
      country: "US",
      phone: "+1 555 341 9393",
      email: "[email protected]",
      isResidential: true,
      metadata: "Customer ID 123456",
      validate: true,
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request components.ManifestCreateRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Manifest>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get

Returns an existing manifest using an object ID.

Example Usage

import { Shippo } from "shippo";

const shippo = new Shippo({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const result = await shippo.manifests.get("<id>");

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ShippoCore } from "shippo/core.js";
import { manifestsGet } from "shippo/funcs/manifestsGet.js";

// Use `ShippoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const shippo = new ShippoCore({
  apiKeyHeader: "<YOUR_API_KEY_HERE>",
  shippoApiVersion: "2018-02-08",
});

async function run() {
  const res = await manifestsGet(shippo, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
manifestId string ✔️ Object ID of the manifest to update
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Manifest>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*