Skip to content

Latest commit

 

History

History
104 lines (62 loc) · 2.03 KB

File metadata and controls

104 lines (62 loc) · 2.03 KB

Examples

Client Initialization

    import shiphawk
    
    shiphawk = shiphawk.Client(api_token='api_token')

Products

Creating a product

    shiphawk.products.create(product)

Expects: product object without id

Returns: product object with id

Getting all products

    shiphawk.products.get()

Returns: a list of product objects with ids

Getting one product

    shiphawk.products.get(345)

Returns: product object with id

Deleting a product

    shiphawk.products.delete(345)

Expects: product id (number or string)

Returns: None

Deleting multiple products

    shiphawk.products.delete([345, 346])

Expects: list of product ids (numbers or strings)

Returns: None

Rates

Requesting a rate quote

    shiphawk.rates.request(request)

Expects: request object

Returns: a list of rate objects

To accept a rate and create a shipment, see shipments.create.

Shipments

Creating a shipment

    shiphawk.shipments.create(rate_id, origin_address, destination_address)

Expects: rate_id (string), origin_address (address), destination_address (address)

Returns: shipment object

Cancelling a shipment

    shiphawk.shipments.cancel(shipment_id)

Expects: shipment_id

Returns: shipment object

Tracking a shipment

    tracking_info = shiphawk.shipments.track(shipment_id)

Expects: shipment_id

Returns: tracking object