- Implemented Create, Read, Update (PUT/PATCH), and Delete (CRUD) operations for films. - Added SQL queries for film management (e.g., NextFilmID, InsertFilm, UpdateFilmPut, PatchFilm, and DeleteFilm). - Updated HTTP handlers to support enhanced film operations, including validation and null handling. - Refactored category handling logic for cleaner syntax. - Included HTTP client test samples for film API in `films_crud_test.http`.
83 lines
2.1 KiB
HTTP
83 lines
2.1 KiB
HTTP
### Films API sample requests (IntelliJ HTTP Client)
|
|
|
|
### List films (default pagination)
|
|
GET http://localhost:8080/films
|
|
Accept: application/hal+json
|
|
|
|
### List films with expand and filters
|
|
GET http://localhost:8080/films?limit=5&offset=0&expand=actors,language&language.name=English
|
|
Accept: application/hal+json
|
|
|
|
### List films filtered by category name
|
|
GET http://localhost:8080/films?limit=5&category.name=Action
|
|
Accept: application/hal+json
|
|
|
|
### Get a single film
|
|
GET http://localhost:8080/films/1?expand=actors,language,original_language
|
|
Accept: application/hal+json
|
|
|
|
### Create a film (server computes next film_id)
|
|
POST http://localhost:8080/films
|
|
Content-Type: application/json
|
|
Accept: application/hal+json
|
|
|
|
{
|
|
"title": "Sample Movie",
|
|
"description": "A test film created via HTTP client",
|
|
"release_year": "2025",
|
|
"language_id": 1,
|
|
"rental_duration": 3,
|
|
"rental_rate": 4.99,
|
|
"length": 120,
|
|
"replacement_cost": 19.99,
|
|
"rating": "PG",
|
|
"special_features": "Trailers,Deleted Scenes"
|
|
}
|
|
|
|
### Create a film with explicit film_id
|
|
POST http://localhost:8080/films
|
|
Content-Type: application/json
|
|
Accept: application/hal+json
|
|
|
|
{
|
|
"film_id": 10001,
|
|
"title": "Explicit ID Film",
|
|
"language_id": 1
|
|
}
|
|
|
|
### Replace film (PUT)
|
|
# Note: Replace the :id variable below to match an existing film id
|
|
PUT http://localhost:8080/films/{{film_id}}
|
|
Content-Type: application/json
|
|
Accept: application/hal+json
|
|
|
|
{
|
|
"title": "Updated Title (PUT)",
|
|
"description": "Full replacement payload",
|
|
"release_year": "2024",
|
|
"language_id": 1,
|
|
"original_language_id": 2,
|
|
"rental_duration": 5,
|
|
"rental_rate": 3.99,
|
|
"length": 95,
|
|
"replacement_cost": 14.99,
|
|
"rating": "PG-13",
|
|
"special_features": "Trailers,Behind the Scenes"
|
|
}
|
|
|
|
### Patch film (partial update)
|
|
PATCH http://localhost:8080/films/{{film_id}}
|
|
Content-Type: application/json
|
|
Accept: application/hal+json
|
|
|
|
{
|
|
"title": "Patched Title",
|
|
"rental_rate": 2.99
|
|
}
|
|
|
|
### Delete film
|
|
DELETE http://localhost:8080/films/{{film_id}}
|
|
|
|
### Related: list actors of a film
|
|
GET http://localhost:8080/films/{{film_id}}/actors
|
|
Accept: application/hal+json
|