Create a Commission Event
Create a Commission Event. The request example includes all fields documented for this event, including optional fields.
curl -X POST "https://connect.wholechain.com/Integration/Events" \
-H "Content-Type: application/json" \
-H "X-API-KEY: example_string" \
-d '{
"Events": [
{
"$type": "commission",
"Location": {
"Id": "processing_001",
"Details": {
"TradePartner": {
"Id": "processor_001",
"Name": "Processor Name",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing Facility",
"Gln": "9506000140445",
"Extension": "SomeExtension",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Processing Contact",
"Phone": "+1234567890",
"Email": "processing@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "123 Processing Street",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "lot_001",
"Product": {
"Id": "rawgoods_001",
"Details": {
"ProductIdentifierType": "Lot",
"Name": "Raw Goods",
"SimpleUnitOfMeasurement": "Kgm",
"SharingPolicy": "Open",
"UnitDescriptor": "Cases",
"UnitQuantity": 10.5,
"GTIN": "12345678912343",
"PLU": "4001",
"MasterData": [
{
"name": "Gear Type",
"namespace": "custom",
"value": "GEAR TYPE_VALUE"
}
]
}
}
}
],
"Id": "commission_001",
"PurchaseOrder": "PO-12345",
"InvoiceNumber": "INV-12345",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00",
"CustomProperties": [
{
"Name": "quality_grade",
"Namespace": "custom",
"Value": "A"
}
],
"CertificationList": [
{
"Type": "urn:gdst:certType:harvestCoC",
"Standard": "MSC Chain of Custody",
"Agency": "MSC",
"Value": "YES",
"Identification": "MSC-C-12345"
}
]
}
]
}'
import requests
import json
url = "https://connect.wholechain.com/Integration/Events"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "example_string"
}
data = {
"Events": [
{
"$type": "commission",
"Location": {
"Id": "processing_001",
"Details": {
"TradePartner": {
"Id": "processor_001",
"Name": "Processor Name",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing Facility",
"Gln": "9506000140445",
"Extension": "SomeExtension",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Processing Contact",
"Phone": "+1234567890",
"Email": "processing@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "123 Processing Street",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "lot_001",
"Product": {
"Id": "rawgoods_001",
"Details": {
"ProductIdentifierType": "Lot",
"Name": "Raw Goods",
"SimpleUnitOfMeasurement": "Kgm",
"SharingPolicy": "Open",
"UnitDescriptor": "Cases",
"UnitQuantity": 10.5,
"GTIN": "12345678912343",
"PLU": "4001",
"MasterData": [
{
"name": "Gear Type",
"namespace": "custom",
"value": "GEAR TYPE_VALUE"
}
]
}
}
}
],
"Id": "commission_001",
"PurchaseOrder": "PO-12345",
"InvoiceNumber": "INV-12345",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00",
"CustomProperties": [
{
"Name": "quality_grade",
"Namespace": "custom",
"Value": "A"
}
],
"CertificationList": [
{
"Type": "urn:gdst:certType:harvestCoC",
"Standard": "MSC Chain of Custody",
"Agency": "MSC",
"Value": "YES",
"Identification": "MSC-C-12345"
}
]
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://connect.wholechain.com/Integration/Events", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "example_string"
},
body: JSON.stringify({
"Events": [
{
"$type": "commission",
"Location": {
"Id": "processing_001",
"Details": {
"TradePartner": {
"Id": "processor_001",
"Name": "Processor Name",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing Facility",
"Gln": "9506000140445",
"Extension": "SomeExtension",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Processing Contact",
"Phone": "+1234567890",
"Email": "processing@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "123 Processing Street",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "lot_001",
"Product": {
"Id": "rawgoods_001",
"Details": {
"ProductIdentifierType": "Lot",
"Name": "Raw Goods",
"SimpleUnitOfMeasurement": "Kgm",
"SharingPolicy": "Open",
"UnitDescriptor": "Cases",
"UnitQuantity": 10.5,
"GTIN": "12345678912343",
"PLU": "4001",
"MasterData": [
{
"name": "Gear Type",
"namespace": "custom",
"value": "GEAR TYPE_VALUE"
}
]
}
}
}
],
"Id": "commission_001",
"PurchaseOrder": "PO-12345",
"InvoiceNumber": "INV-12345",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00",
"CustomProperties": [
{
"Name": "quality_grade",
"Namespace": "custom",
"Value": "A"
}
],
"CertificationList": [
{
"Type": "urn:gdst:certType:harvestCoC",
"Standard": "MSC Chain of Custody",
"Agency": "MSC",
"Value": "YES",
"Identification": "MSC-C-12345"
}
]
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"Events": [
{
"$type": "commission",
"Location": {
"Id": "processing_001",
"Details": {
"TradePartner": {
"Id": "processor_001",
"Name": "Processor Name",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing Facility",
"Gln": "9506000140445",
"Extension": "SomeExtension",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Processing Contact",
"Phone": "+1234567890",
"Email": "processing@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "123 Processing Street",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "lot_001",
"Product": {
"Id": "rawgoods_001",
"Details": {
"ProductIdentifierType": "Lot",
"Name": "Raw Goods",
"SimpleUnitOfMeasurement": "Kgm",
"SharingPolicy": "Open",
"UnitDescriptor": "Cases",
"UnitQuantity": 10.5,
"GTIN": "12345678912343",
"PLU": "4001",
"MasterData": [
{
"name": "Gear Type",
"namespace": "custom",
"value": "GEAR TYPE_VALUE"
}
]
}
}
}
],
"Id": "commission_001",
"PurchaseOrder": "PO-12345",
"InvoiceNumber": "INV-12345",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00",
"CustomProperties": [
{
"Name": "quality_grade",
"Namespace": "custom",
"Value": "A"
}
],
"CertificationList": [
{
"Type": "urn:gdst:certType:harvestCoC",
"Standard": "MSC Chain of Custody",
"Agency": "MSC",
"Value": "YES",
"Identification": "MSC-C-12345"
}
]
}
]
}`)
req, err := http.NewRequest("POST", "https://connect.wholechain.com/Integration/Events", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-KEY", "example_string")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://connect.wholechain.com/Integration/Events')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-KEY'] = 'example_string'
request.body = '{
"Events": [
{
"$type": "commission",
"Location": {
"Id": "processing_001",
"Details": {
"TradePartner": {
"Id": "processor_001",
"Name": "Processor Name",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing Facility",
"Gln": "9506000140445",
"Extension": "SomeExtension",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Processing Contact",
"Phone": "+1234567890",
"Email": "processing@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "123 Processing Street",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "lot_001",
"Product": {
"Id": "rawgoods_001",
"Details": {
"ProductIdentifierType": "Lot",
"Name": "Raw Goods",
"SimpleUnitOfMeasurement": "Kgm",
"SharingPolicy": "Open",
"UnitDescriptor": "Cases",
"UnitQuantity": 10.5,
"GTIN": "12345678912343",
"PLU": "4001",
"MasterData": [
{
"name": "Gear Type",
"namespace": "custom",
"value": "GEAR TYPE_VALUE"
}
]
}
}
}
],
"Id": "commission_001",
"PurchaseOrder": "PO-12345",
"InvoiceNumber": "INV-12345",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00",
"CustomProperties": [
{
"Name": "quality_grade",
"Namespace": "custom",
"Value": "A"
}
],
"CertificationList": [
{
"Type": "urn:gdst:certType:harvestCoC",
"Standard": "MSC Chain of Custody",
"Agency": "MSC",
"Value": "YES",
"Identification": "MSC-C-12345"
}
]
}
]
}'
response = http.request(request)
puts response.body
{
"message": "Events processed successfully",
"result": [
{
"id": "01a0d877-7871-79a5-a8c8-a2f45673633d",
"externalEventId": "commission_001",
"type": "Commission",
"status": "Created",
"eventDate": "2024-03-30T13:00:00+00:00",
"productInstances": [
{
"quantity": 190.75,
"lotSerial": "lot_001",
"status": "Created",
"id": "01a0d877-7871-7426-b365-3a587ad4f893",
"name": "Raw Goods",
"urn": "urn:gdst:wholechain.com:product:lot:class:raindropsolutions.rawgoods-1.lot_001"
}
],
"containers": [],
"directShipFallback": null,
"externalShipmentFailure": null
}
],
"locations": [
{
"id": "01a0d877-76de-7e96-ac8c-962a914952bf",
"status": "Created"
}
],
"products": [
{
"id": "01a0d877-7719-720e-8fd8-224e3fec0602",
"status": "Created"
}
],
"errors": [],
"validations": []
}
/Integration/Events
Target server for requests. Edit to use your own host.
The media type of the request body
API key used to authenticate the request.
Required. events.
Request Preview
Response
Response will appear here after sending the request
Responses
Optional. message.
Optional. result.
Optional. locations.
Optional. products.
Optional. errors.
Optional. validations.
Introduction
A Commission event represents a product coming into existence in its documented supply chain.
This typically occurs at the furthest upstream point of the traceability journey — either at the point of harvest or the first time a product is being documented as itself.
The purpose of this endpoint is to create a Commission event in Wholechain.
Creating a Commission Event
To create a Commission event, submit an event payload containing:
- The event information
- The Location where the product is being commissioned
- The Lot Number being commissioned
- The Product associated with that Product Instance
Some fields are always required, while others are only required when the referenced Location or Product does not already exist in your Wholechain master data.
Use the Required column in the tables below to determine which fields must be provided.
Request Body Parameters
Event Object
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Id | STRING | Unique identifier for the Commission event. | Yes |
PurchaseOrder | STRING | Purchase order associated with the event. | No |
InvoiceNumber | STRING | Invoice number associated with the event. | No |
EventTime | DATETIME | Local date and time when the event occurred, without a UTC offset, for example 2024-03-30T13:00:00. The time zone is taken from EventTimeZone. Any offset included in this value is ignored. | Yes |
EventTimeZone | STRING | Optional. Time zone of the event as a UTC offset in ±HH:MM format, for example -05:00. If omitted, the account's default time zone (selected when the account was created) is used. | No |
Location Object
Every Commission event must identify the Location where the product is being commissioned.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Location.Id | STRING | Unique identifier for the Location. | Yes |
Location.Details | OBJECT | Information used to identify or create the Location. | Yes if Location does not exist |
Location Master Data
The Location.Id tells Wholechain which Location the Commission event occurred at.
If that Location already exists in your Wholechain master data, the Id is sufficient.
"Location": {
"Id": "4567"
}
If the supplied Location.Id does not already exist in your Wholechain master data, the Details object must be included.
Wholechain will use the information in Details to create the Location before processing the Commission event.
"Location": {
"Id": "4567",
"Details": {
"TradePartner": {
"Id": "TpId123",
"Name": "Me",
"ConnectionType": "SELF"
},
"Name": "Processing",
"Address": {
"Country": "South Africa",
"AddressLine1": "75 Bay Beach Avenue",
"PostalCode": "8001"
}
}
}
This ensures the Location required by the Commission event exists before the event is processed.
Location Details Object
Trade Partner
A Location must belong to a Trade Partner.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
TradePartner | OBJECT | Trade Partner associated with the Location. | Yes |
TradePartner.Id | STRING | Unique identifier for the Trade Partner. | Yes |
TradePartner.Name | STRING | Name of the Trade Partner. | Yes |
TradePartner.ConnectionType | STRING | Type of relationship, such as SELF, SUPPLIER, BUYER, or OTHER. | Yes |
TradePartner.Duns | STRING | DUNS number associated with the Trade Partner. | No |
If the Trade Partner referenced in the Location already exists, its existing identifier can be used.
If it does not exist, Wholechain will create the Trade Partner using the information supplied before creating the Location.
Location Information
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Name | STRING | Name of the Location. | Yes |
Gln | STRING | Global Location Number of the Location. | No |
Extension | STRING | Additional Location information. | No |
CaptainsName | STRING | Name of the captain, where applicable. Only if the location is a vessel. | No |
DunsPlus4 | STRING | Four additional digits used to identify a specific Location associated with a DUNS number. | No |
Contact Information Object
Contact information can optionally be supplied when creating the Location.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
ContactInformation | OBJECT | Contact information associated with the Location. | No |
ContactInformation.Name | STRING | Name of the contact person. | No |
ContactInformation.Phone | STRING | Phone number of the contact person. | No |
ContactInformation.Email | STRING | Email address of the contact person. | No |
Address Object
The Address object contains the physical address associated with the Location.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Address | OBJECT | Address information for the Location. | Yes |
Address.City | STRING | City where the Location is situated. | No |
Address.State | STRING | State or region where the Location is situated. | No |
Address.Country | STRING | Country of the Location. | Yes |
Address.AddressLine1 | STRING | Primary address line of the Location. | Yes |
Address.AddressLine2 | STRING | Secondary address line of the Location. | No |
Address.PostalCode | STRING | Postal code of the Location. | No |
Address.GeoCoordinates | OBJECT | Geographical coordinates of the Location. | No |
Address.GeoCoordinates.Latitude | DECIMAL | Latitude of the Location. | Yes, if address information was not provided |
Address.GeoCoordinates.Longitude | DECIMAL | Longitude of the Location. | Yes, if address information was not provided |
Product Instance Object
The ProductInstances array identifies the lot and quantity being commissioned.
At least one Product Instance must be included in the Commission event.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Quantity | DECIMAL | Quantity of the product being commissioned. | Yes |
LotSerial | STRING | Lot or serial number associated with the Product Instance. | Yes |
Product | OBJECT | Product associated with the Product Instance. | Yes |
Product.Id | STRING | Unique identifier for the Product. | Yes |
Product.Details | OBJECT | Information used to create the Product if it does not already exist. | Required only if the product does not already exist |
Product Master Data
Every Product Instance must reference a Product.
The Product.Id tells Wholechain which Product is being commissioned.
If the Product already exists in your Wholechain master data, the Product can be referenced using its existing Id.
"Product": {
"Id": "raw_goods_000"
}
If the supplied Product.Id does not already exist in Wholechain, the Details object must be included.
Wholechain will create the Product using the information supplied before processing the Commission event.
"Product": {
"Id": "raw_goods_000",
"Details": {
"Name": "RawGoods",
"SimpleUnitOfMeasurement": "Lbs",
"UnitQuantity": 16,
"UnitDescriptor": "Cases",
"SharingPolicy": "Restricted",
"ProductIdentifierType": "Lot"
}
}
This ensures the Product referenced by the Commission event exists before the event is processed.
Product Details Object
The following fields are used when the Product does not already exist in Wholechain.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
Product.Details.Name | STRING | Name of the Product. | Yes |
Product.Details.SimpleUnitOfMeasurement | STRING | Unit of measurement for the Product, for example Lbs. | Yes |
Product.Details.UnitQuantity | DECIMAL | Quantity associated with a defined unit, for example 16 for a 16 lb case. | No |
Product.Details.UnitDescriptor | STRING | Description of the defined unit: one of Cases, Units, Totes, Pallets. | No |
Product.Details.SharingPolicy | STRING | Sharing policy for the Product, for example Restricted or Open. | Yes |
Product.Details.ProductIdentifierType | STRING | Type of Product identifier, for example Lot. | Yes |
Example Commission Event Payload
The example below shows a complete Commission event.
It includes Location and Product Details to demonstrate a scenario where the Location and Product do not yet exist in Wholechain.
If those master data records already exist, the corresponding Details objects can be omitted.
{
"Events": [
{
"$type": "commission",
"Location": {
"Id": "4567",
"Details": {
"TradePartner": {
"Id": "TpId123",
"Name": "Me",
"ConnectionType": "SELF",
"Duns": "123456789"
},
"Name": "Processing",
"Gln": "9506000140445",
"Extension": "Additional Location Information",
"CaptainsName": "Captain Name",
"DunsPlus4": "1234",
"ContactInformation": {
"Name": "Contact Name",
"Phone": "+1234567890",
"Email": "contact@example.com"
},
"Address": {
"City": "Cape Town",
"State": "Western Cape",
"Country": "South Africa",
"AddressLine1": "75 Bay Beach Avenue",
"AddressLine2": "Building 2",
"PostalCode": "8001",
"GeoCoordinates": {
"Latitude": -33.9249,
"Longitude": 18.4241
}
}
}
},
"ProductInstances": [
{
"Quantity": 190.75,
"LotSerial": "1990091",
"Product": {
"Id": "prod_000",
"Details": {
"Name": "RawGoods",
"SimpleUnitOfMeasurement": "Lbs",
"UnitQuantity": 16,
"UnitDescriptor": "Cases",
"SharingPolicy": "Restricted",
"ProductIdentifierType": "Lot"
}
}
}
],
"Id": "0082932",
"PurchaseOrder": "1990091",
"InvoiceNumber": "12314154",
"EventTime": "2024-03-30T13:00:00",
"EventTimeZone": "-05:00"
}
]
}
How Wholechain Processes the Payload
When the Commission event is submitted, Wholechain uses the information in the payload in the following order:
- Identify the Location using
Location.Id. - If the Location does not exist, create it using
Location.Details. - If the associated Trade Partner does not exist, create it using the supplied Trade Partner information.
- Identify the Product using
Product.Id. - If the Product does not exist, create it using
Product.Details. - Once the required Location, Trade Partner, and Product master data exists, process the Commission event.
If the event then fails validation, the master data created in steps 2–5 is not rolled back.
The Details fields therefore ensure that all master data required by the Commission event exists before Wholechain attempts to create the event.
Custom Properties and Certifications
A Commission event can also contain Custom Properties and Certifications when additional traceability information needs to be recorded.
The full example above includes CustomProperties and CertificationList; see the pages below for details.
For information about how to include them in your payload, see:
- Custom Properties: Custom Properties
- Certifications: Certifications
FSMA 204 Compliance
Additional event-specific fields may be required for certain traceability scenarios.
The TLC object is used for FSMA-related traceability scenarios where a vendor lot code changes and the relevant TLC information needs to be recorded.
For more information about TLC Source and other supported additional fields, see: