# Shipment

An object representing a shipment. A shipment contains one or more shipment items, reflecting its content. Thus, an order may be split into several shipments and a shipment may contain several orders.

# Properties

Property Type Description
uid integer The unique indentifier of the shipment.
type string Type of shipment, "order/delivery" or "order/return".
trackingUrl string URL to external tracking service.
shipmentMethod integer The unique identifier of the delivery method.
services object An object containing services, see Service.
packageCount number Number of packages in this shipment.
items array The unique identifiers of the ShipmentItems as an array.
events array Status event list, see Event.
documentUrl string URL to freight document.

# Service

These are the properties for the services object:

Property Type Description
carrierType string <>
carrierRef string <>

# Event

Property Type Description
status string The status of this event.
datetime string When this event was happening.

# Methods

# addAllItemsFromOrder

Adds an entire Order to the shipment.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment or null to create a new shipment.
order The unique identifier of an existing Order.
query What to return; defaults to uid. See Query language.

# Returns

Shipment data based on the query parameter.

# Example

Shipment.addAllItemsFromOrder(12345678, 98765432, [
  "uid",
  "items"
])

# addAllItemsFromSuborder

Adds an entire Suborder to the shipment.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment or null to create a new shipment.
suborder The unique identifier of an existing Suborder.
query What to return; defaults to uid. See Query language.

# Returns

Shipment data based on the query parameter.

# Example

Shipment.addAllItemsFromSuborder(12345678, 6543210, [
  "uid",
  "items"
])

# addItem

Adds an OrderItem to the shipment, optionally with quantity.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment or null to create a new shipment.
orderitem The unique identifier of an existing OrderItem.
quantity The quantity of order item, defaults to null which will add all items to the shipment.
query What to return; defaults to uid. See Query language.

# Returns

Shipment data based on the query parameter.

# Example

Shipment.addItem(12345678, 1234567, 2, [
  "uid",
  "items"
])

# addService

Add service to shipment, mainly for tracking URL.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment.
serviceName The unique identifier of an existing shipment.
query What to return; defaults to uid. See Query language.

# get

Fetches information about a shipment.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment.
query What to return; defaults to uid. See Query language.

# Example

Shipment.get(12345678, [
  "uid",
  "items",
  "packageCount"
])

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# Parameters

# ship

Will ready the shipment for delivery, and possibly trigger integrations.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment or null to create a new shipment.
delivered If set, delivery status of contained Orders/Suborders/OrderItems will be evaluated and set, defaults to false.
query What to return; defaults to uid. See Query language.

# Returns

Shipment data based on the query parameter.

# Example

Shipment.ship(12345678, true, [
  "uid",
  "events"
])