Overview
Topics represent individual subjects or themes within a unit. Each topic belongs to a specific unit and includes a difficulty level, description, and customizable order. Topics are the most granular level of academic content organization in the system.
Endpoints
List All Topics
curl -X GET "https://api.example.com/api/topics" \
-H "Accept: application/json"
Response
Indicates if the request was successful
Response message: “Temas listado con éxito”
Array of topic objects Unique identifier for the topic
Foreign key reference to the parent unit
Name of the topic (max 200 characters)
Description of the topic content (nullable)
Display order of the topic (default: 1)
Difficulty level of the topic (default: “Básico”)
When the topic was created
When the topic was last updated
{
"success" : true ,
"message" : "Temas listado con éxito" ,
"data" : [
{
"id" : 1 ,
"units_id" : 1 ,
"tema" : "Propiedades de los Números Naturales" ,
"descripcion" : "Estudio de las propiedades fundamentales de los números naturales" ,
"orden" : 1 ,
"nivel_dificultad" : "Básico" ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
},
{
"id" : 2 ,
"units_id" : 1 ,
"tema" : "Operaciones con Números Naturales" ,
"descripcion" : "Suma, resta, multiplicación y división de números naturales" ,
"orden" : 2 ,
"nivel_dificultad" : "Intermedio" ,
"created_at" : "2026-03-05T10:31:00.000000Z" ,
"updated_at" : "2026-03-05T10:31:00.000000Z"
}
]
}
Create a Topic
curl -X POST "https://api.example.com/api/topics" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"units_id": 1,
"tema": "Números Primos",
"descripcion": "Identificación y propiedades de los números primos",
"orden": 3,
"nivel_dificultad": "Avanzado"
}'
Request Body
Response
Indicates if the request was successful
Response message: “Tema creado con éxito”
The created topic object Unique identifier for the topic
Foreign key reference to the parent unit
Description of the topic content
Display order of the topic
Difficulty level of the topic
When the topic was created
When the topic was last updated
Example Response (201 Created)
{
"success" : true ,
"message" : "Tema creado con éxito" ,
"data" : {
"id" : 3 ,
"units_id" : 1 ,
"tema" : "Números Primos" ,
"descripcion" : "Identificación y propiedades de los números primos" ,
"orden" : 3 ,
"nivel_dificultad" : "Avanzado" ,
"created_at" : "2026-03-05T10:35:00.000000Z" ,
"updated_at" : "2026-03-05T10:35:00.000000Z"
}
}
Get a Topic
curl -X GET "https://api.example.com/api/topics/1" \
-H "Accept: application/json"
Path Parameters
Response
Indicates if the request was successful
Response message: “Tema obtenido con éxito”
The topic object Unique identifier for the topic
Foreign key reference to the parent unit
Description of the topic content
Display order of the topic
Difficulty level of the topic
When the topic was created
When the topic was last updated
{
"success" : true ,
"message" : "Tema obtenido con éxito" ,
"data" : {
"id" : 1 ,
"units_id" : 1 ,
"tema" : "Propiedades de los Números Naturales" ,
"descripcion" : "Estudio de las propiedades fundamentales de los números naturales" ,
"orden" : 1 ,
"nivel_dificultad" : "Básico" ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
}
}
Update a Topic
curl -X PUT "https://api.example.com/api/topics/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"units_id": 1,
"tema": "Propiedades y Clasificación de Números Naturales",
"descripcion": "Estudio completo de las propiedades fundamentales y clasificación de los números naturales",
"orden": 1,
"nivel_dificultad": "Intermedio"
}'
Path Parameters
Request Body
Response
Indicates if the request was successful
Response message: “Tema actualizado con éxito”
The updated topic object Unique identifier for the topic
Foreign key reference to the parent unit
Description of the topic content
Display order of the topic
Difficulty level of the topic
When the topic was created
When the topic was last updated
{
"success" : true ,
"message" : "Tema actualizado con éxito" ,
"data" : {
"id" : 1 ,
"units_id" : 1 ,
"tema" : "Propiedades y Clasificación de Números Naturales" ,
"descripcion" : "Estudio completo de las propiedades fundamentales y clasificación de los números naturales" ,
"orden" : 1 ,
"nivel_dificultad" : "Intermedio" ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T11:45:00.000000Z"
}
}
Delete a Topic
curl -X DELETE "https://api.example.com/api/topics/1" \
-H "Accept: application/json"
Path Parameters
Response
Indicates if the request was successful
Response message: “Tema eliminado con éxito”
Returns null for successful deletions
{
"success" : true ,
"message" : "Tema eliminado con éxito" ,
"data" : null
}
Relationships
Unit (Parent)
Each topic must belong to a unit. The units_id field is a foreign key that references the units table. When a unit is deleted, all its topics are automatically deleted (cascade delete).
Database Schema
The topics table includes:
id - Primary key (auto-increment)
units_id - Foreign key to units table (cascade delete)
tema - String field for topic name (max 200 characters)
descripcion - Text field for description (nullable)
orden - Integer field for display order (default: 1)
nivel_dificultad - String field for difficulty level (default: “Básico”)
created_at - Timestamp for creation
updated_at - Timestamp for last update