Product Creation
Endpoint URL
https://connect.wholechain.com/Integration/Products
Sandbox URL
https://connect-sandbox.wholechain.com/Integration/Products
Method
POST
Create Product
This endpoint is used to create new product entries in the Wholechain platform. A product serves as the base entity for traceability and enables tracking through various supply chain events.
Introduction
The Product Creation API allows users to register products with detailed specifications such as name, unit of measurement, sharing policy, and identifiers. Once a product is created, it can be referenced across the supply chain in various events like receiving, shipping, or transforming.
Authentication
The API uses an API key (X-API-KEY
) to authenticate requests. Each user has a unique API key that controls access to product creation. For more details, see the Authentication page.
Request Headers
Header | Description | Example Value |
---|---|---|
X-API-KEY |
Your API key | 743e286e-c578-461d-afc6-bd82efe4e6bb |
Content-Type |
Content type of the request | application/json |
accept |
Response content type | */* |
Product Object
Column Name | Data Type | Description | Required |
---|---|---|---|
Id |
STRING | Unique identifier for the product. | Yes |
Details |
OBJECT | Contains detailed information about the product. | Yes |
Details Object
Column Name | Data Type | Description | Required |
---|---|---|---|
Name |
STRING | Name of the product. | Yes |
SimpleUnitOfMeasurement |
STRING | Unit of measurement (e.g., Kgm for kilograms). |
Yes |
UnitQuantity |
DECIMAL | Quantity of the product in the specified unit. | Yes |
SharingPolicy |
STRING | Sharing policy (e.g., Open , Closed ). |
Yes |
ProductIdentifierType |
STRING | Type of product identifier (e.g., Lot , Serial ). |
Yes |
Gtin |
STRING | Global Trade Item Number, if applicable. | No (Remove variable if not using) |
Plu |
STRING | Price Lookup Code, if applicable. | No (Remove variable if not using) |
Example Requests
import requests
url = 'https://connect.wholechain.com/Integration/Products'
headers = {
'accept': '*/*',
'X-API-KEY': '733e286e-c578-461d-afc6-bd82efe4e6bb',
'Content-Type': 'application/json'
}
data = {
"Products": [
{
"Id": "12345",
"Details": {
"Name": "Sample Product",
"SimpleUnitOfMeasurement": "Kgm",
"UnitQuantity": 10.5,
"SharingPolicy": "Open",
"ProductIdentifierType": "Lot",
"Gtin": "12345678912343",
"Plu": "4001"
}
}
]
}
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;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
var url = "https://connect.wholechain.com/Integration/Products";
var apiKey = "733e286e-c578-461d-afc6-bd82efe4e6bb";
var data = new
{
Products = new[]
{
new
{
Id = "12345",
Details = new
{
Name = "Sample Product",
SimpleUnitOfMeasurement = "Kgm",
UnitQuantity = 10.5,
SharingPolicy = "Open",
ProductIdentifierType = "Lot",
Gtin = "12345678912343",
Plu = "4001"
}
}
}
};
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("accept", "*/*");
client.DefaultRequestHeaders.Add("X-API-KEY", apiKey);
var json = JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
Console.WriteLine($"Status Code: {response.StatusCode}");
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
}
curl -X POST https://connect.wholechain.com/Integration/Products \
-H "accept: */*" \
-H "X-API-KEY: 733e286e-c578-461d-afc6-bd82efe4e6bb" \
-H "Content-Type: application/json" \
-d '{
"Products": [
{
"Id": "12345",
"Details": {
"Name": "Sample Product",
"SimpleUnitOfMeasurement": "Kgm",
"UnitQuantity": 10.5,
"SharingPolicy": "Open",
"ProductIdentifierType": "Lot",
"Gtin": "12345678912343",
"Plu": "4001"
}
}
]
}'
Example Payload
{
"Products": [
{
"Id": "12345",
"Details": {
"Name": "Sample Product",
"SimpleUnitOfMeasurement": "Kgm",
"UnitQuantity": 10.5,
"SharingPolicy": "Open",
"ProductIdentifierType": "Lot",
"Gtin": "12345678912343",
"Plu": "4001"
}
}
]
}