Prerequisites
Before you begin, make sure you’ve completed the installation steps.
Start the Server
Start the development server
The application includes a convenient development script that starts all necessary services:This command runs:
- Laravel development server on
http://localhost:8000
- Queue worker for background jobs
- Log viewer (Laravel Pail) for real-time logs
- Vite dev server for frontend assets
The dev script uses concurrently to run all services simultaneously. All services will stop when you terminate the process.
Verify the server is running
Open your browser or use curl to test the server:curl http://localhost:8000/api/user
You can also start just the server with: php artisan serve
Make Your First API Request
The API is now ready at http://localhost:8000/api. Let’s explore the available endpoints.
List All Institutions
Retrieve all educational institutions:
curl http://localhost:8000/api/institutions
Response:
{
"success": true,
"message": "Instituciones listadas con éxito",
"data": [
{
"id": 1,
"nombre": "Universidad Ejemplo",
"direccion": "Calle Principal 123",
"telefono": "555-0123",
"email": "[email protected]",
"logo_url": "https://example.com/logo.png",
"anio_academico": "2026",
"fecha_inicio": "2026-01-15",
"fecha_fin": "2026-12-15",
"created_at": "2026-03-05T10:30:00.000000Z",
"updated_at": "2026-03-05T10:30:00.000000Z"
}
]
}
Get a Specific Institution
Retrieve a single institution by ID:
curl http://localhost:8000/api/institutions/1
Response:
{
"success": true,
"message": "Institución obtenida con éxito",
"data": {
"id": 1,
"nombre": "Universidad Ejemplo",
"direccion": "Calle Principal 123",
"telefono": "555-0123",
"email": "[email protected]",
"logo_url": "https://example.com/logo.png",
"anio_academico": "2026",
"fecha_inicio": "2026-01-15",
"fecha_fin": "2026-12-15",
"created_at": "2026-03-05T10:30:00.000000Z",
"updated_at": "2026-03-05T10:30:00.000000Z"
}
}
Create a New Institution
Create a new institution with a POST request:
curl -X POST http://localhost:8000/api/institutions \
-H "Content-Type: application/json" \
-d '{
"nombre": "Instituto Tecnológico",
"direccion": "Av. Tecnología 456",
"telefono": "555-0456",
"email": "[email protected]",
"logo_url": "https://example.com/logo2.png",
"anio_academico": "2026",
"fecha_inicio": "2026-02-01",
"fecha_fin": "2026-11-30"
}'
Response:
{
"success": true,
"message": "Institución creada con éxito",
"data": {
"id": 2,
"nombre": "Instituto Tecnológico",
"direccion": "Av. Tecnología 456",
"telefono": "555-0456",
"email": "[email protected]",
"logo_url": "https://example.com/logo2.png",
"anio_academico": "2026",
"fecha_inicio": "2026-02-01",
"fecha_fin": "2026-11-30",
"created_at": "2026-03-05T14:20:00.000000Z",
"updated_at": "2026-03-05T14:20:00.000000Z"
}
}
List All Users
Retrieve all users in the system:
curl http://localhost:8000/api/users
Response:
{
"success": true,
"message": "Usuarios listados con éxito",
"data": [
{
"id": 1,
"institutions_id": 1,
"rol": "admin",
"nombre": "Juan",
"apellido": "Pérez",
"email": "[email protected]",
"documento_identidad": "12345678",
"fecha_nacimiento": "1990-05-15",
"telefono": "555-1234",
"activo": true,
"created_at": "2026-03-05T10:30:00.000000Z",
"updated_at": "2026-03-05T10:30:00.000000Z"
}
]
}
The password and remember_token fields are automatically hidden from API responses for security.
Available API Endpoints
The API follows RESTful conventions. All endpoints follow the same response structure:
{
"success": true|false,
"message": "Description of the operation",
"data": {} or [] or null
}
Resource Endpoints
All resources support standard CRUD operations:
| Method | Endpoint | Description |
|---|
| GET | /api/{resource} | List all records |
| POST | /api/{resource} | Create a new record |
| GET | /api/{resource}/{id} | Get a specific record |
| PUT/PATCH | /api/{resource}/{id} | Update a record |
| DELETE | /api/{resource}/{id} | Delete a record |
Available Resources
/api/institutions - Educational institutions
/api/users - System users
/api/sections - Class sections
/api/registrations - Student enrollments
/api/units - Course units
/api/topics - Unit topics
/api/resources - Educational resources
/api/questions - Assessment questions
/api/response_option - Question answer options
/api/evaluations - Student evaluations
/api/eval_preguntas - Evaluation questions
Authentication (Optional)
The API includes Laravel Sanctum for authentication. The /api/user endpoint requires authentication:
curl http://localhost:8000/api/user \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Testing the API
Run the test suite to verify everything works:
This command:
- Clears the configuration cache
- Runs PHPUnit tests
Next Steps
Now that you’ve made your first API requests:
- Explore other API endpoints
- Implement authentication with Laravel Sanctum
- Set up API documentation
- Configure CORS for frontend integration
- Deploy to production
Common Operations
Update a Record
curl -X PUT http://localhost:8000/api/institutions/1 \
-H "Content-Type: application/json" \
-d '{"nombre": "Universidad Actualizada"}'
Response:
{
"success": true,
"message": "Institución actualizada con éxito",
"data": {
"id": 1,
"nombre": "Universidad Actualizada",
"direccion": "Calle Principal 123",
"telefono": "555-0123",
"email": "[email protected]",
"logo_url": "https://example.com/logo.png",
"anio_academico": "2026",
"fecha_inicio": "2026-01-15",
"fecha_fin": "2026-12-15",
"created_at": "2026-03-05T10:30:00.000000Z",
"updated_at": "2026-03-05T15:45:00.000000Z"
}
}
Delete a Record
curl -X DELETE http://localhost:8000/api/institutions/1
Response:
{
"success": true,
"message": "Institución eliminada con éxito",
"data": null
}