Upsert court booking
Create or update a booking by external booking id with stale-write protection.
Notes:
participantsmust contain 1 to 4 unique entries.- Each participant must contain exactly one of
userIdoremail. emailis normalized to lowercase.- Equal
externalUpdatedAtis idempotent only when the payload is otherwise unchanged. - Overlapping active bookings on the same court are rejected.
Path Parameters
External service ID (UUID).
uuidYour system's booking identifier.
1 <= lengthRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response
200Error Responses
invalid_schema
Request validation failed.
mutually_exclusive_fields_violation
Exactly one field from a mutually exclusive set is required.
duplicate_entries_provided
Request contains duplicates where uniqueness is required.
invalid_time_range
A primary time range is ordered incorrectly.
missing_api_token
No authentication token provided.
invalid_api_token
Invalid or expired authentication token.
scope_permission_denied
Insufficient permissions for this operation.
external_service_access_denied
Token does not match the requested external service.
organization_access_denied
Service is not granted access to the organization.
user_access_denied
Service is not granted access to the user.
court_not_found
Court was not found.
stale_write
Request is older than the stored resource version.
version_conflict
Request conflicts with the current resource version.
court_booking_overlap
Court booking overlaps another active booking.
curl -X PUT "https://dev.wingfield.systems/api/v1/external-services/497f6eca-6276-4993-bfeb-53cbbbba6f08/court-bookings/by-external-id/string" \ -H "Content-Type: application/json" \ -d '{ "courtId": "79ae2927-a9bc-46ed-8f9e-079af32b7616", "startDate": "2019-08-24T14:15:22Z", "endDate": "2019-08-24T14:15:22Z", "externalUpdatedAt": "2019-08-24T14:15:22Z", "participants": [ { "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b" } ] }'{
"externalServiceId": "e8623a0d-39de-4963-9c6c-a25dc38e89c9",
"courtId": "79ae2927-a9bc-46ed-8f9e-079af32b7616",
"externalCourtBookingId": "string",
"startDate": "2019-08-24T14:15:22Z",
"endDate": "2019-08-24T14:15:22Z",
"externalUpdatedAt": "2019-08-24T14:15:22Z",
"participants": [
{
"userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b"
}
],
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}{
"error": {
"type": "invalid_schema",
"message": "string",
"issues": [
{}
]
}
}{
"error": {
"type": "missing_api_token",
"message": "string"
}
}{
"error": {
"type": "scope_permission_denied",
"message": "string"
}
}{
"error": {
"type": "court_not_found",
"message": "string"
}
}{
"error": {
"type": "stale_write",
"message": "string"
}
}List court bookings GET
List bookings for an external service. Sorting: `updatedAt desc`, `id asc`. Only non-deleted bookings are returned.
Delete court booking DELETE
Delete a booking by external booking id. After successful delete, the booking is no longer returned by booking read/list endpoints. Notes: - Missing booking returns `200 {}`. - Older `externalUpdatedAt` returns `409 stale_write`. - Same/newer delete remains idempotent (`200 {}`).