List Products
curl -X GET "https://connect.wholechain.com/Integration/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=1&PageSize=10" \
-H "Content-Type: application/json" \
-H "X-API-KEY: example_string"
import requests
import json
url = "https://connect.wholechain.com/Integration/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=1&PageSize=10"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "example_string"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://connect.wholechain.com/Integration/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=1&PageSize=10", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "example_string"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://connect.wholechain.com/Integration/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=1&PageSize=10", nil)
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/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=1&PageSize=10')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-KEY'] = 'example_string'
response = http.request(request)
puts response.body
{
"grossCount": 82,
"totalPages": 9,
"pageNumber": 1,
"pageSize": 10,
"totalItems": 82,
"results": [
{
"id": "123456",
"urn": "urn:gdst:wholechain.com:product:class:raindropsolutions.sampleproduct-1",
"details": {
"name": "Sample Product",
"simpleUnitOfMeasurement": "Kgm",
"unitQuantity": 2,
"sharingPolicy": "Open",
"productIdentifierType": "Lot",
"unitDescriptor": "Cases",
"gtin": "12345678912343",
"productMasterData": [],
"plu": "4001"
},
"updateIfExists": false
}
],
"hasNextPage": true,
"hasPreviousPage": false
}
"PageNumber and PageSize must be greater than 0."
/Integration/Products
Target server for requests. Edit to use your own host.
Filter by sharing policy. Supported values are Open and Restricted.
Return archived products when true; non-archived products when false.
Default 1, minimum 1.
Default 20, minimum 1.
API key used to authenticate the request.
Request Preview
Response
Response will appear here after sending the request
Responses
Total number of products before pagination.
Total number of result pages.
Current page number.
Maximum number of products per page.
Total number of matching products.
Indicates whether another page of results is available.
Indicates whether a previous page of results is available.
Introduction
The Get Products API allows you to retrieve a list of products available within your Wholechain account.
All query parameters are optional. You can filter the results by:
- Sharing policy
- Archived status
- Page number
- Page size
If PageNumber and PageSize are omitted, the first page of 20 products is returned. Use PageNumber, PageSize and hasNextPage to read all products.
Request Headers
| Header | Required | Description | Example Value |
|---|---|---|---|
X-API-KEY | Yes | API key used to authenticate the request. | YOUR_API_KEY |
accept | No | Response content type. | text/plain |
Query Parameters
All query parameters are optional.
| Parameter | Data Type | Required | Description | Example |
|---|---|---|---|---|
SharingPolicies | STRING | No | Filters products by sharing policy. Supported values are Open and Restricted. If omitted, products with all sharing policies are returned. | Open/Restricted |
ShowArchived | BOOLEAN | No | Filters products based on their archived status. See behavior below. | true/false |
PageNumber | INTEGER | No | Page number to return. Default 1, minimum 1. | 1 |
PageSize | INTEGER | No | Number of products per page. Default 20, minimum 1. | 10 |
Sharing Policy Filter
The SharingPolicies parameter can be used to return products based on their sharing policy.
| Value | Result |
|---|---|
Open | Returns products with an Open sharing policy. |
Restricted | Returns products with a Restricted sharing policy. |
| Not provided | Returns products regardless of sharing policy. |
Archived Product Filter
The ShowArchived parameter determines whether archived or non-archived products are returned.
ShowArchived Value | Result |
|---|---|
true | Returns archived products only. |
false | Returns non-archived products only. |
| Not provided | Returns both archived and non-archived products. |
Pagination
PageNumber and PageSize can optionally be used to paginate the results.
If PageNumber and PageSize are omitted, the first page of 20 products is returned. Use PageNumber, PageSize and hasNextPage to read all products.
If PageNumber or PageSize is less than 1, the API returns HTTP 400 with the plain JSON string "PageNumber and PageSize must be greater than 0.".
Get Products (first page)
To retrieve the first page of products, call the endpoint with only your API key.
curl -X 'GET' \
'https://connect.wholechain.com/Integration/Products' \
-H 'accept: text/plain' \
-H 'X-API-KEY: YOUR_API_KEY'
This returns the first page of 20 products without applying sharing policy or archived status filters.
Example With Filters
The following example returns:
- Products with an
Opensharing policy - Archived products only
- Page
10 10products per page
curl -X 'GET' \
'https://connect.wholechain.com/Integration/Products?SharingPolicies=Open&ShowArchived=true&PageNumber=10&PageSize=10' \
-H 'accept: text/plain' \
-H 'X-API-KEY: YOUR_API_KEY'
Example Requests
| Requirement | Request |
|---|---|
| First page of products | /Integration/Products |
| Open products | /Integration/Products?SharingPolicies=Open |
| Restricted products | /Integration/Products?SharingPolicies=Restricted |
| Archived products only | /Integration/Products?ShowArchived=true |
| Non-archived products only | /Integration/Products?ShowArchived=false |
| First 10 products | /Integration/Products?PageNumber=1&PageSize=10 |
| Open, archived products | /Integration/Products?SharingPolicies=Open&ShowArchived=true |
Example Response
{
"grossCount": 82,
"totalPages": 9,
"pageNumber": 1,
"pageSize": 10,
"totalItems": 82,
"results": [
{
"id": "123456",
"urn": "urn:gdst:wholechain.com:product:class:raindropsolutions.sampleproduct-1",
"details": {
"name": "Sample Product",
"simpleUnitOfMeasurement": "Kgm",
"unitQuantity": 2,
"sharingPolicy": "Open",
"productIdentifierType": "Lot",
"unitDescriptor": "Cases",
"gtin": "12345678912343",
"productMasterData": [],
"plu": "4001"
},
"updateIfExists": false
}
],
"hasNextPage": true,
"hasPreviousPage": false
}
Response Pagination Fields
| Field | Description |
|---|---|
totalPages | Total number of pages available. |
pageNumber | Current page number. |
pageSize | Number of products returned per page. |
totalItems | Total number of matching products. |
results | Array containing the products returned for the current page. |
hasNextPage | Indicates whether another page of results is available. |
hasPreviousPage | Indicates whether a previous page of results is available. |
Important Notes
- Only the
X-API-KEYheader is required. - All query parameters are optional.
- If
SharingPoliciesis omitted, products from all sharing policies are returned. - If
ShowArchivedis omitted, both archived and non-archived products are returned. PageNumberandPageSizeare only required if you want to control pagination.- Calling the base endpoint with only the API key returns the first page of 20 products.