MENU navbar-image

Introduction

Esta es la documentación del
API de la creación de horarios.

Authenticating requests

To authenticate requests, include a Authorization header with the value "Bearer {Escribe aquí tu token}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

Actividades

Listar actividades

Este endpoint devuelve todas las actividades de un horario específico, si el usuario tiene permisos para verlo.

Obtener lista de actividades de un horario

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request GET \
    --get "https://api-timetables.escuelait.com/api/timetables/1/activities" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1/activities"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Actividades encontradas",
    "data": {
        "activities": [
            {
                "id": 1,
                "day": "Monday",
                "start_time": "08:00",
                "duration": 60,
                "info": "Clase de Matemáticas",
                "is_available": true,
                "timetable_id": 1,
                "created_at": "2025-03-26T12:00:00.000000Z",
                "updated_at": "2025-03-26T12:00:00.000000Z"
            }
        ]
    }
}
 

Example response (403):


{
    "message": "No tienes permiso para ver este horario",
    "errors": []
}
 

Request      

GET api/timetables/{timetable_id}/activities

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

ID del horario cuyas actividades se desean listar. Example: 1

Crear nueva actividad en un horario

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request POST \
    "https://api-timetables.escuelait.com/api/timetables/1/activities" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"day\": 1,
    \"start_time\": \"08:00\",
    \"duration\": 60,
    \"info\": \"Clase de Matemáticas\",
    \"is_available\": true
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1/activities"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "day": 1,
    "start_time": "08:00",
    "duration": 60,
    "info": "Clase de Matemáticas",
    "is_available": true
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "message": "Actividad creada correctamente",
    "data": {
        "activity": {
            "id": 1,
            "timetable_id": 1,
            "day": "Monday",
            "start_time": "08:00",
            "duration": 60,
            "info": "Clase de Matemáticas",
            "is_available": true,
            "created_at": "2025-03-26T12:00:00.000000Z",
            "updated_at": "2025-03-26T12:00:00.000000Z"
        }
    }
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "day": [
            "The day field is required."
        ],
        "start_time": [
            "The start time must be a valid time."
        ]
    }
}
 

Request      

POST api/timetables/{timetable_id}/activities

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

The ID of the timetable. Example: 1

Body Parameters

day   integer   

Día de la semana del 1 al 7, siendo 1 el lunes. Example: 1

start_time   string   

Hora de inicio en formato HH:MM (24h). Example: 08:00

duration   integer   

Duración en minutos. Example: 60

info   string   

Información o descripción de la actividad. Example: Clase de Matemáticas

is_available   boolean  optional  

Indica si la actividad está disponible. Por defecto es true. Example: true

Obtener una actividad por ID

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request GET \
    --get "https://api-timetables.escuelait.com/api/timetables/1/activities/3" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1/activities/3"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Actividad encontrada",
    "data": {
        "activity": {
            "id": 3,
            "day": "Tuesday",
            "start_time": "10:00",
            "duration": 90,
            "info": "Laboratorio de Física",
            "is_available": true,
            "timetable_id": 1,
            "created_at": "2025-03-26T12:00:00.000000Z",
            "updated_at": "2025-03-26T12:00:00.000000Z"
        }
    }
}
 

Example response (403):


{
    "message": "No tienes permiso para ver esta actividad",
    "errors": []
}
 

Example response (404):


{
    "message": "La actividad no pertenece a este horario",
    "errors": []
}
 

Request      

GET api/timetables/{timetable_id}/activities/{activity_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

ID del horario al que pertenece la actividad. Example: 1

activity_id   integer   

ID de la actividad que se desea consultar. Example: 3

Actualizar una actividad

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request PUT \
    "https://api-timetables.escuelait.com/api/timetables/1/activities/4" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"day\": 1,
    \"start_time\": \"10:30\",
    \"duration\": 90,
    \"info\": \"Tutoría personalizada\",
    \"is_available\": false
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1/activities/4"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "day": 1,
    "start_time": "10:30",
    "duration": 90,
    "info": "Tutoría personalizada",
    "is_available": false
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "Actividad actualizada correctamente",
    "data": {
        "id": 4,
        "day": "Wednesday",
        "start_time": "10:30",
        "duration": 90,
        "info": "Tutoría personalizada",
        "is_available": false,
        "timetable_id": 1,
        "created_at": "2025-03-26T12:00:00.000000Z",
        "updated_at": "2025-03-26T14:00:00.000000Z"
    }
}
 

