Skip to content

Multi Events

Endpoint URL

https://connect.wholechain.com/Integration/Events

Sandbox URL

https://connect-sandbox.wholechain.com/Integration/Events

Method:
POST


Introduction

A multi-event payload allows Wholechain users to submit a single API request containing multiple supply chain events such as Commission, Aggregation, Ship, Receive, and Disaggregation. This approach links all the included events together seamlessly, creating a comprehensive record of product movement and transformations within the supply chain.

By using a multi-event payload, users can reduce the number of API calls needed to log events while maintaining proper traceability across various actions.


How it Works

  • Events are submitted in a specific order within a single JSON payload.
  • Each event includes its relevant metadata and relationships to prior events.
  • The Wholechain API processes the events sequentially to ensure consistency and traceability.

A typical multi-event payload might include:

  1. Commission: Establishes the product's origin.
  2. Aggregation: Groups items together into a single batch or lot.
  3. Ship: Logs a product being shipped.
  4. Receive: Captures the arrival of a product at its destination.
  5. Disaggregation: Splits previously aggregated items back into individual units.

Use Case

This API is ideal when multiple traceability events occur in quick succession or as part of a single operational workflow. For example:

  1. A seafood processor commissions freshly caught fish, aggregates them into a lot, ships the lot to a distributor, logs the receipt of the product, and then disaggregates it for further processing—all in one streamlined payload.

This reduces overhead and improves traceability efficiency for users who need to log complex workflows.


Payload Example: Multi-Event Request

Example 1

Below is a sample payload containing Commission, Aggregation, Ship, Receive, and Disaggregation events:

import requests

url = 'https://connect.wholechain.com/Integration/Events'
headers = {
    'accept': '*/*',
    'X-API-KEY': '0193d377-c0db-7a01-949d-0ffaf166e236',
    'Content-Type': 'application/json'
}
data = {
"Events": [
    {
    "$type": "commission",
    "Location": {
        "Id": "shipFrom_000"
    },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "1990091",
        "Product": {
            "Id": "prod_000"
        }
        }
    ],
    "Id": "0001",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:commissioning",
    "Disposition": "urn:epcglobal:cbv:disp:active",
    "EventTime": "2024-03-30T13:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [
        {
        "Name": "expiry_date",
        "Namespace": "",
        "Value": "2024-03-30",
        "PropertyLocation": "ILMD"
        }
    ],
    "CertificationList": [
        {
        "Type": "urn:gdst:certType:harvestCoC",
        "Standard": "MSC Chain of Custody",
        "Agency": "MSC",
        "Value": "NO",
        "Identification": "NA"
        },
        {
        "Type": "urn:gdst:certType:fishingAuth",
        "Standard": "Los Angeles Fishing Authorization",
        "Agency": "Los Angeles Fishing Authorization",
        "Value": "",
        "Identification": ""
        },
        {
        "Type": "urn:gdst:certType:humanPolicy",
        "Standard": "WHO Human Decency Policy",
        "Agency": "WHO",
        "Value": "",
        "Identification": ""
        }
    ]
    },
    {
    "$type": "aggregation",
    "Location": {
        "Id": "shipFrom_000"
    },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "1990091",
        "Product": {
            "Id": "prod_000"
        }
        }
    ],
    "Container": {
        "Id": "123456",
        "Type": "LogisticsId"
    },
    "Id": "0002",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:commissioning",
    "Disposition": "urn:epcglobal:cbv:disp:active",
    "EventTime": "2024-03-30T14:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [
        {
        "Name": "expiry_date",
        "Namespace": "",
        "Value": "2024-03-30",
        "PropertyLocation": "ILMD"
        }
    ],
    "CertificationList": [
        {
        "Type": "urn:gdst:certType:harvestCoC",
        "Standard": "MSC Chain of Custody",
        "Agency": "MSC",
        "Value": "NO",
        "Identification": "NA"
        },
        {
        "Type": "urn:gdst:certType:fishingAuth",
        "Standard": "Los Angeles Fishing Authorization",
        "Agency": "Los Angeles Fishing Authorization",
        "Value": "",
        "Identification": ""
        },
        {
        "CertificationType": "urn:gdst:certType:humanPolicy",
        "Standard": "WHO Human Decency Policy",
        "Agency": "WHO",
        "Value": "",
        "Identification": ""
        }
    ]
    },
    {
    "$type": "ship",
    "ShipFromLocation": {
        "Id": "shipFrom_000"
    },
    "ShipToLocation": {
        "Id": "shipTo_000"
    },
    "ProductInstances": [],
    "Container": {
        "Id": "123456"
    },
    "Id": "0003",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-30T15:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [
        {
        "Name": "expiry_date",
        "Namespace": "",
        "Value": "2024-03-30",
        "PropertyLocation": "ILMD"
        }
    ],
    "CertificationList": [
        {
        "Type": "urn:gdst:certType:harvestCoC",
        "Standard": "MSC Chain of Custody",
        "Agency": "MSC",
        "Value": "NO",
        "Identification": "NA"
        },
        {
        "Type": "urn:gdst:certType:fishingAuth",
        "Standard": "Los Angeles Fishing Authorization",
        "Agency": "Los Angeles Fishing Authorization",
        "Value": "",
        "Identification": ""
        },
        {
        "Type": "urn:gdst:certType:humanPolicy",
        "Standard": "WHO Human Decency Policy",
        "Agency": "WHO",
        "Value": "",
        "Identification": ""
        }
    ]
    },
    {
    "$type": "receive",
    "ShipFromLocation": {
        "Id": "shipFrom_000"
    },
    "ShipToLocation": {
        "Id": "shipTo_000"
    },
    "ProductInstances": [],
    "Container": {
        "Id": "123456"
    },
    "Id": "0004",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-30T16:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    },
    {
    "$type": "disaggregation",
    "Location": {
        "Id": "shipTo_000"
    },
    "Container": {
        "Id": "123456"
    },
    "Id": "0005",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:commissioning",
    "Disposition": "urn:epcglobal:cbv:disp:active",
    "EventTime": "2024-03-30T17:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    }
]
}


