Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Gabo-gutierrez/Cinefinder/llms.txt

Use this file to discover all available pages before exploring further.

Quickstart Guide

This guide will help you set up and run Cinefinder API locally, then make your first API calls to manage movies, artists, and events.

Prerequisites

Before you begin, ensure you have the following installed:
  • Java 21 or higher (Download)
  • MySQL 8.0+ (Download)
  • Maven 3.6+ (or use the included Maven wrapper)
  • Git for cloning the repository
  • cURL or Postman for testing API endpoints

Installation

Step 1: Clone the Repository

git clone <repository-url>
cd Cinefinder

Step 2: Set Up MySQL Database

Create the database and populate it with initial data:
mysql -u root -p < BD_CINES.sql
This creates the CINES database with:
  • 12 categories (Action, Comedy, Drama, etc.)
  • 12 artists (actors, singers, dancers)
  • 12 movies
  • 12 theater works
  • 12 urban events
  • Artist participations

Step 3: Configure Database Connection

The default configuration in src/main/resources/application.properties is:
spring.application.name=Cinefinder
spring.datasource.url=jdbc:mysql://localhost:3306/cines
spring.datasource.username=root
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Update the username and password if your MySQL configuration differs.

Step 4: Build the Application

Using the Maven wrapper (recommended):
./mvnw clean install
Or with your local Maven installation:
mvn clean install

Step 5: Run the Application

./mvnw spring-boot:run
Or:
mvn spring-boot:run
The API will start on http://localhost:8080 You should see output indicating the application started successfully:
Started CinefinderApplication in X.XXX seconds

Your First API Calls

Now that the API is running, let’s make some requests!

List All Movies

Retrieve all movies in the database:
curl http://localhost:8080/peliculas
Response:
[
  {
    "id": 1,
    "titulo": "El Último Viaje",
    "sipnosis": "Una odisea espacial más allá del sistema solar",
    "duracion": 120,
    "categoria_id": 5
  },
  {
    "id": 2,
    "titulo": "Amor de Barrio",
    "sipnosis": "Romance urbano entre dos mundos opuestos",
    "duracion": 95,
    "categoria_id": 6
  }
]

Get a Movie by Title

Search for a specific movie:
curl http://localhost:8080/peliculas/El%20Último%20Viaje
Response:
{
  "id": 1,
  "titulo": "El Último Viaje",
  "sipnosis": "Una odisea espacial más allá del sistema solar",
  "duracion": 120,
  "categoria_id": 5
}

Create a New Movie

Add a new movie to the catalog:
curl -X POST http://localhost:8080/peliculas \
  -H "Content-Type: application/json" \
  -d '{
    "titulo": "Nueva Aventura",
    "sipnosis": "Una historia emocionante de acción y aventura",
    "duracion": 115,
    "categoria_id": 1
  }'
Response (201 Created):
{
  "id": 13,
  "titulo": "Nueva Aventura",
  "sipnosis": "Una historia emocionante de acción y aventura",
  "duracion": 115,
  "categoria_id": 1
}

Update a Movie

Modify an existing movie:
curl -X PUT http://localhost:8080/peliculas/13 \
  -H "Content-Type: application/json" \
  -d '{
    "titulo": "Nueva Aventura",
    "sipnosis": "Una historia épica de acción y aventura",
    "duracion": 120,
    "categoria_id": 1
  }'
Response (200 OK):
{
  "id": 13,
  "titulo": "Nueva Aventura",
  "sipnosis": "Una historia épica de acción y aventura",
  "duracion": 120,
  "categoria_id": 1
}

Delete a Movie

Remove a movie from the catalog:
curl -X DELETE http://localhost:8080/peliculas/13
Response (200 OK):
{
  "details": "la pelicula con el id: 13. fue eliminada correctamente.",
  "location": "/peliculas/13"
}

Working with Artists

List All Artists

