Selection
The selection group lets a member give their availability for a fixture and read the teamsheet once the
selectors have published it. Like the members operations, all four need your key and a member
token from the login, they act only for the signed-in member, and every answer is
Cache-Control: private, no-store. A valid login of someone who is not a member of the club is 403 not_a_member.
| Operation | Path | SDK |
|---|---|---|
| List my availability | GET /v1/clubs/{clubId}/me/availability?from=&to= | lb.listMyAvailability(clubId, { from?, to? }) |
| Mark me available | PUT /v1/clubs/{clubId}/me/availability/{fixtureId} | lb.setMyAvailability(clubId, fixtureId) |
| Mark me not available | DELETE /v1/clubs/{clubId}/me/availability/{fixtureId} | lb.clearMyAvailability(clubId, fixtureId) |
| A fixture's teamsheet | GET /v1/clubs/{clubId}/fixtures/{fixtureId}/teamsheet | lb.getTeamsheet(clubId, fixtureId) |
Listing availability
GET /v1/clubs/{clubId}/me/availability answers { "fixtureIds": ["...", "..."] }: the ids of the published fixtures in the
range that the member has marked themselves available for. It is not paged and promises no order (the gateway sorts the ids, but
do not depend on it).
Range. from (inclusive) and to (exclusive) go together or not at all. With neither you get the club's current season. A
range may not exceed 400 days, otherwise 400 invalid_request. For fixtures with their details, use
getMyCalendar (its me.available is the same mark) or listFixtures.
Marking and clearing
PUT marks the member available and DELETE marks them not available. Neither takes a body. The answer is the same for both:
{ "available": true, "fixtureIds": ["6d0c...", "9a41..."] }
- Idempotent. Marking twice leaves one mark, and clearing a mark that is not there succeeds. So a repeat after a timeout is always safe, and the SDK itself repeats a call once after renewing an expired token.
- The ids are the fixtures changed. Usually just the one you named. See grouped fixtures.
- A fixture that is unknown, still a draft, or another club's is
404 fixture_not_found(the API does not say which). AfixtureIdthat cannot be an id is400 invalid_request. - The change is visible at once in
getMyCalendarand on the lovebowls site.
import { isAvailabilityRefused } from "@lovebowls/api";
try {
const { fixtureIds } = await lb.setMyAvailability("CLUB_ID", fixtureId);
console.log("Marked available for", fixtureIds.length, "fixture(s)");
} catch (error) {
if (!isAvailabilityRefused(error)) throw error;
console.log(error.code, error.detail); // see the table below
}
Why a change is refused (409)
When the member may not change their availability, the answer is 409 and the code says why. Branch on code, not on the text.
The server checks the rules in this order and answers the first that fails, so a fixture that breaks two rules shows the
earlier one. The first column is the order.
| # | code | What happened | What to show the member | DELETE too? |
|---|---|---|---|---|
| 1 | availability_not_enabled | The fixture does not ask members for availability: it has no rinks, and it is not an event with availability switched on. | "This fixture does not take availability." There is nothing the member can do; the club decides. | No |
| 2 | fixture_started | The fixture has already started. The rule is strict: from the start time, not an hour later (the Matches page of the lovebowls site is more lenient for an hour). | "Too late: the match has started." | Yes |
| 3 | teamsheet_published | The selectors have published the team, so availability is closed. A member cannot take themselves out of a published team here. | "The team has been picked. If you can no longer play, please tell a selector." | Yes |
| 4 | non_playing_member | The member is a non-playing member of the club, who does not give availability. | "Non-playing members do not give availability." | No |
| 5 | not_eligible | The competition's gender or age band excludes the member, judged at the fixture's date (a missing date of birth or gender never excludes anyone). | "This competition is not open to you." | No |
| 6 | invitation_only | The competition is by invitation: the selectors choose who plays. | "The selectors invite players to this competition." | No |
| 7 | member_away | The member recorded an away period that covers the fixture's date. | "You are marked as away on this date. Change your away period on the lovebowls site if that is wrong." | No |
Clearing is more forgiving than marking: a member who has become non-playing, ineligible or away must still be able to remove a
mark they gave earlier. So DELETE answers only fixture_started and teamsheet_published, and an unknown fixture is still
404 fixture_not_found.
Two limits that are not checked: a limit on the places of an event is not enforced by this API, and a fixture is judged by the state of the club's records at the moment of the call (a role or date-of-birth change can take up to 15 minutes to be seen by the eligibility and non-playing checks, as on the lovebowls site).
Grouped fixtures
Some competitions group availability: the member gives it once for all of that competition's fixtures at about the same time
(within two hours). Then PUT and DELETE change every fixture of the group, and fixtureIds lists them all, the one you
named first. The rules above are judged on the fixture you named. In addition, a group with a started or a published member
is refused whole: if any fixture in the group has started the answer is 409 fixture_started, and if any has a published
teamsheet it is 409 teamsheet_published, and nothing is written.
The teamsheet
GET /v1/clubs/{clubId}/fixtures/{fixtureId}/teamsheet answers the published selection, as a member sees it on the lovebowls site.
Any member of the club can read it, whether or not they were picked, and it stays readable after the match. While the selection
is not published (or there is none) the answer is 404 teamsheet_not_found; an unknown or draft fixture is 404 fixture_not_found.
{
"fixtureId": "6d0c...",
"rinks": [
{
"name": "Team 1", "reserve": false, "clubScore": 21, "opponentScore": 14,
"places": [
{ "position": 1, "positionName": "Lead", "name": "A. Member", "kind": "member", "isMe": true, "confirmed": true },
{ "position": 2, "positionName": "Second", "name": "B. Guest", "kind": "nonMember", "isMe": false, "confirmed": null },
{ "position": 3, "positionName": "Third", "name": null, "kind": null, "isMe": false, "confirmed": null }
]
},
{ "name": "Reserves", "reserve": true, "clubScore": null, "opponentScore": null, "places": [] }
]
}
- Order. Rinks come in rink order and the reserves last.
- Places.
positionis 1 to 4 andpositionNameits name (Lead,Second,Third,Skip). For a rink whose size is not knownpositionNameisnull; the reserves are namedReserve. nameandkind.kindismemberfor a member of the club andnonMemberfor someone the selector added by name. An empty place hasname: nullandkind: null. A place is also empty when it was filled by someone who is no longer a current member, or by a name the API cannot show, so an empty place does not always mean nobody was picked.isMeistrueon the caller's own place, and nowhere else.confirmedis yours only. Whether the player has confirmed the selection is shown only on the caller's own place (trueorfalse); it isnullon everyone else's. The API never shows who else has confirmed, and never returns a member id.- Scores.
clubScoreandopponentScoreare the rink's score once either is above 0, otherwisenull.
What the API does not change
You can mark and clear your own availability. You cannot select players, withdraw someone, publish a teamsheet or change an away period: those are for the selectors on the lovebowls site. Marking and clearing cost the lovebowls site more than a read, so do not send a mark and a clear in a loop; the one rate limit of 300 requests a minute applies.
All of these errors are listed in Errors. Ignore fields and values you do not know: the API only adds within v1.