Wingfield Logo
Wingfield Partner API
Booking

Upsert court booking

PUT
/api/v1/external-services/{externalServiceId}/court-bookings/by-external-id/{externalCourtBookingId}

Create or update a booking by external booking id with stale-write protection.

Notes:

  • participants must contain 1 to 4 unique entries.
  • Each participant must contain exactly one of userId or email.
  • email is normalized to lowercase.
  • Equal externalUpdatedAt is idempotent only when the payload is otherwise unchanged.
  • Overlapping active bookings on the same court are rejected.

Path Parameters

externalServiceId*string

External service ID (UUID).

Formatuuid
externalCourtBookingId*string

Your system's booking identifier.

Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Error Responses

400

invalid_schema

Request validation failed.

400

mutually_exclusive_fields_violation

Exactly one field from a mutually exclusive set is required.

400

duplicate_entries_provided

Request contains duplicates where uniqueness is required.

400

invalid_time_range

A primary time range is ordered incorrectly.

401

missing_api_token

No authentication token provided.

401

invalid_api_token

Invalid or expired authentication token.

403

scope_permission_denied

Insufficient permissions for this operation.

403

external_service_access_denied

Token does not match the requested external service.

403

organization_access_denied

Service is not granted access to the organization.

403

user_access_denied

Service is not granted access to the user.

404

court_not_found

Court was not found.

409

stale_write

Request is older than the stored resource version.

409

version_conflict

Request conflicts with the current resource version.

409

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"
  }
}