Open2b versione 7.2

shipments

shipments.find

Returns the shipments that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.shipments.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.find
{
  "conditions" : { // returns only the shipments …
    "ids" : [ 893, 894, … ], // with these ids - int(1…)
    "orders" : [ 1771949227, … ], // … with these orders (id) - int(1…)
    "fromCreationTime" : "2020-09-29 12:00:00", // … with creation time equal or next to this - datetime
    "toCreationTime" : "2020-09-30 23:59:59", // … with creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-09-29 12:00:00", // … with last update time equal or previous to this - datetime
    "toUpdateTime" : "2020-09-30 23:59:59" // … with last update time equal or next to this - datetime
  },
  "fields" : [ "id", "order", "items", … ], // returns only these fields - string
  "order" : [ "shipmentDate" ], // sort order of returned shipments, can contain "id", "-id", "order", "-order",
                                // "creationTime", "-creationTime", "updateTime", "-updateTime",
                                // "shipmentDate", "-shipmentDate", "deliveryDate", "-deliveryDate"
  "limit" : 10, // maximum number of shipments to return - int(1…)
  "first" : 0 // index of the first shipment to return - int(0…)
}

Response

{
  "status" : "ok",
  "shipments" : [ {
    "id" : 739820, // identifier - int(1…)
    "order" : 1771949227, // order (id) - int(1…)
    "creationTime" : "2020-09-29 13:13:47", // creation time - datetime
    "updateTime" : "2020-09-29 16:08:11", // last update time - datetime
    "quantities" : { // quantity for each order item (id) - int(1…) -> decimal[8,2](0…)
      "805703" : 3.00,
      "805705" : 2.00,
      …
    },
    "shipmentDate": "2020-01-26", // shipment date (can be null) - date
    "deliveryDate": "2020-01-28", // delivery date (can be null) - date
    "trackingNumber" : "1Z999AA10123456784", // tracking number - string(0…100)
    "trackingURL" : "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z999AA10123456784" // tracking URL - string(0…300)
  }, … ]
}

shipments.get

Returns a shipment given its identifier.

Request

