Errors and limits
Every error has the same shape:
{"error": {"code": "rejected", "message": "Pick one of the offered durations."}}
Use code in your code, and show message to the player: it is written for them and translated into the venue's language.
| HTTP | code | When | What the app does |
|---|---|---|---|
| 400 | invalid_json | The body is not a JSON object | Fix the request |
| 400 | invalid_parameter | A number or date is badly formatted (facility_type_id must be a number.) | Fix the request |
| 401 | unauthorized | No token, or the token expired, was signed out or revoked | Delete the token, show sign-in |
| 401 | invalid_login | Wrong email or password | Show the message |
| 403 | method_disabled | The venue turned this sign-in method off | Read /config again |
| 403 | staff_account | A staff login tried the player app | Show the message |
| 403 | forbidden | Not allowed | Show the message |
| 404 | not_found | Unknown booking, or a booking of another player | Go back to the list |
| 422 | invalid_code | Wrong, blocked or expired code on /auth/verify or /auth/signup | Show the message, offer a new code |
| 422 | name_required | New player, name missing on /auth/verify | Ask for the name, send again |
| 422 | out_of_window | Day outside the booking window | Limit the date picker to today..last_date |
| 422 | nothing_due | Payment link asked when nothing is due online | Refresh the booking |
| 422 | rejected | A booking rule refused the request: court just taken, too many upcoming bookings, too late to cancel, code asked too often, email already used | Show the message |
| 500 | server_error | Unexpected error on the server (logged in Odoo) | Show the message, let the player try again |
A refused request changes nothing in Odoo: nothing is half-booked.
Retrying
- Network error or timeout on
POST /bookings: retry with the sameclient_uuid. You get the booking that was made, or a new one if the first request never arrived. 500: retry once after a few seconds; then show the message.4xx: do not retry the same request; the answer will not change.
Limits
| What | Limit |
|---|---|
| Sign-in code | 6 digits, valid 10 minutes, 5 wrong tries |
| New code for the same number or email | after 60 seconds, at most 5 per hour |
| Codes from one network address | 20 per hour |
| Token | 90 days from its last use |
| Upcoming bookings per player | set by the venue per facility type (3 by default) |
GET /bookings | 50 bookings per scope |
| Booking note | 500 characters |
There is no other request limit in the app. If the venue's Odoo is behind a proxy, the limit per network address applies to the address Odoo sees (Odoo.sh passes on the player's real address).
Browsers and CORS
Native Android and iPhone apps do not need anything. A web or desktop app that calls the API from a browser needs its origin allowed by the venue in Settings > Court Booking > Player apps (API), for example https://play.example.com (several separated by commas). Allowed origins get Access-Control-Allow-Origin, and OPTIONS preflight requests answer 204. The allowed request headers are Authorization, Content-Type and Accept-Language.