Inbound Shipment is API Complete

Thursday, Dec 27, 2018

Inbound Shipment is API Complete in Sandbox and Production

The last callback is in place for Inbound Shipments. You can now complete receiving for any inbound shipment you have already created in sandbox. To trigger the completion of an inbound shipment, issue a POST to https://sandbox.masonhub.co/[account_slug]/api/v1/data_factory/inboundShipmentEvent with the following payload:

[
  {"customer_identifier":"shipment324324342", "event":"receivingCompleted"}
]

OR

[
  {"customer_identifier":"shipment324324342", "event":"receivingCompleted", "randomize_receipt_qty": true}
]

The second post will randomize the number of items received per line item in the inbound shipment. This will allow you to simulate receiving different than the quantity you expected. To receive fully, simply omit the randomize_receipt_qty attribute.

When the data factory completes receiving for the supplied inbound shipment, it does two things:

  • Adds entries to the inventory ledger to simulate the receipt of goods. You will get a skuInventoryChange callback for every line item on the inbound shipment, alerting you to the drop in expected quantities and a rise in received quantities. Sellable quantities are not affected during this transaction. Use the createAvailable data factory for adding inventory to a sku.
  • Trigger the callback to your inboundShipmentEvent endpoint with a similar payload as the onDock and receivingStarted events. The event_type will be receivingCompleted but the payload will now contain a complete Inbound Shipment Detail schema with quantities received in a details attribute, like below:
{
  "callback_url": "https://client.com/api/inbound_shipment_event",
  "message_type": "inboundShipmentEvent",
  "message_id": "0896116f-e54b-4756-9d3e-1b0c4a25d821",
  "data": [
            {
              "id": "33455ccc-40f5-431b-81a1-44098f8a92bd",
              "customer_identifier": "12345",
              "status": "receivingComplete",
              "as_of": "2018-12-11T15:53:23Z",
              "details": {
                          "id": "33455ccc-40f5-431b-81a1-44098f8a92bd",
                          "customer_identifier": "shipment32432",
                          "customer_purchase_order_id": "po234532",
                          "inventory_location_id": "52c7c6ee-6e63-4f25-db83-c987fc52116c",
                          "inventory_location_address": "MasonHub Rancho | 1 Mason Way Rancho Cucomunga, CA 97130",
                          "status": "receivingComplete",
                          "carrier_information": {
                            "name": "Frank's Red Hot Carrier",
                            "type": "TL",
                            "contact_name": "John Jacob",
                            "driver_name": "Donny James",
                            "driver_phone": "555-343-4213"
                          },
                          "tracking_number": "356732154",
                          "shipper": "Freddie's Pirate Army",
                          "shipper_city": "Kalamazoo",
                          "shipper_locale": "MI",
                          "shipper_country": "US",
                          "expected_arrival_date": "2018-12-11T10:00:00Z",
                          "arrived_at": "2018-12-11T09:15:00Z",
                          "started_receiving_at": "2018-12-11T11:01:24Z",
                          "finished_receiving_at": "2018-12-11T15:53:23Z",
                          "exceptions": "no exceptions",
                          "special_instructions": "fold shirts using template provided.",
                          "comments": "These shipments often come mixed.",
                          "line_items": [
                                          {
                                            "customer_sku_id": "shirt-534212",
                                            "sku_id": "cbec7231-7d64-4b57-8bf0-3e3e13315993",
                                            "quantity": 100,
                                            "total_quantity_received": 90,
                                            "not_on_original_shipment": false
                                          },
                                          {
                                            "customer_sku_id": "pant-342353",
                                            "sku_id": "df362d26-d796-41f5-90f7-60b77c28c236",
                                            "quantity": 100,
                                            "total_quantity_received": 100,
                                            "not_on_original_shipment": false
                                          }
                                        ],
                          "version": 8,
                          "created_at": "2018-12-01T11:52:53Z",
                          "updated_at": "2018-12-16T13:43:09Z"
                        }
              }
            ]
}

Full specs for the inbound shipment event data factory are here: https://docs.masonhub.co/api/v1#tag/DataFactory/paths/~1data_factory~1inboundShipmentEvent/post.

With this last addition, the inbound shipments resource is officially API complete. As always, don’t be afraid to reach out to Chris or Andy with any questions.

Happy Coding.