Closed Inevitabby closed 1 week ago
All endpoints support CRUD actions now, and follow the same organization.
api/<ENDPOINT>
api/<ENDPOINT>/<ID>
Also, fixed the dynamic routing for incidents (first made in PR #14)
TODO: Validate inputs to ensure they follow specifications.
$ curl -X GET http://localhost:3000/api/callers [ { "caller_ID": 1, "first_name": "Billy", "last_name": "Joe", "address": "3801 W Temple Ave, Pomona, CA 91768", "phone_number": "1234567890" } ] $ curl -X GET http://localhost:3000/api/assignments [ { "assignment_ID": 1, "incident_ID": 1, "unit_number": 101, "unit_type": "Police", "backup_needed": 0, "status": "Completed" } ] $ curl -X GET http://localhost:3000/api/dispatchPersonnel [ { "personnel_ID": 1, "first_name": "Joe", "last_name": "Smith" } ] $ curl -X GET http://localhost:3000/api/incidents [ { "incident_ID": 1, "caller_ID": 1, "personnel_ID": 1, "address": "123 Oak Blvd, Irvine", "priority": "Medium", "status": "In Progress", "description": "Large fire...", "created_at": "2024-11-13T22:30:00.000Z" } ]
$ curl -X GET http://localhost:3000/api/incidents [ { "incident_ID": 1, "caller_ID": 1, "personnel_ID": 1, "address": "123 Oak Blvd, Irvine", "priority": "Medium", "status": "In Progress", "description": "Large fire...", "created_at": "2024-11-13T22:30:00.000Z" } ] $ curl -X POST http://localhost:3000/api/incidents \ -H "Content-Type: application/json" \ -d '{ "caller_ID": 1, "personnel_ID": 1, "address": "456 Elm St, Springfield, IL", "priority": "Low", "description": "Parking violation" }' { "message": "Incident created", "id": 5 } $ curl -X GET http://localhost:3000/api/incidents [ { "incident_ID": 1, "caller_ID": 1, "personnel_ID": 1, "address": "123 Oak Blvd, Irvine", "priority": "Medium", "status": "In Progress", "description": "Large fire...", "created_at": "2024-11-13T22:30:00.000Z" }, { "incident_ID": 2, "caller_ID": 1, "personnel_ID": 1, "address": "456 Elm St, Springfield, IL", "priority": "Low", "status": "Pending", "description": "Parking violation", "created_at": "2024-11-21T04:35:43.000Z" } ]
Great work + documentation!
All endpoints support CRUD actions now, and follow the same organization.
api/<ENDPOINT>
to list every entry.api/<ENDPOINT>
to create a new entry.api/<ENDPOINT>/<ID>
to delete a new entry.api/<ENDPOINT>/<ID>
to update an existing entry.TODO: Validate inputs to ensure they follow specifications.
Some Example Calls
Example I: Listing Entries:
Example II: Creation