Example response (404):


{
    "message": "La actividad no pertenece a este horario",
    "errors": []
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "start_time": [
            "The start time must be a valid time."
        ]
    }
}
 

Request      

PUT api/timetables/{timetable_id}/activities/{activity_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

ID del horario al que pertenece la actividad. Example: 1

activity_id   integer   

ID de la actividad a modificar. Example: 4

Body Parameters

day   integer  optional  

Día de la semana del 1 al 7, 1 para lunes. Example: 1

start_time   string  optional  

Hora de inicio (formato 24h). Example: 10:30

duration   integer  optional  

Duración en minutos. Example: 90

info   string  optional  

Descripción o contenido de la actividad. Example: Tutoría personalizada

is_available   boolean  optional  

Disponible o no. Example: false

Eliminar una actividad

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request DELETE \
    "https://api-timetables.escuelait.com/api/timetables/1/activities/4" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1/activities/4"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Actividad eliminada correctamente",
    "data": []
}
 

Example response (403):


{
    "message": "No tienes permiso para eliminar esta actividad",
    "errors": []
}
 

Example response (404):


{
    "message": "La actividad no pertenece a este horario",
    "errors": []
}
 

Request      

DELETE api/timetables/{timetable_id}/activities/{activity_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

ID del horario al que pertenece la actividad. Example: 1

activity_id   integer   

ID de la actividad a eliminar. Example: 4

Autenticación

Registro de nuevo usuario

Este endpoint permite registrar un nuevo usuario en el sistema. Devuelve el usuario creado junto con un token de autenticación.

Registrar un nuevo usuario

Example request:
curl --request POST \
    "https://api-timetables.escuelait.com/api/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Juan Pérez\",
    \"email\": \"juan@example.com\",
    \"password\": \"secret123\",
    \"password_confirmation\": \"secret123\"
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/register"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Juan Pérez",
    "email": "juan@example.com",
    "password": "secret123",
    "password_confirmation": "secret123"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "message": "Registro exitoso",
    "data": {
        "user": {
            "id": 1,
            "name": "Juan Pérez",
            "email": "juan@example.com",
            "created_at": "2025-03-26T12:00:00.000000Z",
            "updated_at": "2025-03-26T12:00:00.000000Z"
        },
        "token": "1|aBcD123xyz..."
    }
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}
 

Request      

POST api/register

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Nombre del usuario. Example: Juan Pérez

email   string   

Correo electrónico único. Example: juan@example.com

password   string   

Mínimo 8 caracteres. Debe incluir confirmation. Example: secret123

password_confirmation   string   

Confirmación de contraseña. Debe coincidir con password. Example: secret123

Iniciar sesión

Example request:
curl --request POST \
    "https://api-timetables.escuelait.com/api/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"juan@example.com\",
    \"password\": \"secret123\"
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "juan@example.com",
    "password": "secret123"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "Inicio de sesión exitoso",
    "data": {
        "user": {
            "id": 1,
            "name": "Juan Pérez",
            "email": "juan@example.com",
            "created_at": "2025-03-26T12:00:00.000000Z",
            "updated_at": "2025-03-26T12:00:00.000000Z"
        },
        "token": "1|aBcD123xyz..."
    }
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "Las credenciales son incorrectas."
        ]
    }
}
 

Request      

POST api/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Correo electrónico del usuario. Example: juan@example.com

password   string   

Contraseña del usuario. Example: secret123

Obtener usuario autenticado

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request GET \
    --get "https://api-timetables.escuelait.com/api/user" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/user"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Usuario encontrado",
    "data": {
        "id": 1,
        "name": "Juan Pérez",
        "email": "juan@example.com",
        "created_at": "2025-03-26T12:00:00.000000Z",
        "updated_at": "2025-03-26T12:00:00.000000Z"
    }
}
 

Request      

GET api/user

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

Cerrar sesión

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request POST \
    "https://api-timetables.escuelait.com/api/logout" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/logout"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Sesión cerrada",
    "data": []
}
 

Request      

POST api/logout

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

Horarios

Listar horarios

Este endpoint devuelve todos los horarios creados por el usuario autenticado, ordenados del más reciente al más antiguo.