response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.json())
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace WholechainAPIExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var url = "https://connect.wholechain.com/Integration/Events";
            var apiKey = "0193d377-c0db-7a01-949d-0ffaf166e236";

            var client = new HttpClient();

            // Set headers
            client.DefaultRequestHeaders.Add("accept", "*/*");
            client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);

            // Define payload
            var jsonPayload = @"{
                ""Events"": [
                    {
                        ""$type"": ""commission"",
                        ""Location"": { ""Id"": ""shipFrom_000"" },
                        ""ProductInstances"": [
                            {
                                ""Quantity"": 190.75,
                                ""LotSerial"": ""1990091"",
                                ""Product"": { ""Id"": ""prod_000"" }
                            }
                        ],
                        ""Id"": ""0001"",
                        ""PurchaseOrder"": ""1990091"",
                        ""InvoiceNumber"": ""12314154"",
                        ""BizStep"": ""urn:epcglobal:cbv:bizstep:commissioning"",
                        ""Disposition"": ""urn:epcglobal:cbv:disp:active"",
                        ""EventTime"": ""2024-03-30T13:00:00+00:00"",
                        ""EventTimeZone"": ""-05:00"",
                        ""CustomProperties"": [
                            {
                                ""Name"": ""expiry_date"",
                                ""Namespace"": """",
                                ""Value"": ""2024-03-30"",
                                ""PropertyLocation"": ""ILMD""
                            }
                        ],
                        ""CertificationList"": [
                            { ""Type"": ""urn:gdst:certType:harvestCoC"", ""Standard"": ""MSC Chain of Custody"", ""Agency"": ""MSC"", ""Value"": ""NO"", ""Identification"": ""NA"" }
                        ]
                    },
                    {
                        ""$type"": ""aggregation"",
                        ""Location"": { ""Id"": ""shipFrom_000"" },
                        ""ProductInstances"": [
                            {
                                ""Quantity"": 190.75,
                                ""LotSerial"": ""1990091"",
                                ""Product"": { ""Id"": ""prod_000"" }
                            }
                        ],
                        ""Container"": { ""Id"": ""123456"", ""Type"": ""LogisticsId"" },
                        ""Id"": ""0002"",
                        ""PurchaseOrder"": ""1990091"",
                        ""InvoiceNumber"": ""12314154"",
                        ""BizStep"": ""urn:epcglobal:cbv:bizstep:commissioning"",
                        ""Disposition"": ""urn:epcglobal:cbv:disp:active"",
                        ""EventTime"": ""2024-03-30T14:00:00+00:00"",
                        ""EventTimeZone"": ""-05:00""
                    }
                    // Add other events following this format
                ]
            }";

            // Convert the payload to StringContent
            var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

            try
            {
                // Send POST request
                var response = await client.PostAsync(url, content);

                // Print response status and content
                Console.WriteLine($"Status Code: {response.StatusCode}");
                var responseContent = await response.Content.ReadAsStringAsync();
                Console.WriteLine("Response:");
                Console.WriteLine(responseContent);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
    }
}
curl -X POST "https://connect.wholechain.com/Integration/Events" \
-H "accept: */*" \
-H "X-API-KEY: 0193d377-c0db-7a01-949d-0ffaf166e236" \
-H "Content-Type: application/json" \
-d '{
"Events": [
    {
    "$type": "commission",
    "Location": { "Id": "shipFrom_000" },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "1990091",
        "Product": { "Id": "prod_000" }
        }
    ],
    "Id": "0001",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:commissioning",
    "Disposition": "urn:epcglobal:cbv:disp:active",
    "EventTime": "2024-03-30T13:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [
        {
        "Name": "expiry_date",
        "Namespace": "",
        "Value": "2024-03-30",
        "PropertyLocation": "ILMD"
        }
    ],
    "CertificationList": [
        {
        "Type": "urn:gdst:certType:harvestCoC",
        "Standard": "MSC Chain of Custody",
        "Agency": "MSC",
        "Value": "NO",
        "Identification": "NA"
        }
    ]
    },
    {
    "$type": "aggregation",
    "Location": { "Id": "shipFrom_000" },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "1990091",
        "Product": { "Id": "prod_000" }
        }
    ],
    "Container": { "Id": "123456", "Type": "LogisticsId" },
    "Id": "0002",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:commissioning",
    "Disposition": "urn:epcglobal:cbv:disp:active",
    "EventTime": "2024-03-30T14:00:00+00:00",
    "EventTimeZone": "-05:00"
    }
    // Add additional events here as needed
]
}'

Example 2

Below is a sample payload containing Receive, Transform, and Ship events:

import requests

url = 'https://connect.wholechain.com/Integration/Events'
headers = {
    'accept': '*/*',
    'X-API-KEY': '0193d377-c0db-7a01-949d-0ffaf166e236',
    'Content-Type': 'application/json'
}
data = {
"Events": [
    {
    "$type": "receive",
    "ShipFromLocation": {
        "Id": "supplier_000"
    },
    "ShipToLocation": {
        "Id": "processing_000"
    },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "123",
        "Product": {
            "Id": "raw_goods_000"
        }
        }
    ],
    "Container": {},
    "Id": "0001",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-20T16:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    },
    {
    "$type": "transform",
    "Location": {
        "Id": "processing_000"
    },
    "InputProducts": [
        {
        "Quantity": 180.75,
        "LotSerial": "123",
        "Product": {
            "Id": "raw_goods_000"
        }
        }
    ],
    "OutputProducts": [
        {
        "Quantity": 180.0,
        "LotSerial": "456",
        "Product": {
            "Id": "finished_goods_000"
        }
        }
    ],
    "Id": "0002",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-25T15:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    },
    {
    "$type": "ship",
    "ShipFromLocation": {
        "Id": "processing_000"
    },
    "ShipToLocation": {
        "Id": "buyer_000"
    },
    "ProductInstances": [
        {
        "Quantity": 180.0,
        "LotSerial": "456",
        "Product": {
            "Id": "finished_goods_000"
        }
        }
    ],
    "Container": {},
    "Id": "0004",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-30T16:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    }
]
}


response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.json())
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace WholechainAPIExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var url = "https://connect.wholechain.com/Integration/Events";
            var apiKey = "0193d377-c0db-7a01-949d-0ffaf166e236";

            var client = new HttpClient();

            // Set headers
            client.DefaultRequestHeaders.Add("accept", "*/*");
            client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);

            // Define payload
            var jsonPayload = @"{
                ""Events"": [
                    {
                        ""$type"": ""receive"",
                        ""ShipFromLocation"": { ""Id"": ""supplier_000"" },
                        ""ShipToLocation"": { ""Id"": ""processing_000"" },
                        ""ProductInstances"": [
                            {
                                ""Quantity"": 190.75,
                                ""LotSerial"": ""123"",
                                ""Product"": { ""Id"": ""raw_goods_000"" }
                            }
                        ],
                        ""Container"": {},
                        ""Id"": ""0001"",
                        ""PurchaseOrder"": ""1990091"",
                        ""InvoiceNumber"": ""12314154"",
                        ""BizStep"": ""urn:epcglobal:cbv:bizstep:shipping"",
                        ""Disposition"": ""urn:epcglobal:cbv:disp:in_transit"",
                        ""EventTime"": ""2024-03-20T16:00:00+00:00"",
                        ""EventTimeZone"": ""-05:00"",
                        ""CustomProperties"": [],
                        ""CertificationList"": []
                    },
                    {
                        ""$type"": ""transform"",
                        ""Location"": { ""Id"": ""processing_000"" },
                        ""InputProducts"": [
                            {
                                ""Quantity"": 180.75,
                                ""LotSerial"": ""123"",
                                ""Product"": { ""Id"": ""raw_goods_000"" }
                            }
                        ],
                        ""OutputProducts"": [
                            {
                                ""Quantity"": 180.0,
                                ""LotSerial"": ""456"",
                                ""Product"": { ""Id"": ""finished_goods_000"" }
                            }
                        ],
                        ""Id"": ""0002"",
                        ""PurchaseOrder"": ""1990091"",
                        ""InvoiceNumber"": ""12314154"",
                        ""BizStep"": ""urn:epcglobal:cbv:bizstep:shipping"",
                        ""Disposition"": ""urn:epcglobal:cbv:disp:in_transit"",
                        ""EventTime"": ""2024-03-25T15:00:00+00:00"",
                        ""EventTimeZone"": ""-05:00"",
                        ""CustomProperties"": [],
                        ""CertificationList"": []
                    },
                    {
                        ""$type"": ""ship"",
                        ""ShipFromLocation"": { ""Id"": ""processing_000"" },
                        ""ShipToLocation"": { ""Id"": ""buyer_000"" },
                        ""ProductInstances"": [
                            {
                                ""Quantity"": 180.0,
                                ""LotSerial"": ""456"",
                                ""Product"": { ""Id"": ""finished_goods_000"" }
                            }
                        ],
                        ""Container"": {},
                        ""Id"": ""0004"",
                        ""PurchaseOrder"": ""1990091"",
                        ""InvoiceNumber"": ""12314154"",
                        ""BizStep"": ""urn:epcglobal:cbv:bizstep:shipping"",
                        ""Disposition"": ""urn:epcglobal:cbv:disp:in_transit"",
                        ""EventTime"": ""2024-03-30T16:00:00+00:00"",
                        ""EventTimeZone"": ""-05:00"",
                        ""CustomProperties"": [],
                        ""CertificationList"": []
                    }
                ]
            }";

            // Convert the payload to StringContent
            var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

            try
            {
                // Send POST request
                var response = await client.PostAsync(url, content);

                // Print response status and content
                Console.WriteLine($"Status Code: {response.StatusCode}");
                var responseContent = await response.Content.ReadAsStringAsync();
                Console.WriteLine("Response:");
                Console.WriteLine(responseContent);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
    }
}
curl -X POST "https://connect.wholechain.com/Integration/Events" \
-H "accept: */*" \
-H "X-API-KEY: 0193d377-c0db-7a01-949d-0ffaf166e236" \
-H "Content-Type: application/json" \
-d '{
"Events": [
    {
    "$type": "receive",
    "ShipFromLocation": {
        "Id": "supplier_000"
    },
    "ShipToLocation": {
        "Id": "processing_000"
    },
    "ProductInstances": [
        {
        "Quantity": 190.75,
        "LotSerial": "123",
        "Product": {
            "Id": "raw_goods_000"
        }
        }
    ],
    "Container": {},
    "Id": "0001",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-20T16:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    },
    {
    "$type": "transform",
    "Location": {
        "Id": "processing_000"
    },
    "InputProducts": [
        {
        "Quantity": 180.75,
        "LotSerial": "123",
        "Product": {
            "Id": "raw_goods_000"
        }
        }
    ],
    "OutputProducts": [
        {
        "Quantity": 180.0,
        "LotSerial": "456",
        "Product": {
            "Id": "finished_goods_000"
        }
        }
    ],
    "Id": "0002",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-25T15:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    },
    {
    "$type": "ship",
    "ShipFromLocation": {
        "Id": "processing_000"
    },
    "ShipToLocation": {
        "Id": "buyer_000"
    },
    "ProductInstances": [
        {
        "Quantity": 180.0,
        "LotSerial": "456",
        "Product": {
            "Id": "finished_goods_000"
        }
        }
    ],
    "Container": {},
    "Id": "0004",
    "PurchaseOrder": "1990091",
    "InvoiceNumber": "12314154",
    "BizStep": "urn:epcglobal:cbv:bizstep:shipping",
    "Disposition": "urn:epcglobal:cbv:disp:in_transit",
    "EventTime": "2024-03-30T16:00:00+00:00",
    "EventTimeZone": "-05:00",
    "CustomProperties": [],
    "CertificationList": []
    }
]
}'