Skip to content

Latest commit

 

History

History
153 lines (106 loc) · 4.94 KB

README.md

File metadata and controls

153 lines (106 loc) · 4.94 KB

Parcels

(parcels)

Overview

A parcel is an item you are shipping. The parcel object includes details about its physical make-up of the parcel. It includes dimensions and weight that Shippo uses to calculate rates.

Parcel Extras

The following values are supported for the extra field of the parcel object.

Available Operations

  • list - List all parcels
  • create - Create a new parcel
  • get - Retrieve an existing parcel

list

Returns a list of all parcel objects.

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version='2018-02-08',
)

res = s.parcels.list(page=1, results=25)

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
page Optional[int] The page number you want to select
results Optional[int] The number of results to return per page (max 100)

Response

components.ParcelPaginatedList

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

create

Creates a new parcel object.

Example Usage

import shippo
from shippo.models import components

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version='2018-02-08',
)

res = s.parcels.create(request=components.ParcelRequest(
    distance_unit=components.DistanceUnitEnum.IN,
    height='1',
    length='1',
    mass_unit=components.WeightUnitEnum.LB,
    weight='1',
    width='1',
    extra=components.ParcelExtra(
        cod=components.Cod(
            amount='5.5',
            currency='USD',
            payment_method=components.PaymentMethod.CASH,
        ),
        insurance=components.ParcelInsurance(
            amount='5.5',
            content='Laptop',
            currency='USD',
            provider=components.ParcelInsuranceProvider.UPS,
        ),
    ),
))

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request components.ParcelRequest ✔️ The request object to use for the request.

Response

components.Parcel

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

get

Returns parcel details using an existing parcel object ID (this will not return parcel details associated with un-purchased shipment/rate parcel object IDs).

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version='2018-02-08',
)

res = s.parcels.get(parcel_id='<value>')

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
parcel_id str ✔️ Object ID of the parcel

Response

components.Parcel

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /