Skip to main content

Overview

Sections represent academic grades or levels in the educational system. Each section has a grade level and a name, and can be associated with multiple units. Sections are the top-level organizational structure for academic content.

Endpoints

List All Sections

curl -X GET "https://api.example.com/api/sections" \
  -H "Accept: application/json"

Response

success
boolean
Indicates if the request was successful
message
string
Response message: “Secciones listado con éxito”
data
array
Array of section objects
{
  "success": true,
  "message": "Secciones listado con éxito",
  "data": [
    {
      "id": 1,
      "grado": "1ro",
      "nombre": "Primer Grado",
      "created_at": "2026-03-05T10:30:00.000000Z",
      "updated_at": "2026-03-05T10:30:00.000000Z"
    },
    {
      "id": 2,
      "grado": "2do",
      "nombre": "Segundo Grado",
      "created_at": "2026-03-05T10:31:00.000000Z",
      "updated_at": "2026-03-05T10:31:00.000000Z"
    }
  ]
}

Create a Section

curl -X POST "https://api.example.com/api/sections" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "grado": "3ro",
    "nombre": "Tercer Grado"
  }'

Request Body

Response

success
boolean
Indicates if the request was successful
message
string
Response message: “Sección creado con éxito”
data
object
The created section object
{
  "success": true,
  "message": "Sección creado con éxito",
  "data": {
    "id": 3,
    "grado": "3ro",
    "nombre": "Tercer Grado",
    "created_at": "2026-03-05T10:35:00.000000Z",
    "updated_at": "2026-03-05T10:35:00.000000Z"
  }
}

Get a Section

curl -X GET "https://api.example.com/api/sections/1" \
  -H "Accept: application/json"

Path Parameters

Response

success
boolean
Indicates if the request was successful
message
string
Response message: “Sección obtenido con éxito”
data
object
The section object
{
  "success": true,
  "message": "Sección obtenido con éxito",
  "data": {
    "id": 1,
    "grado": "1ro",
    "nombre": "Primer Grado",
    "created_at": "2026-03-05T10:30:00.000000Z",
    "updated_at": "2026-03-05T10:30:00.000000Z"
  }
}

Update a Section

curl -X PUT "https://api.example.com/api/sections/1" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "grado": "1ro Avanzado",
    "nombre": "Primer Grado Avanzado"
  }'

Path Parameters

Request Body

Response

success
boolean
Indicates if the request was successful
message
string
Response message: “Sección actualizado con éxito”
data
object
The updated section object
{
  "success": true,
  "message": "Sección actualizado con éxito",
  "data": {
    "id": 1,
    "grado": "1ro Avanzado",
    "nombre": "Primer Grado Avanzado",
    "created_at": "2026-03-05T10:30:00.000000Z",
    "updated_at": "2026-03-05T11:45:00.000000Z"
  }
}

Delete a Section

curl -X DELETE "https://api.example.com/api/sections/1" \
  -H "Accept: application/json"

Path Parameters

Response

success
boolean
Indicates if the request was successful
message
string
Response message: “Sección eliminado con éxito”
data
null
Returns null for successful deletions
{
  "success": true,
  "message": "Sección eliminado con éxito",
  "data": null
}

Relationships

Units

A section can have many units. When a section is deleted, all associated units are automatically deleted (cascade delete).

Database Schema

The sections table includes:
  • id - Primary key (auto-increment)
  • grado - String field for grade designation
  • nombre - String field for section name
  • created_at - Timestamp for creation
  • updated_at - Timestamp for last update

Build docs developers (and LLMs) love