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.

OperationPathSDK
List my availabilityGET /v1/clubs/{clubId}/me/availability?from=&to=lb.listMyAvailability(clubId, { from?, to? })
Mark me availablePUT /v1/clubs/{clubId}/me/availability/{fixtureId}lb.setMyAvailability(clubId, fixtureId)
Mark me not availableDELETE /v1/clubs/{clubId}/me/availability/{fixtureId}lb.clearMyAvailability(clubId, fixtureId)
A fixture's teamsheetGET /v1/clubs/{clubId}/fixtures/{fixtureId}/teamsheetlb.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..."] }
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.

#codeWhat happenedWhat to show the memberDELETE too?
1availability_not_enabledThe 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
2fixture_startedThe 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
3teamsheet_publishedThe 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
4non_playing_memberThe member is a non-playing member of the club, who does not give availability."Non-playing members do not give availability."No
5not_eligibleThe 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
6invitation_onlyThe competition is by invitation: the selectors choose who plays."The selectors invite players to this competition."No
7member_awayThe 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": [] }
  ]
}

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.