Shipment methods for the Cratejoy Merchant API

The following methods operate on the Shipment data model.

GET http://api.cratejoy.com/v1/shipments/
GET http://api.cratejoy.com/v1/shipments/{ship_id}
PUT http://api.cratejoy.com/v1/shipments/{ship_id}/

List Shipments

GET http://api.cratejoy.com/v1/shipments/
$.ajax({
    url: 'https://api.cratejoy.com/v1/shipments/',
    method: 'GET'
});
{
  "count": 1,
  "next": null,
  "prev": null,
  "results": [
    {
      "adjusted_ordered_at": "2015-08-15T20:00:24Z", 
      "created_at": "2015-07-15T20:00:24Z", 
      "customer": {...}, // Customer relation property 
      "customer_id": 75561862,
      "fulfillments": {...}, // Fulfillments relation property
      "id": 75562100, 
      "is_gift": false,
      "is_test": true, 
      "labels": {...}, // Labels relation property 
      "ship_address": {...}, // Ship_Address relation property
      "shipped_at": null, 
      "status": "unshipped",
      "target_at": "2017-02-13T14:51:28Z",
      "tracking_number": null, 
      "type": "shipment",
      "url": "/v1/shipments/62619521654545/
    }
 }
{
  "adjusted_ordered_at": 1440478800000, 
  "created_at": 1440478800000, 
  "customer": "/v1/customers/75561862", 
  "fulfillments": "/v1/shipments/75562100/fulfillments", 
  "id": 75562100, 
  "is_test": true, 
  "labels": "/v1/shipments/75562100/labels", 
  "ship_address": "/v1/shipments/75562100/ship_address", 
  "shipped_at": null, 
  "status": "unshipped", 
  "target_at": 1440478800000, 
  "tracking_number": null, 
  "type": "shipment"
}

Get a shipment

GET http://api.cratejoy.com/v1/shipments/{ship_id}
$.ajax({
    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',
    method: 'GET'
});

Update a shipment

For more details on updating a shipment to include tracking information, check out Adding Tracking to a Shipment.

PUT http://api.cratejoy.com/v1/shipments/{ship_id}/
$.ajax({
    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',
    method: 'PUT',
    data: {
        adjusted_ordered_at: "2015-08-25 00:00:00Z",
        tracking_number: "D2FA3GA57H0NDSF9FAE8G6AR3H4AT",
        status: "shipped",
      	carrier_name: "USPS", // Optional
      	tracking_link: "https:\\tools.usps.com\go\TrackConfirmAction.action?tLabels=D2FA3GA57H0NDSF9FAE8G6AR3H4AT" // Optional
    },
});
$.ajax({
    url: 'https://api.cratejoy.com/v1/shipments/62619521654545/',
    headers: {
        // Optional: Product feedback enabled settings, true or false.
      	'X-Cratejoy-ProductFeedback-Enabled': true,
      	// Optional: Product feedback interval.
        'X-Cratejoy-ProductFeedback-Interval': 15
    },
    method: 'PUT',
    data: {
        shipped_at: "2015-09-01T12:30:00Z",
        adjusted_ordered_at: "2015-08-25 00:00:00Z",
        tracking_number: "1Z9999999999999999",
        status: "shipped"
    },
});

For a complete list of writable properties, see the Shipment data model .

Shipment Metadata

The following methods operate on the Shipment Metadata subresource.

GET http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/
POST http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/
DELETE http://api.cratejoy.com/v1/shipments/{ship_id}/metadata/