An API designed to list state and national parks across the United States.
VS Code
C# 7.3.0
.NET Core 2.2.0
Entity Framework Core 2.2.6
MySQL Workbench 8.0 for Windows
Postman
Swagger
Swashbuckle
No known bugs at this time.
To open the project on your local machine, you will need to download and install a code editor. The most popular choices are Atom and Visual Studio Code. Visual Studio Code is the code editor used to create this application.
- Download the 64-bit .NET Core SDK (Software Development Kit) by following this link: https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.203-windows-x64-installer.
1a. Follow prompts to begin your download. The download will be a .exe file. Click to install when it is finished downloading. - After clicking the downloaded .exe file, follow the prompts in the installer and use suggested default settings.
- You can confirm a successful installation by opening a command line terminal and running the command
$ dotnet --version
, which should return a version number.
- Download the .NET Core SDK by following this link: https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.2.106-macos-x64-installer.
1a. Follow prompts to begin your download. The download will be a .pkg file. Click to install when it is finished downloading. - After clicking the downloaded .pkg file, follow the prompts in the installer and use suggested default settings.
- You can confirm a successful installation by opening a command line terminal and running the command
$ dotnet --version
, which should return a version number.
- Enter the command
dotnet tool install -g dotnet-script
in the command line of a terminal window, such as Terminal for macOS or PowerShell for Windows.
- Download and install the version of MySQL Workbench suitable for your machine.
- Follow this link to view the Postman website and download/install.
- Follow above steps to install necessary software.
- Open web browser and go to https://github.com/cschweig2/ParkFinder.Solution.
- After clicking the green "code" button, you can copy the URL for the repository.
- Open a terminal window, such as Command Prompt or Git Bash, and navigate to the folder you wish to keep this project in.
4a. Type in this command:git clone
, followed by the URL you just copied. The full command should look like this:git clone https://github.com/cschweig2/ParkFinder.Solution
. - View the code on your favorite text editor.
- Click here to view project repository.
- Click "Clone or download" to find the "Download ZIP" option.
- Click "Download ZIP" and extract files.
- Open the project in a text editor by clicking on any file in the project folder.
- Navigate to the
ParkFinder
project folder and enterdotnet ef database update
in the command line, which will create the database in MySQL Workbench using the migrations from theMigrations
folder.
- Navigate to the
ParkFinder
folder and enterdotnet restore
in the command line to install packages. - After packages are installed in each of these folders, navigate to the
ParkFinder
project folder and enterdotnet build
in the command line to build the program.
Use Postman (see Installation Requirements section above) to explore API endpoints. Alternatively, you can use Swagger (see below).
Explore the API endpoints with Swagger Documentation:
- Enter
dotnet run
in the command line to launch the server. - Use a browser to navigate to
http://localhost:5000/swagger/
.
This API is CORS enabled. CORS is a W3C standard that allows a server to relax the same-origin policy. This is not a security feature, CORS relaxes security. For more information, click here.
In order to use the POST, PUT and DELETE functionality/routes in this API, you will need to authenticate yourself through Postman:
- In Postman, create a POST request to the URL
http://localhost:5000/api/2/users/authenticate
with the following code entered as raw JSON in the Body tab:
{
"username": "admin",
"password": "test"
}
- The token will be generated in the response. Copy and paste it as the Token parameter in the Authorization tab. You are now authorized!
Base URL: https://localhost:5000
GET /api/2.0/{component}
POST /api/2.0/{component}
GET /api/2.0/{component}/{id}
PUT /api/2.0/{component}/{id}
DELETE /api/2.0/{component}/{id}
https://localhost:5000/api/2.0/parks/1
{
"parkId": 1,
"parkType": "National Park",
"parkName": "Crater Lake",
"city": "Crater Lake",
"state": "OR",
"status": "Open",
"website": "https://www.nps.gov/crla/index.htm"
}
Access national and state park listings across the United States.
GET /api/2.0/parks
POST /api/2.0/parks
GET /api/2.0/parks/{id}
PUT /api/2.0/parks/{id}
DELETE /api/2.0/parks/{id}
GET /api/2.0/parks/random
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
parkType | string | none | false | Returns parks by type (National Park, National Historic Site, etc.) |
parkName | string | none | false | Returns park by name (Denali, New Jersey Pinelands, Crater Lake, etc.) |
city | string | none | false | Returns park by the city it is primarily located in. Note that some parks span multiple cities. |
state | string | none | false | Returns park by the state it is primarily located in. States are in 2-letter format (OR, NJ, AK, etc.) |
status | string | none | false | Returns parks whose status are set to "Open" or "Close". Please see the website listed under the park to see further details on additional park regulations. |
https://localhost:5000/api/2.0/parks/?city=batsto&status=open
{
"parkId": 2,
"parkType": "National Reserve",
"parkName": "New Jersey Pinelands",
"city": "Batsto",
"state": "NJ",
"status": "Open",
"website": "https://www.nps.gov/pine/index.htm"
}
If you run into any issues, you can contact the creator at [email protected], or make contributions to the code on GitHub via forking and creating a new branch.
Author | GitHub Profile | Contact Email |
---|---|---|
Chelsea Becker | https://github.com/cschweig2 | [email protected] |
This software is licensed under the MIT license.
Copyright (c) 2021 Chelsea Becker