API for CIT368 Group Project 1 - WhereToDo
The API can be accessed at: https://wheretodoapi.azurewebsites.net/
The structure of this project was created with guidance provided by a Lynda.com class "Building and Securing RESTful APIs in ASP.NET Core" by Nate Barbettini.
Classes derived from this course are marked, along with unique classes specific to this project within a header comment for each file.
The primary locations of interest for this project are probably:
- Controllers (Folder)
- UsersController.cs
- ListController.cs
- Services (Folder)
- DefaultUserService.cs
- DefaultListService.cs
-
Create a User Account:
POST to /users route with JSON body:{ "username": "testUsername", "password": "Password123!" }
-
Authenticate User for Login:
POST to /token route with 'x-www-form-urlencoded' KEY/VALUE pairs:KEY VALUE grant_type password username testUsername password Password123! This will return something similar to:
{ "scope": "roles", "token_type": "Bearer", "access_token": "token_value_string" }
The token_value_string should be included within an Authorization header for all subsequent requests to the API. The header should follow the KEY/VALUE pair format of:
KEY VALUE Authorization Bearer token_value_string -
Modify User Account (Change Password):
PATCH to /users route with JSON body:{ "currentpassword": "Password123!", "newpassword": "Password456!" }
-
Add a Task (List):
POST to /list route with JSON body:{ "title": "Sample List POST", "location": "GitHub README", "lat": "10.000", "long": "10.000" }
-
Modify a Task (List):
PATCH to /list/{listID} route with JSON body:[ { "op": "replace", "path": "/title", "value": "Modified Task/List Title" } ]
This PATCH supports all PATCH operations. The example above modifies the title of the List. The same concept can be applied to /status to update the status of a particular List.
-
DELETE to /list{listID} route.
There is no body to this request. All that is needed is the Authorization header, the same as all other actions.