Skip to content

Latest commit

 

History

History
33 lines (30 loc) · 18.4 KB

api.md

File metadata and controls

33 lines (30 loc) · 18.4 KB

her future coalition (backend)

This is the backend for the Her Future Coalition Web Application. It is a RESTful API built with Node.js and Express.js. It uses MongoDB as its database.

API Endpoints

HTTP Method Name Description Parameters Responses
POST /beneficiary Create a beneficiary. Called upon at beneficiary registration ...all beneficiary fields [201] Successful beneficiary creation.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[500] Internal server error.
GET /beneficiary/?id={beneficiaryID}&idNum={idNum} Get a single beneficiary (or all beneficiaries). If no parameters are given, returns all beneficiaries. beneficiaryId (Object ID) - The MongoDB-generated UUID (_id) attached to the target beneficiary.

...all new beneficiary fields.

idNum is the id number that we manually create and assign to a beneficiary
[200] - Successful beneficiary retrieval.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - beneficiary not found.
[500] Internal server error.
PUT /beneficiary/{beneficiaryID} Update the beneficiary with the given ID. beneficiaryId (Object ID) - The MongoDB-generated UUID (_id) attached to the target beneficiary.

...all new beneficiary fields.
[200] - Successful beneficiary update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - beneficiary not found.
[500] Internal server error.
PUT /beneficiary/{beneficiaryID}/archive Mark a beneficiary as archived beneficiaryId (Object ID) - The MongoDB-generated UUID (_id) attached to the target beneficiary.

...all new beneficiary fields.
[200] - Successful beneficiary update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - beneficiary not found.
[500] Internal server error.
PUT /beneficiary/{beneficiaryID}/unarchive Mark a beneficiary as unarchived beneficiaryId (Object ID) - The MongoDB-generated UUID (_id) attached to the target beneficiary.

...all new beneficiary fields.
[200] - Successful beneficiary update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - beneficiary not found.
[500] Internal server error.
DELETE /beneficiary/{beneficiaryId} Delete a beneficiary. beneficiaryId (Object ID) - The MongoDB-generated UUID (_id) attached to the target beneficiary. [200] - Successful beneficiary deletion.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - beneficiary not found.
[500] Internal server error.
POST /program Create a new program. Utilized in in the "Create new program" portion of the programs page. ...all program fields p [201] - Successful program creation.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[500] Internal server error.
GET /program/?id={programId} Get a single program (or all of the programs) If no ID is given, returns all programs. id (Object ID) - The MongoDB-generated UUID (_id) attached to the target program. [200] - Successful program retrieval.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
PUT /program/{programId} Access and edit fields for a program. programId (Object ID) - The MongoDB-generated UUID (_id) attached to the target program.

...all new program fields.
[200] - Successful program update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
PATCH /program/{programId}/archive Gives archive ability for a specific program programId (Object ID) - The MongoDB-generated UUID (_id) attached to the target program.

...all new program fields.
[200] - Successful program update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
PUT /program/{programId}/attendance Gives access to attendance field for a specific program to edit programId (Object ID) - The MongoDB-generated UUID (_id) attached to the target program.

...all new program fields.
[200] - Successful program update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
DELETE /program/{programId} Delete a program. Called when the delete button is clicked for a single program. Different from archiving a program. programId (Object ID) - The MongoDB-generated UUID (_id) attached to the target program. [200] - Successful program deletion.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
POST /workshop Create a workshop. Called when new workshops should be added to the database. ...all workshop fields [201] - Successful workshop creation.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[500] Internal server error.
GET /workshop/?id={workshopId} Get a single workshop (or all workshop). If no ID is given, returns all workshops. workshopId (Object ID) - The MongoDB-generated UUID (_id) attached to the target workshop. (optional) [200] - Successful workshop retrieval.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - Workshop not found.
[500] Internal server error.
PUT /workshop/{workshopId} Edit fields for a workshop workshopId (Object ID) - The MongoDB-generated UUID (_id) attached to the target workshop.

...all new workshop feilds.
[200] - Successful workshop update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - Workshop not found.
[500] Internal server error.
PATCH /workshop/{workshopId}/archive Gives archive ability for a specific program workshopId (Object ID) - The MongoDB-generated UUID (_id) attached to the target program.

...all new program fields.
[200] - Successful program update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - program not found.
[500] Internal server error.
DELETE /workshop/{workshopId} Delete a workshop. workshopId (Object ID) - The MongoDB-generated UUID (_id) attached to the target workshop. [200] - Successful workshop deletion.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - Workshop not found.
[500] Internal server error.
POST /user Create a user. Called when new user should be added to the database. ...all user fields [201] - Successful user creation.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[500] Internal server error.
GET /user/?id={userId} Get a single user (or all users). If no ID is given, returns all users. userId (Object ID) - The MongoDB-generated UUID (_id) attached to the target user. (optional) [200] - Successful workshop retrieval.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - User not found.
[500] Internal server error.
PUT /user/{userId} Edit fields for a workshop userId (Object ID) - The MongoDB-generated UUID (_id) attached to the target workshop.

...all new workshop feilds.
[200] - Successful user update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - Workshop not found.
[500] Internal server error.
DELETE /user/{userId} Delete a user. userId (Object ID) - The MongoDB-generated UUID (_id) attached to the target user. [200] - Successful user deletion.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - User not found.
[500] Internal server error.
POST /assessment Create an assessment. Called when new assessment should be added to the database. ...all assessment fields [201] - Successful assessment creation.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[500] Internal server error.
GET /assessment/?id={assessmentId} Get a single assessment (or all assessments). If no ID is given, returns all assessments. assessmentId (Object ID) - The MongoDB-generated UUID (_id) attached to the target workshop. (optional) [200] - Successful assessment retrieval.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - Assessment not found.
[500] Internal server error.
PUT /assessment/{assessmentId} Edit fields for an assessment assessmentId (Object ID) - The MongoDB-generated UUID (_id) attached to the target assessment.

...all new assessment feilds.
[200] - Successful assessment update.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - assessment not found.
[500] Internal server error.
DELETE /assessment/{assessmentId} Delete an assessment. assessmentId (Object ID) - The MongoDB-generated UUID (_id) attached to the target assessment. [200] - Successful assessment deletion.
[400] Bad request.
[401] Unauthorized. idk who u r.
[403] Forbidden. ik who u r...nice try ;).
[404] - assessment not found.
[500] Internal server error.