curl http://localhost:8080/artistas
Response:
[
  {
    "dni": 75839410,
    "nombre": "Carlos",
    "apellido": "Méndez",
    "tipo": "Actor",
    "descripcion": "Actor colombiano de cine y teatro"
  },
  {
    "dni": 80427139,
    "nombre": "Laura",
    "apellido": "González",
    "tipo": "Actriz",
    "descripcion": "Actriz de drama y televisión"
  }
]

Get Artist by DNI

curl http://localhost:8080/artistas/75839410

Create a New Artist

curl -X POST http://localhost:8080/artistas \
  -H "Content-Type: application/json" \
  -d '{
    "dni": 12345678,
    "nombre": "Ana",
    "apellido": "Martínez",
    "tipo": "Actriz",
    "descripcion": "Actriz de teatro experimental"
  }'

Working with Urban Events

List All Events

curl http://localhost:8080/eventosUrbanos
Response:
[
  {
    "id": 1,
    "titulo": "Festival de Callejeros",
    "descripcion": "Evento masivo de arte urbano en espacios abiertos",
    "fecha": "2025-07-10",
    "lugar": "Plaza Bolívar",
    "categoria_id": 1
  }
]

Create a New Event

curl -X POST http://localhost:8080/eventosUrbanos \
  -H "Content-Type: application/json" \
  -d '{
    "titulo": "Noche de Jazz",
    "descripcion": "Concierto de jazz al aire libre",
    "fecha": "2025-08-15",
    "lugar": "Parque Central",
    "categoria_id": 8
  }'

Working with Categories

List All Categories

curl http://localhost:8080/categorias

Get Category by Name

curl http://localhost:8080/categorias/Acción

Create a New Category

curl -X POST http://localhost:8080/categorias \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Western"
  }'

Working with Theater Works

List All Theater Works

curl http://localhost:8080/Obras

Get Work by Title

curl http://localhost:8080/Obras/Voces%20Silenciadas

API Endpoints Summary

Here’s a complete overview of available endpoints:
ResourceMethodEndpointDescription
MoviesGET/peliculasList all movies
GET/peliculas/{titulo}Get movie by title
POST/peliculasCreate new movie
PUT/peliculas/{id}Update movie
DELETE/peliculas/{id}Delete movie
ArtistsGET/artistasList all artists
GET/artistas/{dni}Get artist by DNI
POST/artistasCreate new artist
PUT/artistas/{dni}Update artist
DELETE/artistas/{dni}Delete artist
EventsGET/eventosUrbanosList all events
GET/eventosUrbanos/{titulo}Get event by title
POST/eventosUrbanosCreate new event
PUT/eventosUrbanos/{id}Update event
DELETE/eventosUrbanos/{id}Delete event
WorksGET/ObrasList all theater works
GET/Obras/{titulo}Get work by title
POST/ObrasCreate new work
PUT/Obras/{id}Update work
DELETE/Obras/{id}Delete work
CategoriesGET/categoriasList all categories
GET/categorias/{nombre}Get category by name
POST/categoriasCreate new category
PUT/categorias/{id}Update category
DELETE/categorias/{id}Delete category

Testing with Postman

If you prefer using Postman:
  1. Create a new collection called “Cinefinder API”
  2. Set the base URL to http://localhost:8080
  3. Add requests for each endpoint
  4. For POST/PUT requests, set Content-Type: application/json header
  5. Use the JSON examples provided above in the request body

Common HTTP Status Codes

  • 200 OK: Request successful
  • 201 Created: Resource created successfully
  • 404 Not Found: Resource doesn’t exist
  • 400 Bad Request: Invalid request data
  • 500 Internal Server Error: Server error

Troubleshooting

Port Already in Use

If port 8080 is already in use, change it in application.properties:
server.port=8081

Database Connection Errors

Ensure MySQL is running:
sudo systemctl status mysql
Verify credentials and database name in application.properties.

Build Failures

Clean the Maven cache and rebuild:
./mvnw clean install -U

Next Steps

Now that you’re up and running: Happy coding!

Build docs developers (and LLMs) love