-
Notifications
You must be signed in to change notification settings - Fork 2
API Doc
Chris Dedman-Rollet edited this page Nov 1, 2024
·
2 revisions
This API documentation provides detailed information for our endpoint. Each section outlines the HTTP method, endpoint, a description of the operation, and the required request body, along with example curl commands to demonstrate how to interact with the API (or just use Postman).
-
Endpoint:
POST /register - Description: Registers a new user (select a role between Student and Educator)
-
Request Body:
{ "username": "dev", "email": "dev@csudh.edu", "password": "MyPasssword123", "confirm_password": "MyPasssword123", "role": "student" } -
Example:
curl -X POST http://localhost:4000/register -H "Content-Type: application/json" -d '{ "username": "dev", "email": "dev@csudh.edu", "password": "MyPasssword123", "confirm_password": "MyPasssword123", "role": "student" }'
-
Endpoint:
POST /login - Description: Logs in an existing user.
-
Request Body:
{ "email": "dev@csudh.edu", "password": "MyPasssword123" } -
Example:
curl -X POST http://localhost:4000/login -H "Content-Type: application/json" -d '{ "email": "dev@csudh.edu", "password": "MyPasssword123" }'
-
Endpoint:
DELETE /delete -
Description: Deletes a user by
user_id. -
Request Body:
{ "password": "Password1234", "user_id": "1" } -
Example:
curl -X DELETE http://localhost:4000/delete -H "Content-Type: application/json" -d '{ "password": "Password1234", "user_id": "1" }'
-
Endpoint:
GET /user/:user_id -
Description: Get user by
user_id. -
Example:
curl -X GET http://localhost:4000/user/10