Admin SDK
Admin.api('commerce.shipments.get', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.get
{
  "id" : 739820, // identifier (required) - int(1…)
  "fields" : [ "id", "order", "items", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "shipment"  : { // (can be null)
    "id" : 739820, // identifier - int(1…)
    "order" : 1771949227, // order (id) - int(1…)
    "creationTime" : "2020-09-29 13:13:47", // creation time - datetime
    "updateTime" : "2020-09-29 16:08:11", // last update time - datetime
    "quantities" : { // quantity for each order item (id) - int(1…) -> decimal[8,2](0…)
      "805703" : 3.00,
      "805705" : 2.00,
      …
    },
    "shipmentDate": "2020-01-26", // shipment date (can be null) - date
    "deliveryDate": "2020-01-28", // delivery date (can be null) - date
    "trackingNumber" : "1Z999AA10123456784", // tracking number - string(0…100)
    "trackingURL" : "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z999AA10123456784" // tracking URL - string(0…300)
  }
}

shipments.count

Number of shipments that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.shipments.count', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.count
{
  "conditions" : { // counts the shipments …
    "ids" : [ 893, 894, … ], // with these ids - int(1…)
    "orders" : [ 1771949227, … ], // … with these orders (id) - int(1…)
    "fromCreationTime" : "2020-09-29 12:00:00", // … with creation time equal or next to this - datetime
    "toCreationTime" : "2020-09-30 23:59:59", // … with creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-09-29 12:00:00", // … with last update time equal or previous to this - datetime
    "toUpdateTime" : "2020-09-30 23:59:59" // … with last update time equal or next to this - datetime
  }
}

Response

{
  "status" : "ok",
  "count" : 5470 // number of shipments - int(0…)
}

shipments.create

Creates a new shipment.

Request

Admin SDK
Admin.api('commerce.shipments.create', request, function(response) { … });
HTTP POST
/api/5/commerce.shipments.create
{
  "shipment" : { // shipment to create (required)
    "order" : 1771949227, // order (id) (required) - int(1…)
    "creationTime" : "2020-09-29 13:13:47", // creation time - datetime
    "quantities" : { // quantity for each order item (id) (required) - int(1…) -> decimal[8,2](0…)
      "805703" : 3.00,
      "805705" : 2.00,
      …
    },
    "shipmentDate": "2020-01-26", // shipment date (can be null) - date
    "deliveryDate": null, // delivery date (can be null) - date
    "trackingNumber" : "1Z999AA10123456784", // tracking number - string(0…100)
    "trackingURL" : "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z999AA10123456784" // tracking URL - string(0…300)
  }
}

Response

{
  "status" : "ok",
  "id" : 739820 // identifier of the new shipment - int(1…)
}

Errors

Field Type Description
creationTime InvalidValue Creation time '<creationTime>' is in the future
deliveryDate InvalidValue Delivery date must be greater than or equal to shipment date
order NotFound Order <order> does not exist
quantities InvalidValue Quantity of order item <id> is greater than the maximum shippable quantity
quantities Malformed There must be at least one order item in a shipment
quantities NotFound Order item <id> does not exist
trackingURL Malformed Tracking URL must begin with "http://" or "https://"

shipments.update

Updates a shipment. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('commerce.shipments.update', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.update
{
  "id" : 739820, // identifier of the shipment to update (required) - int(1…)
  "shipment" : { // shipment's fields to update (required)
    "creationTime" : "2020-09-29 13:13:47", // creation time - datetime
    "quantities" : { // quantity for each order item (id) - int(1…) -> decimal[8,2](0…)
      "805703" : 3.00,
      "805705" : 2.00,
      …
    },
    "shipmentDate": "2020-01-26", // shipment date (can be null) - date
    "deliveryDate": null, // delivery date (can be null) - date
    "trackingNumber" : "1Z999AA10123456784", // tracking number - string(0…100)
    "trackingURL" : "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z999AA10123456784" // tracking URL - string(0…300)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
creationTime InvalidValue Creation time '<creationTime>' is in the future
deliveryDate InvalidValue Delivery date cannot be in the future because there are returns for some items
deliveryDate InvalidValue Delivery date is required because there are returns for some items
deliveryDate InvalidValue Delivery date must be greater than or equal to shipment date
id NotFound Shipment <id> does not exist
quantities InvalidValue Order item <id> is required because there are returns for the item
quantities InvalidValue Quantity of order item <id> cannot be <quantity> because there are returns for the item
quantities InvalidValue Quantity of order item <id> is greater than the maximum shippable quantity
quantities Malformed There must be at least one order item in a shipment
quantities NotFound Order item <id> does not exist
shipmentDate InvalidValue Shipment date must be less than or equal to delivery date
trackingURL Malformed Tracking URL must begin with "http://" or "https://"

shipments.delete

Deletes one or more shipments.

Request

Admin SDK
Admin.api('commerce.shipments.delete', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.delete
{
  "ids" : [ 739820, … ] // identifiers of the shipments to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids InvalidValue Shipment <id> has returns that depend on it

shipments.find-items

Returns the shipment items that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.shipments.find-items', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.find-items
{
  "conditions" : { // returns only the shipment items …
    "orderItems" : [ 805703, null ], // … with these order items - int(1…)
    "customer" : 4907, // … with this customer (id) - int(1…)
    "keywords" : "shirt", // … with these words in SKU or name - string(1…100)
    "isDelivered" : true, // … that has been delivered - bool
    "isReturnable" : true // … that can be returned - bool
  },
  "fields" : [ "shipment", "orderItem", "quantity", … ], // returns only these fields - string
  "order" : [ "-deliveryDate" ], // sort order of returned shipment items, can contain "shipment", "-shipment", "deliveryDate", "-deliveryDate"
                                //  "order", "-order", "sku", "-sku", "name", "-name"
  "limit" : 10, // maximum number of shipment items to return - int(1…)
  "first" : 0 // index of the first shipment to return - int(0…)
}

Response

{
  "status" : "ok",
  "shipmentItems" : [ {
    "shipment" : 739820, // shipment (id) - int(1…)
    "orderItem" : 805703, // order item (id) - int(1…)
    "quantity" : 3.00, // shipment item quantity - int(1…) - decimal[8,2](0…)
    "deliveryDate": "2020-01-28", // delivery date (can be null) - date
    "order" : 1771949227, // order (id) - int(1…)
    "sku" : "A927TP", // SKU - string(0…40)
    "name" : "Shirt", // name - string(0…255)
    "returnableQuantity" : 1.00 // returnable quantity - decimal[8,2](0…)
  }, … ]
}

shipments.count-items

Number of shipment items that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.shipments.count-items', request, function(response) { … });
HTTP POST
/api/v8/commerce.shipments.count-items
{
  "conditions" : { // counts the shipment items …
    "orderItems" : [ 805703, null ], // … with these order items - int(1…)
    "customer" : 4907, // … with this customer (id) - int(1…)
    "keywords" : "shirt", // … with these words in SKU or name - string(1…100)
    "isDelivered" : true, // … that has been delivered - bool
    "isReturnable" : true // … that can be returned - bool
  }
}

Response

{
  "status" : "ok",
  "count" : 5470 // number of shipment items - int(0…)
}