Club7

Integration API.

GETgetAvailability

Determines whether a court can be booked for the given time range. Returns `available: true` only when the court exists, is not already booked locally. Fails with `400` when the start datetime is not before the end datetime, `404` when the court does not exist, and `502` when the booking API is unreachable or returns an error.

Parameters

NameTypeDescription
court_idintRequired. The internal court id for TiePlayer.
startstringRequired. The start datetime in `Y-m-d H:i` format.
endstringRequired. The end datetime in `Y-m-d H:i` format.

Response

array Availability result, either `{"available": true}` or `{"available": false}`.

Examples

GET /getAvailability?court_id=5&start=2026-09-01%2010:00&end=2026-09-01%2011:00
{"status": "success", "available": true}
{"status": "error", "code": 404, "message": "Court with id 5 not found", "details": []}

GETgetMember

Looks up a member by one of `member_id`, `member_code` or `member_email`. (exactly one must be provided — if more than one is given, `member_id` wins, then `member_code`, then `member_email`). Returns the member's profile, served from the local database when available, otherwise fetched from the member API and cached locally. Fails with `400` when no lookup key is provided, `404` when the member is not found or multiple members match, and `502` when the member API is unreachable or returns an error.

Parameters

NameTypeDescription
member_idintOptional. The internal member id (PK).
member_codeintOptional. The unique member code.
member_emailstringOptional. The member's email address.

Response

array The member's profile (name, email, NIF, address, membership info).

Examples

GET /getMember?member_id=123
GET /getMember?member_code=456
GET /getMember?member_email=foo@bar.com
{"status": "success", "member_id": 123, "member_code": 456, "member_name": "John Doe", "member_email": "john@example.com", "member_nif": "123456789", "member_address": "Rua X, 10", "member_zip_code": "1000-100", "has_membership": false, "membership_id": 0, "membership_start_date": null, "membership_end_date": null}
{"status": "error", "code": 400, "message": "One of member_id, member_code, or member_email must be provided", "details": [{"field": "member_id", "message": "The PK of the member to retrieve"}, {"field": "member_code", "message": "The unique code of the member to retrieve"}, {"field": "member_email", "message": "The email of the member to retrieve"}]}

POSTsetAppointment

Creates appointments for the given member on each of the given courts. The member is looked up by `member_code` and every court is checked for availability before it is booked. Fails with `400` when a field is missing or invalid or a court is not available, `404` when the member or a court does not exist, and `502` when the Underlying API is unreachable or returns an error.

Parameters

NameTypeDescription
member_codeintRequired. The unique code of the member to set the appointment for.
courtsarrayRequired. Array of court ids to book.
startstringRequired. The start datetime in `Y-m-d H:i` format.
endstringRequired. The end datetime in `Y-m-d H:i` format.

Response

array Empty payload on success.

Examples

POST /setAppointment {"member_code": 456, "courts": [1, 2], "start": "2026-09-01 10:00", "end": "2026-09-01 11:00"}
{"status": "success"}
{"status": "error", "code": 400, "message": "Court with id 1 is not available for the given time range", "details": []}

POST

POST

POSTtriggerMemberUpdate

Processes the CRM member-sync XML feed (`<sync>` containing `<row>` elements, each with a `<member>`). For every member it updates the local `user` table, then pushes the member to the external member platform: looks up the facility user by external id, creates or updates it, assigns the access device (wristband barcode), and subscribes or expires the membership based on `cod_status`. Fails with `502` when the member platform API is unreachable or returns an error.

Parameters

NameTypeDescription
bodySimpleXMLElementThe parsed XML feed from the CRM sync.

Response

array Empty payload on success.

Examples

POST /triggerMemberUpdate (Content-Type: application/xml) <sync><row><member>...</member></row></sync>
{"status": "success", "inserted": true}