Skip to content

ljeffers0106/YipYip22

Repository files navigation

YipYip (Blue Badge API Collaborative Project)

Kris Prater, Kaleb Emery, Lisa Jeffers, Austin Hooker

Software Development Bootcamp @ Eleven Fifty Academy

The final requirement to earn the Blue Badge for this program was to create an application programming interface (API) of our own design. Our .Net Framework API Web Application provides users the ability to see properties, owners of those properties, and attractions that are in the same area as the respective properties (think Airbnb, Vrbo, etc).

How to install the project locally:


(This application was built and tested in Visual Studio)

1. Go to https://github.com/kalebemery/YipYip22
2. On this page, make sure you are on the master branch (located directly above the blue box containing the name of the last committed changes)
3. Once you know you are on the master branch, click the green box containing “Code” and copy the URL given in the dropdown menu, either by copying the link manually or clicking the clipboard icon.








4. Now you can navigate to where you’d like the project to be stored, and open your command prompt.
5. In your command prompt, type “git clone”, put a space after “clone”, then paste the URL you copied from Github. Press enter and the project should clone to your local computer.
6. After the project is cloned, if there are build errors then you may have to restore NuGet packages that come along with the project. Another solution may be restarting Visual Studio.
7. Once the project is building with no errors, go to the search bar in Visual Studio and click on Tools -> NuGet Package Manager -> Package Manager Console.
8. Now, inside the package manager console you must change the Default project to YipYip22.Data (see image below).
9. Next, click inside the package manager console and type “update-database” (this will seed the ‘attractions’ table)







10. After the content is seeded, you can now run the API.
11. If the solution builds with an error, clean the solution, rebuild it, and try starting it again.
------------------------------------------------------------------------------------------------------------------------------------------

Using Postman
(or similar API testing tool)
- Click the "New" button to create a new request.
- Copy the url from the API you are running, and paste it into the request area for Postman.
- To start testing the API, you must first register an account
- To do this, paste the url as mentioned in the step above, then add /api/Account/Register (i.e. http://localhost:44312/api/Account/Register)
- Next, you have to enter the appropriate information into the "Body" of the Post request (make sure the dropdown menu next to the URL reads "Post")
- After clicking on body, click on "x-www-form-urlencoded" just below it and input your information in the given form
The "Key" inputs must be the same as you see in the picture below, the "Value" inputs can differ but must follow input procedures (i.e. email must be written in an email format, Password must have certain amount of characters, etc.)









- After you have registered for an account successfully, it is time to get a token for authorization. - Change your url and body to look like this "http://localhost:44312/token" (make sure the dropdown next to the URL reads "Post"):










- Postman should return to you an access token. You have to copy this access token and put it in the Authorization -> Bearer Token text bar given when making a request.










- Now you can populate your tables and test these endpoints. (Order is important: create Profile first, then Owner, then Property) - Don't forget to use your token on each request and make sure you are in the body section when inputing information
---------------------------------------------------------------------------------------------------------------------------------------------------

Order for testing API endpoints

1. Profile
Post a Profile (ProfileName, Phone, Email, Rating)












2. Owner (*One owner for each profile)
Post an Owner (ProfileName, Phone, Email, ProfileId)
*to obtain a Profile Id, you must perform a GET on the Profile url from above













3. Property
Post a Property (Title, Address, NumOfBeds, Desc, WeekDayRate, WeekendRate, PropertyLocation, OwnerId)
*When posting a Property, the attribute PropertyLocation is an enum in our project and must be assigned one of 12 values(you can either write the number or spell out the location):




















Once those entities are created, you can then test the remaining endpoints accordingly:

Property - Get Property (All), Get Property by Id(brings in the attractions that are in the same area), Put Property, Delete Property

Profile – Get Profile (All), Get Profile by Id, Put Profile

Owner – Get Owner by Id(brings in whatever properties that Owner possesses), Put Owner, Delete Owner

Attractions – Post Attraction, Get Attractions(All), Put Attraction, Delete Attraction
---------------------------------------------------------------------------------------------------------------------------------------------------
Additional Resources used:
https://dbdiagram.io/d/5f315d0608c7880b65c5bcf3
https://trello.com/b/HNSxnqHJ/welcome-to-trello
https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-a-more-complex-data-model-for-an-asp-net-mvc-application
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum
https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions/mvc-music-store/mvc-music-store-part-6
---------------------------------------------------------------------------------------------------------------------------------------------------
Project Created by:
@kalebemery
@ljeffers0106
@Kcprater
@AThooker

About

My copy of the Blue Badge Team Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published