Files
speakeasy-playground/docs/sdks/rates
Mike Lueders 14c449163c generate sdk
2024-03-01 12:52:50 -06:00
..
2024-03-01 12:52:50 -06:00

Rates

(rates)

Overview

A rate is the cost to ship a parcel from a carrier. The rate object details the service level including the cost and transit time.

Available Operations

get_rate

Returns an existing rate using a rate object ID.

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
)


res = s.rates.get_rate(rate_id='<value>', shippo_api_version='<value>')

if res.rate is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
rate_id str ✔️ Object ID of the rate
shippo_api_version Optional[str] String used to pick a non-default API version to use

Response

operations.GetRateResponse

Errors

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

list_shipment_rates

Returns a paginated list of rates associated with a shipment

Example Usage

import shippo

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
)


res = s.rates.list_shipment_rates(shipment_id='<value>', page=1, results=25, shippo_api_version='<value>')

if res.rate_list_wrapper is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
shipment_id str ✔️ Object ID of the shipment to update
page Optional[int] The page number you want to select
results Optional[int] The number of results to return per page (max 100)
shippo_api_version Optional[str] String used to pick a non-default API version to use

Response

operations.ListShipmentRatesResponse

Errors

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

list_shipment_rates_by_currency_code

Returns all available shipping rates for a shipment object.

When you create a new valid shipment object, Shippo automatically calculates all available rates. Depending on your shipment data, there may be none, one or multiple rates.

By default, the calculated rates will return the price in two currencies under the amount and amount_local keys, respectively. The amount key will contain the price of a rate expressed in the currency that is used in the country from where the parcel originates, and the amount_local key will contain the price expressed in the currency that is used in the country the parcel is shipped to. You can request rates with prices expressed in a different currency by adding the currency code to the end of the resource URL. The full list of supported currencies along with their codes can be viewed on open exchange rates.

Note: re-requesting the rates with a different currency code will re-queue the shipment (i.e. set the Shipment's status to QUEUED) and the converted currency rates will only be available when the Shipment's status is set to SUCCESS.

Example Usage

import shippo
from shippo.models import operations

s = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
)

req = operations.ListShipmentRatesByCurrencyCodeRequest(
    shipment_id='<value>',
    currency_code='USD',
)

res = s.rates.list_shipment_rates_by_currency_code(req)

if res.rate_list_wrapper is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request operations.ListShipmentRatesByCurrencyCodeRequest ✔️ The request object to use for the request.

Response

operations.ListShipmentRatesByCurrencyCodeResponse

Errors

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