With this API, you can register as a user, then, create and manage character entries in a database of Marvel characters, as well as their appearances on TV and in the MCU[x].
Table of Contents
- Mary B. -> github.com/MaryBeeson23
- Nick A. -> github.com/avgnand
- Zach D. -> github.com/zdearmin
To start, you will need to clone the repository into your desired directory. Everything you need to access and run this API is included in this repository. You do not need any external dependencies.
To clone the repository, run this command in your terminal:
git clone https://github.com/zdearmin/MarvelAPI.git
With your server running, you can execute the following command to create the database and tables. If your current working directory is the same as the folder with the .git file, your command should look like below:
dotnet ef database update -p .\MarvelAPI.Data\ -s .\MarvelAPI.WebAPI\
By running the project file within the MarvelAPI.WebAPI assembly, the endpoints will become active, and if your server where you would like to host your data is live as well, you can begin the process of migrating, then posting to the newly created database.
The command to startup the project should look similar to:
dotnet run --project .\MarvelAPI.WebAPI\
For interacting with your database, the project includes an implementation of Swagger[x] to run queries from within your browser. To run Swagger, post the text below into your browser, and adjust the port number to match what is shown on your local device.
https://localhost:[EnterPortHere]/swagger
Alternatively, Postman[x] is a recommended platform that allows you to save multiple customized queries. Click the button below to get the data framework for this collection. Then, import that data into your desired Postman workspace to create the MarvelAPI collection.
This API utilizes JSON Web Tokens (JWT)[x] for authentication and authorization. All GET endpoints are open access. All other endpoints are restricted to users with authorization. Authorization can be granted in the form of a token. Steps to generating a token are listed below:
-
Create a new user at the
POST /api/User/Registerendpoint. -
Enter your newly created "Username" and "Password" at the
POST /api/Tokenenpoint. If the username and password match a valid user, a new token will be generated. The generated token can then be added to the authorization fields in either Postman or Swagger to gain access to remaining CRUD methods.
Here is an overview of the tables:
- Characters
- Id -
int - Name -
string - Age -
string(e.g., "30s", "Immortal", "Unknown") - Location -
string(i.e., current location in MCU) - Origin -
string(i.e., homeworld / birthplace) - Abilities -
string(comma-separated) - Abilities Origin -
string(1-or-2 word description) - Aliases -
string(comma-separated) - Status -
string(i.e., "Alive", "Dead", "Unknown")
- Id -
- Movies
- Id -
int - Title -
string - Release Year -
int
- Id -
- Movie Appearances
- Id -
int - Character Id - Foreign Key to Characters table
- Movie Id - Foreign Key to Movies table
- Id -
- Team Memberships
- Id -
int - Team Id - Foreign Key to Teams table
- Member Id - Foreign Key to Characters table
- Id -
- Teams
- Id -
int - Name -
string - Authority -
string - Alignment -
string
- Id -
- TV Shows
- Id -
int - Title -
string - Release Year -
int - Number of Seasons -
int
- Id -
- TV Show Appearances
- Id -
int - Character Id - Foreign Key to Characters table
- TV Show Id - Foreign Key to TV Shows table
- Id -
- Users
- Id -
int - Email -
string(i.e., [email protected]) - Username -
string(minimum length of 4 characters) - Password -
string(minimum length of 4 characters) - First Name -
string - Last Name -
string - Date Created -
DateTime
- Id -
Each table in the database is equipped with functionality for Creating, Reading, Updating, and Deleting (aka CRUD). Details for information needed to complete requests are provided below. All requests and returns are represented in JSON format.
Create a new character:
POST /api/Character
- Request completed using
Body
Example Request:
{
"fullName": "string",
"age": "string"
}
Get all characters:
GET /api/Character
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"fullName": "string"
}
]
Get a character by Id:
GET /api/Character/{characterId}
- Request completed using
Routeint characterId
Example Response:
{
"id": 0,
"fullName": "string",
"age": "string",
"location": "string",
"origin": "string",
"abilities": "string",
"abilitiesOrigin": "string",
"aliases": "string",
"status": "string",
"movies": [
{
"id": 0,
"title": "string"
}
],
"tvShows": [
{
"id": 0,
"title": "string"
}
]
}
Get a character by aliases:
GET /api/Character/Aliases/{aliases}
- Request completed using
Routestring aliases
Example Response:
[
{
"id": 0,
"fullName": "string",
"aliases": "string"
}
]
Get all characters with ability:
GET /api/Character/Abilities/{ability}
- Request completed using
Routestring ability
Example Response:
[
{
"id": 0,
"fullName": "string",
"abilities": "string"
}
]
Update a character:
PUT /api/Character/{characterId}}
- Request completed using
Routeint characterId andBody
The following properties will be left unchanged if the corresponding values in the request body are sent as empty strings
Example Request:
{
"fullName": "string",
"age": "string",
"location": "string",
"origin": "string",
"abilities": "string",
"abilitiesOrigin": "string",
"aliases": "string",
"status": "string"
}
Delete a character:
DELETE /api/Character/{characterId}}
- Request completed using
Routeint characterId - Response will be status 200 OK if successful
Create a new movie:
POST /api/Movie
- Request completed using
Body
Example Request:
{
"title": "string",
"releaseYear": 0
}
Get all movies:
GET /api/Movie
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"title": "string"
}
]
Get a movie by Id:
GET /api/Movie/{movieId}
- Request completed using
Routeint movieId
Example Response:
{
"id": 0,
"title": "string",
"releaseYear": 0,
"characters": [
{
"id": 0,
"fullName": "string"
}
]
}
Get a movie by title:
GET /api/Movie/{movieTitle}
- Request completed using
Routestring movieTitle
Example Response:
{
"id": 0,
"title": "string",
"releaseYear": 0,
"characters": [
{
"id": 0,
"fullName": "string"
}
]
}
Update a movie:
PUT /api/Movie/{movieId}
- Request completed using
Routeint movieId andBody
Example Request:
{
"title": "string",
"releaseYear": 0
}
Delete a movie:
DELETE /api/Movie/{movieId}
- Request completed using
Routeint movieId - Response will be status 200 OK if successful
Create a new movie appearance:
POST /api/MovieAppearance
- Request completed using
Body
Example Request:
{
"characterId": 0,
"movieId": 0
}
Get all movie appearances:
GET /api/MovieAppearance
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"character": "string",
"movie": "string"
}
]
Get a movie appearance by Id:
GET /api/MovieAppearance/{movieAppearanceId}
- Request completed using
Routeint movieAppearanceId
Example Response:
{
"id": 0,
"characterId": 0,
"character": "string",
"movieId": 0,
"movie": "string"
}
Update a movie appearance:
PUT /api/MovieAppearance/{movieAppearanceId}
- Request completed using
Routeint movieAppearanceId andBody
Example Request:
{
"characterId": 0,
"movieId": 0
}
Delete a movie appearance:
DELETE /api/MovieAppearance/{movieAppearanceId}
- Request completed using
Routeint movieAppearanceId - Response will be status 200 OK if successful
Create a new team membership:
POST /api/TeamMembership
- Request completed using
Body
Example Request:
{
"teamId": 0,
"memberId": 0
}
Get all team memberships:
GET /api/TeamMembership
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"teamId": 0,
"memberId": 0
}
]
Get a team membership by Id:
GET /api/TeamMembership/{teamMembershipId}
- Request completed using
Routeint teamMembershipId
Example Response:
{
"id": 0,
"teamId": 0,
"memberId": 0,
"team": "string",
"member": "string"
}
Update a team membership:
PUT /api/TeamMembership/{teamMembershipId}
- Request completed using
Routeint teamMembershipId andBody
Example Request:
{
"teamId": 0,
"memberId": 0
}
Delete a team membership:
DELETE /api/TeamMembership/{teamMembershipId}
- Request completed using
Routeint teamMembershipId - Response will be status 200 OK if successful
Create a new team:
POST /api/Teams
- Request completed using
Body
Example Request:
{
"name": "string"
}
Get all teams:
GET /api/Teams
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"name": "string"
}
]
Get a team by Id:
GET /api/Teams/{teamId}
- Request completed using
Routeint teamId
Example Response:
{
"id": 0,
"name": "string",
"authority": "string",
"alignment": "string",
"members": [
{
"id": 0,
"fullName": "string"
}
]
}
Update a team:
PUT /api/Teams/{teamId}
- Request completed using
Routeint teamId andBody
Example Request:
{
"name": "string",
"authority": "string",
"alignment": "string"
}
Delete a team:
DELETE /api/Teams/{teamId}
- Request completed using
Routeint teamId - Response will be status 200 OK if successful
Create a new TV show:
POST /api/TVShow
- Request completed using
Body
Example Request:
{
"title": "string",
"releaseYear": 0,
"seasons": 0
}
Get all TV shows:
GET /api/TVShow
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"title": "string"
}
]
Get a TV show by Id:
GET /api/TVShow/{tvShowId}
- Request completed using
Routeint tvShowId
Example Response:
{
"id": 0,
"title": "string",
"releaseYear": 0,
"seasons": 0,
"characters": [
{
"id": 0,
"fullName": "string"
}
]
}
Get a TV show by title:
GET /api/TVShow/{tvShowTitle}
- Request completed using
Routestring tvShowTitle
Example Response:
{
"id": 0,
"title": "string",
"releaseYear": 0,
"seasons": 0,
"characters": [
{
"id": 0,
"fullName": "string"
}
]
}
Update a TV show:
PUT /api/TVShow/{tvShowId}
- Request completed using
Routeint tvShowId andBody
Example Request:
{
"title": "string",
"releaseYear": 0,
"seasons": 0
}
Delete a TV show:
DELETE /api/tvShow/{tvShowId}
- Request completed using
Routeint tvShowId - Response will be status 200 OK if successful
Create a new TV show appearance:
POST /api/TVShowAppearance
- Request completed using
Body
Example Request:
{
"characterId": 0,
"tvShowId": 0
}
Get all TV show appearances:
GET /api/TVShowAppearance
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"character": "string",
"tvShow": "string"
}
]
Get a TV show appearance by Id:
GET /api/TVShowAppearance/{tvShowAppearanceId}
- Request completed using
Routeint tvShowAppearanceId
Example Response:
{
"id": 0,
"characterId": 0,
"character": "string",
"tvShowId": 0,
"tvShow": "string"
}
Update a TV show appearance:
PUT /api/TVShowAppearance/{tvShowAppearanceId}
- Request completed using
Routeint tvShowAppearanceId andBody
Example Request:
{
"characterId": 0,
"tvShowId": 0
}
Delete a TV show appearance:
DELETE /api/TVShowAppearance/{tvShowAppearanceId}
- Request completed using
Routeint tvShowAppearanceId - Response will be status 200 OK if successful
Generate a new token:
POST /api/Token
- Request completed using
Body
Example Request:
{
"username": "string",
"password": "string"
}
Create a new user:
POST /api/User/Register
- Request completed using
Body
Example Request:
{
"email": "[email protected]",
"username": "string",
"password": "string",
"confirmPassword": "string"
}
Get all users:
GET /api/User
- No request
RouteorBodyrequired
Example Response:
[
{
"id": 0,
"username": "string",
"email": "string",
"firstName": "string",
"lastName": "string",
"dateCreated": "2022-07-26T17:58:53.980Z"
}
]
Get a user by Id:
GET /api/User/{userId}
- Request completed using
Routeint userId
Example Response:
{
"id": 0,
"username": "string",
"email": "string",
"firstName": "string",
"lastName": "string",
"dateCreated": "2022-07-26T18:01:56.579Z"
}
Update a user:
PUT /api/User/{userId}
- Request completed using
Routeint userId andBody
Example Request:
{
"username": "string",
"email": "[email protected]",
"password": "string",
"firstName": "string",
"lastName": "string"
}
Delete a user:
DELETE /api/User/{userId}
- Request completed using
Routeint userId - Response will be status 200 OK if successful
Below is a list of resources we would like to give credit to as each one played a role in the development of this API.