-
endpoints
-
PID search - /api/prisoner/pid/{pid}
-
Full Name + DoB search /api/prisoner/name/{firstName}/{lastName}/{DoB}
-
(admin only) /api/admin/{name_of_location}
-
(warden only) /api/warden/inmates (from JWT, location will be determined)
-
Write Unit Tests
-
General functionality 1. pid search 2. full name search 3. admin search 4. warden search
-
404 testing 1. pid search 2. full name search 3. admin search - location DNE 4. admin search - wrong/non existent JWT 5. warden search - wrong/non existent JWT
-
Write Documentation on API
-
Use Cases
npm install
from project directory- generate "prisoners.json" by running
node generate_prisoners.js
from the project directory - run test by running
npm test
from the project directory - run the server by running
npm start
from the project directory
This public path returns json data about a single prisoner given a PID parameter.
-
URL
/api/prisoner/pid/:pid
-
Method:
GET
-
URL Params
Required:
PID=[integer]
-
Data Params
None
-
Success Response:
- Code: 200
Content:[{ "PID": "1", "firstName": "Dorcas", "lastName": "Kozey", "dob": "2010-04-05", "location": "Philadelphia" }]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Not Found" }
- Code: 404 NOT FOUND
This public path returns json data about a single prisoner given their first name, last name, and date of birth as parameters.
-
URL
/api/prisoner/name/:firstName/:lastName/:dob
-
Method:
GET
-
URL Params
Required:
firstName=[string]
lastName=[string]
dob=[string]
-
Data Params
None
-
Success Response:
- Code: 200
Content:[{ "PID": "1", "firstName": "Dorcas", "lastName": "Kozey", "dob": "2010-04-05", "location": "Philadelphia" }]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Not Found" }
- Code: 404 NOT FOUND
This protected path returns json data about all the prisoners in a single location given the location as a parameter.
-
URL
/api/admin/:location
-
Method:
GET
-
URL Params
Required:
location=[string]
-
Data Params
JWT with
secret=Administrator
-
Success Response:
- Code: 200
Content:[{ "PID": "1", "firstName": "Dorcas", "lastName": "Kozey", "dob": "2010-04-05", "location": "Philadelphia" } { "PID": "2", "firstName": "Test", "lastName": "tester", "dob": "2011-03-04", "location": "Philadelphia" } ...]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Not Found" }
- Code: 404 NOT FOUND
This protected path returns json data about all the prisoners in a single location given the user's location.
-
URL
/api/warden/inmates
-
Method:
GET
-
URL Params
Required:
None
-
Data Params
JWT with
secret=Warden
JWT withlocation=:location
-
Success Response:
- Code: 200
Content:[{ "PID": "1", "firstName": "Dorcas", "lastName": "Kozey", "dob": "2010-04-05", "location": "Philadelphia" } { "PID": "2", "firstName": "Test", "lastName": "tester", "dob": "2011-03-04", "location": "Philadelphia" } ...]
- Code: 200
-
Error Response:
- Code: 404 NOT FOUND
Content:{ error : "Not Found" }
- Code: 404 NOT FOUND