Create or replace a court
Create a bookable court on your activity listing, or replace it, by your own ID.
PUT
{BASE_URL}/activity/courts/:externalIdA court is a space customers book by the slot — a futsal pitch, a badminton court. Same rules as
an activity item: the whole court, a draft until published,
REGISTRATION scope, the Activity module for a provider.
Body
namestringrequired- 1–80 characters.
priceintegerrequired- The usual price per slot, whole taka, 0–1,000,000.
sportstringrequiredBADMINTON,FUTSAL,CRICKET,TENNIS,BASKETBALL,PICKLEBALLorOTHER.sportNamestringoptionalOTHERonly, and required for it. Up to 30 characters.courtCountintegerrequired- How many identical courts, 1–100.
surfacestring | nulloptional- Up to 80 characters.
priceRulesobject[]optional- Up to 20
{ days, from, to, price }that overridepriceat certain times.from/toareHH:MM;tomay be24:00. Two rules may not cover the same minute on the same day. addOnsobject[]optional- Up to 20
{ name, price }, names different. categorystring | nulloptional- Up to 40 characters.
descriptionstring | nulloptional- Up to 500 characters.
imagestring | nulloptional- A URL from
POST /media. locationIdsstring[]optional- IDs from
GET /locations. linkobject | nulloptional{ url, label }.
A slot is priced by the rule covering its start time, so overlapping rules are refused
(priceRules_overlap, naming the two).
Status codes#
| Status | Code | When |
|---|---|---|
201 | — | Created, as a draft. |
200 | — | Replaced, or "dryRun": true for a sandbox key. |
400 | unknown_field, <field>_required, <field>_invalid, <field>_too_long, <field>_too_many | A field is missing or wrong. details.field names it. See Errors. |
400 | image_not_imported | image is not a URL from POST /media. |
400 | location_not_found, locationIds_invalid | A locationIds entry is not one of your locations, or the list is not an array of at most 50 IDs. |
400 | externalId_invalid | The externalId is not 1–128 letters, digits or . _ ~ : -. |
403 | provider_module_not_allowed | A Technology Provider without the Activity module. |
409 | activity_not_set_up | You have no activity listing yet. Set it up in the Partner Portal. |
409 | too_many_courts | The activity already has the most courts it can hold. |
409 | resource_busy | Another request is creating this externalId. Retry in a moment. |
409 | resource_managed_elsewhere | A Technology Provider wrote an externalId another integration holds. |
cURL
curl -X PUT "$LOCALOY_BASE_URL/activity/courts/futsal-a" \
-H "Authorization: Bearer $LOCALOY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Futsal court A",
"price": 2000,
"sport": "FUTSAL",
"courtCount": 2,
"priceRules": [
{ "days": [5, 6], "from": "18:00", "to": "24:00", "price": 3000 }
],
"addOns": [{ "name": "Bibs", "price": 100 }]
}'Response · 400
{
"success": false,
"message": "18:00–22:00 and 21:00–23:00 overlap on the same day",
"code": "priceRules_overlap",
"details": { "field": "priceRules" }
}