Create a Location Group
The request body is a single location group object, not an array. identifier and name are required; description is optional and is stored as an empty string when omitted.
curl -X POST "https://connect.wholechain.com/Integration/LocationGroup" \
-H "Content-Type: application/json" \
-H "X-API-KEY: example_string" \
-H "accept: */*" \
-d '{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}'
import requests
import json
url = "https://connect.wholechain.com/Integration/LocationGroup"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "example_string",
"accept": "*/*"
}
data = {
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://connect.wholechain.com/Integration/LocationGroup", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "example_string",
"accept": "*/*"
},
body: JSON.stringify({
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}`)
req, err := http.NewRequest("POST", "https://connect.wholechain.com/Integration/LocationGroup", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-KEY", "example_string")
req.Header.Set("accept", "*/*")
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/LocationGroup')
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['accept'] = '*/*'
request.body = '{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}'
response = http.request(request)
puts response.body
{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"errors": {
"X-API-KEY": [
"The apiKey field is required."
]
},
"traceId": "…"
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
{
"type": "https://tools.ietf.org/html/rfc4918#section-11.2",
"title": "Name is required.",
"status": 422,
"traceId": "…"
}
/Integration/LocationGroup
Target server for requests. Edit to use your own host.
The media type of the request body
Your Wholechain API key.
Response content type.
Required. Your identifier for the location group. Must not already be used by another location group.
Required. Name of the location group.
Optional. Description of the location group. Stored as an empty string when omitted.
Request Preview
Response
Response will appear here after sending the request
Responses
Introduction
This API creates a location group in Wholechain.
A location group is a named set of locations that you manage together, for example every location in one region or run by one team.
A location references a group through the locationGroup object in the location Details. See Create a Location / Trade Partner and Update a Location / Trade Partner.
To manage location groups in the Wholechain app, see Location Groups.
Endpoint
| Method | URL |
|---|---|
POST | https://connect.wholechain.com/Integration/LocationGroup |
Request Headers
| Header | Description | Example Value |
|---|---|---|
X-API-KEY | Your Wholechain API key. | <YOUR_API_KEY> |
Content-Type | Content type of the request. application/json and application/xml are accepted. | application/json |
accept | Response content type. | */* |
Request Body
The request body is a single location group object.
| Column Name | Data Type | Description | Required |
|---|---|---|---|
identifier | STRING | Your identifier for the location group. Must not already be used by another location group. | Yes |
name | STRING | Name of the location group. | Yes |
description | STRING | Description of the location group. If omitted, it is stored as an empty string. | No |
Example Request
{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}
cURL
curl -X 'POST' \
'https://connect.wholechain.com/Integration/LocationGroup' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: YOUR_API_KEY' \
-d '{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}'
Responses
201 — Created
The location group is created. The response body is a location group object with the same fields as the request: identifier, name, and description.
{
"identifier": "GROUP-001",
"name": "Processing Plants",
"description": "Primary processing plant group"
}
409 — Conflict
A location group with the same identifier already exists. The response body is a problem details object with type, title, status (409), and traceId.
422 — Unprocessable Entity
identifier or name is missing. The title is Identifier is required. or Name is required.
{
"type": "https://tools.ietf.org/html/rfc4918#section-11.2",
"title": "Name is required.",
"status": 422,
"traceId": "<trace-id>"
}
400 — Bad Request
The X-API-KEY header is missing, or the request body is not valid JSON.
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"errors": {
"X-API-KEY": [
"The apiKey field is required."
]
},
"traceId": "<trace-id>"
}
Important Notes
- The request body is a single object, not an array. Create one location group per request.
identifierandnameare required.descriptionis optional.- A location group is also created automatically when a location references a new
identifierin itslocationGroupobject. See Create a Location / Trade Partner. - To change an existing location group, see Update a Location Group. To remove one, see Delete a Location Group.
- In the Update a Location / Trade Partner response, the group assigned to a location is returned as
locationGroup(withid,name,description, andexternalIdentifier) together withlocationGroupId.