Create member favourite
POST /api/members/{memberId}/favourites
Success: 201 Created
- 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
Saves one favourite against a member — the member's preferred site, or an activity they want to keep to hand — so that an app can pre-select it later. Each call stores a single favourite; repeat the call to store several.
Despite the general wording elsewhere, only two kinds of favourite are actually supported: Site and Activity. Which numeric typeId maps to which of those is configuration, not a constant, so read Get all favourite types first and use the id it returns. If the type you send resolves to any other name, the request is rejected — instructors, classes and other preferences are not supported.
The value is not free text. It is the id of the thing being favourited, and it is checked against the sites or the activities the operator has configured, case-insensitively, before the favourite is written. A member cannot hold the same value twice under the same type; a repeat is a 409, not an update.
A successful call returns 201 with the new favourite's id as a bare integer in the body — not an object. That id is what you pass to Get member favourite by ID and Delete member favourite. If your token identifies a member, the memberId in the path must be that same member: linked members are explicitly not accepted on this route, and a mismatch is rejected with 403 before anything else is checked. Tokens that carry no member identity are not subject to that check.
Endpoint
POST {base_url}/api/members/{memberId}/favourites
{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
memberId | integer (int32) | Yes | The member the favourite is saved against. It also overwrites any member id in the body, so the path is the only thing that decides the owner. The member must exist, or the request fails with 404. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
typeId | integer (int32) | Yes | Which kind of favourite this is, using an id from Get all favourite types. It decides how value is validated: a type named Site means value must be a site id, a type named Activity means value must be an activity id, and any other configured type is refused because it is not supported. There is no default — omitting the field is treated as 0, which is rejected as a type that does not exist. |
value | string | Yes | The id of the site or activity being favourited, matching whichever typeId you sent — not a display name, and not a free-text label. It is compared case-insensitively, both when checking that the site or activity exists and when checking that the member has not already saved it. |
Sample request
curl -X POST '{base_url}/api/members/{memberId}/favourites' \
-H 'Authorization: Bearer {accessToken}' \
-H 'X-Use-SSO: true' \
-H 'Content-Type: application/json' \
-d '{
"typeId": 12345,
"value": "string"
}'Sample response
1Errors
| Status | Meaning | When |
|---|---|---|
400 | Bad request | The type or the value does not stand up: TypeId of {typeId} does not exist when the id is not a configured favourite type, The favourite type {name} is not currently supported when it resolves to anything other than Site or Activity, and The Value of {value} is not applicable with favourite type of {typeId}. Please supply a valid {name} when no site or activity has that id. |
404 | Not found | The member does not exist. — the memberId in the path does not match a member. This is checked first, before the type and value. |
409 | Conflict | The member already has {value} saved as a favourite — this member already holds this value under this type. The comparison ignores case, so SITE1 collides with site1. Nothing is written and no id is returned; read the member's favourites to find the existing one. |
500 | Internal server error | An unexpected server-side failure while saving the favourite. The body is empty and no id comes back, so re-read the member's favourites before retrying rather than assuming nothing was saved. |