Get discount site group mapping by discount ID
GET /api/configuration/discount/sitegroups/{discountId}
- Products: Operator (
FOH), Consumer (CONSUMER) (any one of these products, not all) - Features: Online Bookings (
ONLINEBOOK), Online Joining (ONLINEJOIN), Front of House Generic Access (FOHGENERIC) (any one of these features, not all)
Overview
Returns the site groups that have been mapped to a membership-type discount. A site group is an operator-defined collection of sites, used across the platform to scope configuration to a subset of an operator's estate. The mapping is many-to-many: one discount may be mapped to several site groups, one site group to several discounts, and each pairing may exist only once.
Note the endpoint returns 404, not an empty array, when a discount has no site group mappings at
all — so a 404 is a normal, expected outcome here rather than a sign that anything is wrong. See
the errors table before you write your handling.
The discountId is a membership-type discount — the kind created by
Create a discount and listed by
Retrieve all active discounts,
and the id must be one of those. It is not a booking discount and not a promotion;
those are separate objects with their own identifiers, and passing one of their ids here produces a
404 rather than a helpful error.
The response body is a JSON array of objects, not a bare string, each carrying a single site group
id under a field named siteGroupIds — plural, despite holding one value:
[
{ "siteGroupIds": "STGP00000000001" },
{ "siteGroupIds": "STGP00000000002" }
]Each siteGroupIds value is a site group identifier, maximum 15 characters, never null, and
resolvable through Get site group by ID. Ids are
operator-defined and tenant-scoped: they are not allocated by Gladstone, are not comparable between
tenants, and must be discovered at runtime rather than hard-coded. Where the operator does not
supply one, the platform generates STGP followed by 11 digits, as above — but do not pattern-match
on that, because an operator-supplied id can be any string of 15 characters or fewer. Values are
de-duplicated before they are returned, and each discount and site group pairing can exist only
once, so the same site group never appears twice for one discount.
There is no active, inactive or effective-date flag on a mapping — it holds only the pairing. A mapping exists or it does not, and the only ways to change one are Create discount site group mapping and Update discount site group mapping. The response tells you nothing about the discount itself — not its value, its validity dates or whether it is currently active — so read the discount separately if you need that.
Endpoint
GET {base_url}/api/configuration/discount/sitegroups/{discountId}
{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
discountId | integer (int32) | Yes | The membership-type discount whose site group restrictions you want. This is the discount's platform-generated integer id, tenant-local and not meaningful in another tenant; take it from the response of Create a discount — which returns an array of ids, one per membership type supplied — or from Retrieve all active discounts. Only one discount id can be queried per call; there is no batch form. |
Sample request
curl -X GET '{base_url}/api/configuration/discount/sitegroups/{discountId}' \
-H 'Authorization: Bearer {accessToken}' \
-H 'X-Use-SSO: true'Errors
| Status | Meaning | When |
|---|---|---|
403 | Forbidden | The token is anonymous. This endpoint requires an authenticated caller; a member token is accepted and returns the mapping normally, but an anonymous token is rejected outright. |
404 | Not found | No mappings exist for that discountId. That covers two different situations — the discount does not exist at all, or it exists but has no site group mapped to it — and the response does not distinguish them, so do not treat this as "unknown discount". If you need to tell the two apart, look the discount up separately. The body is a plain-text message, not JSON, in the form Discount site group mapping against Discount Id '2147483647' does not exist in database. |
500 | Internal server error | An unexpected server-side failure while reading the mappings. The response has no body and carries no detail about the cause. |