Skip to main content

Overview

The Clubs API allows you to manage club information in the MTB Backend system. Each club can have a name, logo, cover image, history, mission, and contact details.
This endpoint supports draft and publish functionality. Use the publishedAt field to control publication status.

List All Clubs

Retrieve a list of all clubs with optional filtering, sorting, and pagination.

Query Parameters

filters
object
Filter clubs by field values
sort
string
Sort clubs by field(s). Example: nombreClub:asc
pagination[page]
number
default:"1"
Page number for pagination
pagination[pageSize]
number
default:"25"
Number of items per page
populate
string
Populate relations. Use * for all relations or specify fields like logo,imagenPortada

Response

data
array
Array of club objects
meta
object
Pagination metadata

Example Request

curl -X GET "https://api.example.com/api/clubs?populate=*&sort=nombreClub:asc" \
  -H "Content-Type: application/json"

Example Response

{
  "data": [
    {
      "id": 1,
      "attributes": {
        "nombreClub": "Club MTB Ejemplo",
        "emailConacto": "[email protected]",
        "telefonoContacto": "+56912345678",
        "direccion": "Av. Principal 123, Santiago",
        "historia": [
          {
            "type": "paragraph",
            "children": [
              {"type": "text", "text": "Historia del club..."}
            ]
          }
        ],
        "mision": [
          {
            "type": "paragraph",
            "children": [
              {"type": "text", "text": "Nuestra misión..."}
            ]
          }
        ],
        "logo": {
          "data": {
            "id": 1,
            "attributes": {
              "url": "/uploads/logo.png"
            }
          }
        },
        "imagenPortada": {
          "data": {
            "id": 2,
            "attributes": {
              "url": "/uploads/portada.jpg"
            }
          }
        },
        "publishedAt": "2024-01-15T10:00:00.000Z",
        "createdAt": "2024-01-15T10:00:00.000Z",
        "updatedAt": "2024-01-20T15:30:00.000Z"
      }
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "pageSize": 25,
      "pageCount": 1,
      "total": 1
    }
  }
}

Get a Single Club

Retrieve a specific club by its ID.

Path Parameters

id
number
required
The unique identifier of the club

Query Parameters

populate
string
Populate relations. Use * for all relations or specify fields like logo,imagenPortada

Response

data
object
The club object (see List All Clubs for structure)

Example Request

curl -X GET "https://api.example.com/api/clubs/1?populate=*" \
  -H "Content-Type: application/json"

Example Response

{
  "data": {
    "id": 1,
    "attributes": {
      "nombreClub": "Club MTB Ejemplo",
      "emailConacto": "[email protected]",
      "telefonoContacto": "+56912345678",
      "direccion": "Av. Principal 123, Santiago",
      "historia": [...],
      "mision": [...],
      "logo": {...},
      "imagenPortada": {...},
      "publishedAt": "2024-01-15T10:00:00.000Z",
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-20T15:30:00.000Z"
    }
  }
}

Create a Club

Create a new club entry.

Request Body

data
object
required

Response

data
object
The created club object

Example Request

curl -X POST "https://api.example.com/api/clubs" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "data": {
      "nombreClub": "Nuevo Club MTB",
      "emailConacto": "[email protected]",
      "telefonoContacto": "+56987654321",
      "direccion": "Calle Nueva 456, Valparaíso",
      "historia": [
        {
          "type": "paragraph",
          "children": [{"type": "text", "text": "Historia del nuevo club..."}]
        }
      ],
      "mision": [
        {
          "type": "paragraph",
          "children": [{"type": "text", "text": "Nuestra misión es..."}]
        }
      ]
    }
  }'

Example Response

{
  "data": {
    "id": 2,
    "attributes": {
      "nombreClub": "Nuevo Club MTB",
      "emailConacto": "[email protected]",
      "telefonoContacto": "+56987654321",
      "direccion": "Calle Nueva 456, Valparaíso",
      "historia": [...],
      "mision": [...],
      "logo": {"data": null},
      "imagenPortada": {"data": null},
      "publishedAt": null,
      "createdAt": "2024-01-22T10:00:00.000Z",
      "updatedAt": "2024-01-22T10:00:00.000Z"
    }
  }
}

Update a Club

Update an existing club by its ID.

Path Parameters

id
number
required
The unique identifier of the club to update

Request Body

data
object
required
Club fields to update (same structure as Create)

Response

data
object
The updated club object

Example Request

curl -X PUT "https://api.example.com/api/clubs/1" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "data": {
      "nombreClub": "Club MTB Actualizado",
      "telefonoContacto": "+56911111111"
    }
  }'

Example Response

{
  "data": {
    "id": 1,
    "attributes": {
      "nombreClub": "Club MTB Actualizado",
      "emailConacto": "[email protected]",
      "telefonoContacto": "+56911111111",
      "direccion": "Av. Principal 123, Santiago",
      "historia": [...],
      "mision": [...],
      "logo": {...},
      "imagenPortada": {...},
      "publishedAt": "2024-01-15T10:00:00.000Z",
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-22T11:00:00.000Z"
    }
  }
}

Delete a Club

Delete a club by its ID.

Path Parameters

id
number
required
The unique identifier of the club to delete

Response

data
object
The deleted club object

Example Request

curl -X DELETE "https://api.example.com/api/clubs/1" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "data": {
    "id": 1,
    "attributes": {
      "nombreClub": "Club MTB Actualizado",
      "emailConacto": "[email protected]",
      "telefonoContacto": "+56911111111",
      "direccion": "Av. Principal 123, Santiago",
      "historia": [...],
      "mision": [...],
      "logo": {...},
      "imagenPortada": {...},
      "publishedAt": "2024-01-15T10:00:00.000Z",
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-22T11:00:00.000Z"
    }
  }
}
Important: Deleting a club is permanent and cannot be undone. Ensure you have proper backups before performing delete operations.

Build docs developers (and LLMs) love