Simple REST API for movie database using Spring and Spring Boot.
- Java JDK 8 - http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Maven 3.x - https://maven.apache.org/download.cgi
- Build
mvnw clean install
- Run
mvnw spring-boot:run
- JSON URL: http://localhost:8080/v2/api-docs
- UI URL: http://localhost:8080/swagger-ui.html
-
Request:
GET http://localhost:8080/actors
-
Response:
[
{
"id",
"name",
"lastName",
"birthDate"
}
]
-
Request:
GET http://localhost:8080/actors/{id}
-
Response:
{
"id",
"name",
"lastName",
"birthDate"
}
- Request:
POST http://localhost:8080/actors
- Header:
Content-Type:application/json
- Body:
{ "name", "lastName", "birthDate" }
- Header:
- Response:
{
"id",
"name",
"lastName",
"birthDate"
}
-
Request:
DELETE http://localhost:8080/actors/{id}
-
Response:
{
"id",
"name",
"lastName",
"birthDate"
}
- Request:
PUT http://localhost:8080/actors/{id}
- Header:
Content-Type:application/json
- Body:
{ "name", "lastName", "birthDate" }
- Header:
- Response:
{
"id",
"name",
"lastName",
"birthDate"
}
-
Request:
GET http://localhost:8080/movies
- Header:
Accept:{contentType}
:application/json
orapplication/xml
- Params:
page
- page number,size
- number of movies on page
- Header:
-
Response:
[
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]
-
Request:
GET http://localhost:8080/movies/{id}
-
Response:
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
-
Request:
POST http://localhost:8080/movies
- Header:
Content-Type:application/json
- Body:
{ "title", "director", "cast": [ { "name", "lastName", "birthDate" } ], "releaseDate" "duration", "amountAvailable", "group" }
- Header:
-
Response:
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
-
Request:
DELETE http://localhost:8080/movies/{id}
-
Response:
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
-
Request:
PUT http://localhost:8080/movies
- Header:
Content-Type:application/json
- Body:
{ "title", "director", "cast": [ { "name", "lastName", "birthDate" } ], "releaseDate", "duration", "amountAvailable", "group" }
- Header:
-
Response:
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
-
Request:
POST http://localhost:8080/movies/{id}/actors
- Header:
Content-Type:application/json
- Body:
{ "name", "lastName", "birthDate" }
- Header:
-
Response:
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
-
Request:
GET http://localhost:8080/movies?available=true
-
Response:
[
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]
-
Request:
GET http://localhost:8080/movies?group={groupName}
{groupName} : NEW, HIT, OTHER
-
Response:
[
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]
-
Request:
POST http://localhost:8080/users
- Header:
Content-Type:application/json
- Body:
{ "name", "lastName", "email", "password" }
- Header:
-
Response:
{
"id",
"name",
"lastName",
"email",
"amountOfRentedMovies"
}
-
Request:
GET http://localhost:8080/users/{userId}
-
Response:
[
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]
-
Request:
POST http://localhost:8080/users/{userId}/rent
- Header:
Content-Type:application/json
- Body: List of movie ids
[ {movieId}, {movieId} ]
- Header:
-
Response:
{
"price",
"user": {
"id",
"name",
"lastName",
"amountOfRentedMovies"
},
"rentedMovies": [
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]
}
-
Request:
POST http://localhost:8080/users/{userId}/return
- Header:
Content-Type:application/json
- Body: List of movie ids
[ {movieId}, {movieId} ]
- Header:
-
Response:
[
{
"id",
"title",
"director",
"cast": [
{
"id",
"name",
"lastName",
"birthDate"
}
],
"releaseDate",
"duration",
"amountAvailable",
"group"
}
]