Demonstrates API building process by creating two databases, one for dogs and one for cats, seeding the data and providing routes To create, read, update and delete entries.
GET /api/cats
POST /api/cats
GET /api/cats/{id}
PUT /api/cats/{id}
DELETE /api/cats/{id}
GET /api/cats/random (Return random cat object)
GET /api/cats/page/?pageNumber=1&pageSize=2
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
name | string | none | false | Return matches by name. |
color | string | none | false | Return matches by color. |
breed | string | none | false | Return matches by breed. |
age | int | none | false | Return matches by age. |
gender | string | none | false | Return matches by gender. |
http://localhost:5000/api/cats/?gender=male&color=black
{
"catId": 2,
"name": "Jasper",
"color": "Black",
"breed": "Domestic Mediumhair",
"age": 3,
"gender": "Male"
},
{
"catId": 10,
"name": "Jiji",
"color": "Black",
"breed": "Domestic Shorthair",
"age": 5,
"gender": "Male"
}
GET /api/dogs
POST /api/dogs
GET /api/dogs/{id}
PUT /api/dogs/{id}
DELETE /api/dogs/{id}
GET /ap/dogs/random (return random dog object)
GET /api/dogs/page/?pageNumber=1&pageSize=2
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
name | string | none | false | Return matches by name. |
color | string | none | false | Return matches by color. |
breed | string | none | false | Return matches by breed. |
age | int | none | false | Return matches by age. |
gender | string | none | false | Return matches by gender. |
http://localhost:5000/api/dogs/?age=6
{
"dogId": 6,
"name": "Fido",
"color": "Tawny",
"breed": "Wolfhound",
"age": 6,
"gender": "Female"
}
- Follow this link to the project repository on GitHub.
- Click on the "Clone or download" button to copy the project link.
- If you are comfortable with the command line, you can copy the project link and clone it through your command line with the command
git clone
. Otherwise, I recommend choosing "Download ZIP". - Once the ZIP file has finished downloading, you can right click on the file to view the zip folder in your downloads.
- Right click on the project ZIP folder that you have just downloaded and choose the option "Copy To...", then choose the location where you would like to save this folder.
- Navigate to the final location where you have chosen to save the project folder.
- To view the code itself, right click, choose "open with..." and open using a text editor such as VS Code or Atom, etc.
- Open the terminal inside of your text editor.
- From inside of the AnimalShelter directory, type the command
dotnet restore
into your terminal and hit enter. You should see object files appear. They should be greyed out.
To populate a database:
- Delete the migrations folder.
- Navigate to AnimalShelter folder.
- Run
dotnet ef migrations add Initial
in the terminal. - Then run
dotnet ef database update
.
There are no known bugs at this time.
Feedback is greatly appreciated! Contact BAPotts on GitHub with any questions or comments.
- C#
- EntityFrameworkCore
- .NET-Core 2.2
- Visual Studio Code
- Git Version Control
- GitHub
- Sql Workbench 8.0
This project is licensed under the MIT license.
Copyright (c) 2020 {Beverly Potts}