Skip to content
/ WebAPI Public

A proof-of-concept .NET Core 2.1.1 Web API which implements EF Core

Notifications You must be signed in to change notification settings

SY6Dave/WebAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movies RESTful WebAPI

Overview

This document provides a summary of the Movies RESTful WebAPI, which was created as a proof-of-concept application to store data in an in-memory database and return it back over HTTP in JSON format.

The database is seeded with a set of test data and is re-created on each launch of the application. A possible future enhancement would be to make the seeding optional via launch parameters.

Dependencies

The following frameworks and packages were used to implement the application:

Documentation

Full, interactive API documentation can be accessed from within the application via the route: /swagger

Request & Response Examples

API Methods

GET /api/movies

Gets all of the movies in the database

Possible response codes:

  • 200: Returns the list of movies

Example: https://localhost:44366/api/movies

Response body:

[  
  {  
     "$id":"73",
     "movieId":1,
     "title":"They Live",
     "description":"Science fiction thriller, directed by John Carpenter",
     "movieActors":[  
        {  
           "$id":"74",
           "movieId":1,
           "movie":{  
              "$ref":"73"
           },
           "actorId":1,
           "actor":{  
              "$id":"75",
              "actorId":1,
              "firstName":"'Rowdy' Roddy",
              "surname":"Piper",
              "movieActors":[  
                 {  
                    "$ref":"74"
                 }
              ]
           }
        },
        {  
           "$id":"76",
           "movieId":1,
           "movie":{  
              "$ref":"73"
           },
           "actorId":2,
           "actor":{  
              "$id":"77",
              "actorId":2,
              "firstName":"Keith",
              "surname":"David",
              "movieActors":[  
                 {  
                    "$ref":"76"
                 }
              ]
           }
        }
     ]
  },
  {  
     "$id":"78",
     "movieId":2,
     "title":"Taxi Driver",
     "description":"Martin Scorsese, neo-noir classic",
     "movieActors":[  
        {  
           "$id":"79",
           "movieId":2,
           "movie":{  
              "$ref":"78"
           },
           "actorId":3,
           "actor":{  
              "$id":"80",
              "actorId":3,
              "firstName":"Robert",
              "surname":"De Niro",
              "movieActors":[  
                 {  
                    "$ref":"79"
                 }
              ]
           }
        }
     ]
  }
]

GET /api/movies/{id}

Get a specific movie by ID

Possible response codes:

  • 200: Returns the movie requested
  • 404: If a single movie with the requested ID cannot be found

Example: https://localhost:44366/api/movies/3

Response body:

{  
   "$id":"29",
   "movieId":3,
   "title":"Cape Fear",
   "description":"Creepy boat scene, parodied by The Simpsons",
   "movieActors":[  
      {  
         "$id":"30",
         "movieId":3,
         "movie":{  
            "$ref":"29"
         },
         "actorId":3,
         "actor":{  
            "$id":"31",
            "actorId":3,
            "firstName":"Robert",
            "surname":"De Niro",
            "movieActors":[  
               {  
                  "$ref":"30"
               }
            ]
         }
      }
   ]
}

POST /api/movies

Creates a new movie

Possible response codes:

  • 201: The movie was created successfully
  • 400: If a null model was passed in
  • 404: If a referenced actor ID cannot be found

Sample request:

POST /api/movies
{
   "Title":"Jurassic Park",
   "Description":"Dinosaurs",
   "MovieActors":[  
      {  
         "ActorId":5
      }
   ]
}

PUT /api/movies/{id}

Update an existing movie's title or description

Possible response codes:

  • 200: The movie was updated successfully
  • 400: If a null model was passed in
  • 404: If a single movie with the requested ID cannot be found

Sample request:

PUT /api/movies/1
{  
   "Description":"This movie recently won an oscar"
}

DELETE /api/movies/{id}

Delete a specified movie

Possible response codes:

  • 200: The movie was updated successfully
  • 404: If a single movie with the requested ID cannot be found

About

A proof-of-concept .NET Core 2.1.1 Web API which implements EF Core

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages