Update discount site group mapping
PUT /api/configuration/discount/sitegroups
- Products: Operator (
FOH) - Features: Front of House Generic Access (
FOHGENERIC)
Overview
Sets which site groups each of a set of discounts is restricted to. A site group is a named collection of sites; mapping a discount to a site group limits that discount to the sites in it.
The two arrays are combined as a cartesian product, not as positional pairs. Every site group is
applied to every discount, so discountIds: [1, 2] with
siteGroupIds: ["NORTH", "SOUTH"] produces four mappings — 1–NORTH, 1–SOUTH, 2–NORTH and 2–SOUTH.
There is no way to give discount 1 one site group and discount 2 a different one in a single call;
send separate requests for that.
Within the discounts you name, this is a full replacement. Existing mappings for the discount
ids in discountIds are kept only if they reappear in the product above; the rest are deleted. So a discount mapped to NORTH and SOUTH that you send with
siteGroupIds: ["NORTH"] loses its SOUTH mapping. Read the current mappings for each discount
with GET /api/configuration/discount/sitegroups/{discountId} and send the complete intended set.
Discounts you do not name are untouched, so this is not a global replace across all discounts.
Sending an empty siteGroupIds array removes every site group mapping for the discounts you
name, which unrestricts them. That is a supported operation here — unlike the create endpoint,
which rejects an empty list — but send [] rather than null or nothing at all: a null or missing list fails as a 500
rather than a clean 400.
Validation covers the whole request before anything is written, so a rejected call changes nothing. The write itself is two steps — deletions, then insertions — which are saved separately.
On success this endpoint returns 200 OK with an empty body, not 204.
Endpoint
PUT {base_url}/api/configuration/discount/sitegroups
{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
discountIds | array of integer | Yes | The discounts whose site group restrictions you are setting. Mandatory: null, missing or empty is rejected with 400 No Discount Id is provided.. Every id must already exist or the request fails with 400 Discount Ids {ids} not found., naming the ones that do not. The list must not repeat an id — duplicates fail with 400 Duplicate Discount Ids found in the request: {ids}.. Only the discounts listed here are affected, and for each one the mapping set is replaced wholesale. |
siteGroupIds | array of string | No | The site groups every discount in discountIds should be restricted to. Each id must already exist as a site group or the request fails with 400 Site Group Ids {ids} not found., naming the ones that do not; duplicates fail with 400 Duplicate Site Group Ids found in the request: {ids}.. Pass an empty array to strip all site group restrictions from those discounts. Do not pass null or omit the field: this fails with 500 rather than a validation error. Combined with discountIds as a cartesian product — see the Overview. |
Sample request
curl -X PUT '{base_url}/api/configuration/discount/sitegroups' \
-H 'Authorization: Bearer {accessToken}' \
-H 'X-Use-SSO: true' \
-H 'Content-Type: application/json' \
-d '{
"discountIds": [
12345
],
"siteGroupIds": [
"string"
]
}'Errors
| Status | Meaning | When |
|---|---|---|
400 | Bad request | No body was sent — No Discount Id and Site Group Id is provided. |
400 | Bad request | discountIds is null, missing or empty — No Discount Id is provided. |
400 | Bad request | discountIds repeats an id — Duplicate Discount Ids found in the request: {ids}. |
400 | Bad request | siteGroupIds repeats an id — Duplicate Site Group Ids found in the request: {ids}. |
400 | Bad request | One or more discounts do not exist — Discount Ids {ids} not found. Checked before the site groups. |
400 | Bad request | One or more site groups do not exist — Site Group Ids {ids} not found. |
403 | Forbidden | The token is an anonymous or member token. This endpoint is administrative, and both token types get 403. |
500 | Internal server error | An unexpected server-side failure — including siteGroupIds sent as null or omitted. No detail is returned. |