.NET Core 3 web api for managing movies in a SQLite database using Entity Framework.
This application manages movies in a database. The source code for a frontend client can be found in the MoviemoReactClient repo.
General functionality:
- Add, edit, and delete movies and their associated genres
- Supports GET, POST, PUT, and DELETE verbs
- Returns json data
Returns a single genre
- URL: /genres/:id
- Method:
GET
- URL Params:
id=[integer]
- Success Response:
- Code: 200
Content:{ id : 1, name : "Action" }
- Code: 200
- Error Response:
- Code: 404 NOT FOUND
Content:{ error: "Genre with id 1 was not found" }
- Code: 404 NOT FOUND
Returns json data about all genres
- URL: /genres
- Method:
GET
- Success Response:
- Code: 200
Content:[{ id : 1, name : "Action" }, { id : 2, name : "Comedy" }]
- Code: 200
Returns newly created genre
- URL: /genres
- Method:
POST
- Success Response:
- Code: 201
Content:{ id : 1, name : "Action" }
- Code: 201
- Error Response:
-
Code: 400 BAD REQUEST
Content:{ name: "Invalid name" }
OR -
Code: 409 CONFLICT
Content:{ error: "Genre with name Action already exists" }
-
Returns no content
- URL: /genres/:id
- Method:
PUT
- URL Params:
id=[integer]
- Success Response:
- Code: 204
- Code: 204
- Error Response:
- Code: 400 BAD REQUEST
Content:{ name: "Invalid name" }
OR - Code: 404 NOT FOUND
Content:{ error: "Genre with id 1 was not found" }
- Code: 400 BAD REQUEST
Returns deleted genre
- URL: /genres/:id
- Method:
DELETE
- URL Params:
id=[integer]
- Success Response:
- Code: 200
Content:{ id : 1, name : "Action" }
- Code: 200
- Error Response:
- Code: 404 NOT FOUND
Content:{ error: "Genre with id 1 was not found" }
- Code: 404 NOT FOUND
Returns a single movie
- URL: /movies/:id
- Method:
GET
- URL Params:
id=[integer]
- Success Response:
- Code: 200
Content:{ id : 1, title : "Avengers", genre: "Action", genreId: "1" }
- Code: 200
- Error Response:
- Code: 404 NOT FOUND
Content:{ error: "Movie with id 1 was not found" }
- Code: 404 NOT FOUND
Returns json data about all movies
- URL: /movies
- Method:
GET
- Success Response:
- Code: 200
Content:[{ id : 1, title : "Avengers", genre: "Action", genreId: "1" }, { id : 2, title : "Jumanji", genre: "Adventure", genreId: "2" }]
- Code: 200
Returns newly created movie
- URL: /movies
- Method:
POST
- Success Response:
- Code: 201
Content:{ id : 1, title : "Avengers", genre: "Action", genreId: "1" }
- Code: 201
- Error Response:
-
Code: 400 BAD REQUEST
Content:{ title: "Invalid title" }
OR -
Code: 404 NOT FOUND
Content:{ error: "Genre with id 12 was not found" }
-
- Notes: While creating a genre with an existing name generates an error, multiple movies may have the same title.
Returns no content
- URL: /movies/:id
- Method:
PUT
- URL Params:
id=[integer]
- Success Response:
- Code: 204
- Code: 204
- Error Response:
- Code: 400 BAD REQUEST
Content:{ title: "Invalid title" }
OR - Code: 404 NOT FOUND
Content:{ error: "Movie with id 12 was not found" }
- Code: 400 BAD REQUEST
Returns deleted movie
- URL: /movies/:id
- Method:
DELETE
- URL Params:
id=[integer]
- Success Response:
- Code: 200
Content:{ id : 1, title : "Avengers", genre: "Action", genreId: "1" }
- Code: 200
- Error Response:
- Code: 404 NOT FOUND
Content:{ error: "Movie with id 12 was not found" }
- Code: 404 NOT FOUND