Obtener lista de horarios del usuario autenticado

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request GET \
    --get "https://api-timetables.escuelait.com/api/timetables" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Lista de horarios obtenida correctamente",
    "data": [
        {
            "id": 1,
            "name": "Mañana",
            "description": "Turno de mañana de 8 a 12",
            "user_id": 1,
            "created_at": "2025-03-26T12:00:00.000000Z",
            "updated_at": "2025-03-26T12:00:00.000000Z"
        },
        {
            "id": 2,
            "name": "Tarde",
            "description": "Turno de tarde de 14 a 18",
            "user_id": 1,
            "created_at": "2025-03-26T13:00:00.000000Z",
            "updated_at": "2025-03-26T13:00:00.000000Z"
        }
    ]
}
 

Request      

GET api/timetables

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

Obtener un horario por ID

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request GET \
    --get "https://api-timetables.escuelait.com/api/timetables/1" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Horario obtenido correctamente",
    "data": {
        "id": 1,
        "name": "Mañana",
        "description": "Turno de mañana de 8 a 12",
        "user_id": 1,
        "created_at": "2025-03-26T12:00:00.000000Z",
        "updated_at": "2025-03-26T12:00:00.000000Z",
        "activities": [
            {
                "id": 10,
                "name": "Matemáticas",
                "start_time": "08:00",
                "end_time": "09:00"
            }
        ]
    }
}
 

Example response (403):


{
    "message": "No tienes permiso para ver este horario",
    "errors": []
}
 

Example response (404):


{
    "message": "No encontrado",
    "errors": []
}
 

Request      

GET api/timetables/{timetable_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

The ID of the timetable. Example: 1

Crear nuevo horario

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request POST \
    "https://api-timetables.escuelait.com/api/timetables" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Mañana\",
    \"description\": \"Turno de mañana de 8 a 12\"
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Mañana",
    "description": "Turno de mañana de 8 a 12"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "message": "Horario creado correctamente",
    "data": {
        "id": 1,
        "name": "Mañana",
        "description": "Turno de mañana de 8 a 12",
        "user_id": 1,
        "created_at": "2025-03-26T12:00:00.000000Z",
        "updated_at": "2025-03-26T12:00:00.000000Z"
    }
}
 

Example response (403):


{
    "message": "No tienes permiso para crear horarios",
    "errors": []
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "description": [
            "The description field is required."
        ]
    }
}
 

Request      

POST api/timetables

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Nombre del horario (máximo 50 caracteres). Example: Mañana

description   string   

Descripción del horario (máximo 300 caracteres). Example: Turno de mañana de 8 a 12

Actualizar un horario

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request PUT \
    "https://api-timetables.escuelait.com/api/timetables/1" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"Tarde\",
    \"description\": \"Turno de tarde de 14 a 18\"
}"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "Tarde",
    "description": "Turno de tarde de 14 a 18"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "Horario actualizado correctamente",
    "data": {
        "id": 1,
        "name": "Tarde",
        "description": "Turno de tarde de 14 a 18",
        "user_id": 1,
        "created_at": "2025-03-26T12:00:00.000000Z",
        "updated_at": "2025-03-26T13:00:00.000000Z"
    }
}
 

Example response (403):


{
    "message": "No tienes permiso para modificar este horario",
    "errors": []
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ]
    }
}
 

Request      

PUT api/timetables/{timetable_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

The ID of the timetable. Example: 1

Body Parameters

name   string   

Nombre del horario (máx. 50 caracteres). Example: Tarde

description   string  optional  

Descripción del horario (máx. 300 caracteres). Puede ser nulo. Example: Turno de tarde de 14 a 18

Eliminar un horario

requires authentication

Requiere autenticación con token Bearer.

Example request:
curl --request DELETE \
    "https://api-timetables.escuelait.com/api/timetables/1" \
    --header "Authorization: Bearer {Escribe aquí tu token}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api-timetables.escuelait.com/api/timetables/1"
);

const headers = {
    "Authorization": "Bearer {Escribe aquí tu token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Horario eliminado correctamente",
    "data": []
}
 

Example response (403):


{
    "message": "No tienes permiso para eliminar este horario",
    "errors": []
}
 

Example response (404):


{
    "message": "No encontrado",
    "errors": []
}
 

Request      

DELETE api/timetables/{timetable_id}

Headers

Authorization      

Example: Bearer {Escribe aquí tu token}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

timetable_id   integer   

The ID of the timetable. Example: 1