diff --git a/docs/api.md b/docs/api.md index 5e846f5..cff9eef 100644 --- a/docs/api.md +++ b/docs/api.md @@ -23,57 +23,48 @@ This document provides detailed information on how to use and implement the APIs } ``` -## API 2 -- Description: This API provides functionality for ABC operations. +## Log In (Recommended) +- Description: This API allows users to log in to their account through the browser. - Usage: To use this API, follow these steps: - 1. Step 1: Import the API module using `require('api2')`. - 2. Step 2: Call the `performABC()` function with the required parameters. -- Example: - ```javascript - const api = require('api2'); - - api.performABC(param1, param2); + 1. Step 1: Redirect the user to the log-in page using the `/login` route. + 2. Step 2: Enter the user's credentials and submit the form. + 3. Step 3: A JSON response will be returned with the user's information. +- Payload Example: + ```JSON + { + "id": 123, + "username": "user123", + "email": "rr@ttt.yy", + "access_level": 1, + "password": "password123" + } ``` -## API 3 -- Description: This API offers advanced features for DEF operations. -- Sub-APIs: - - Sub-API 3.1: Provides additional functionality for DEF operations. - - Sub-API 3.2: Implements advanced algorithms for DEF operations. - -### Sub-API 3.1 -- Description: This sub-API extends the functionality of API 3 for DEF operations. -- Usage: To use this sub-API, follow these steps: - 1. Step 1: Import the sub-API module using `require('api3/subapi1')`. - 2. Step 2: Call the `performDEF()` function with the required parameters. -- Example: - ```javascript - const subapi = require('api3/subapi1'); - - subapi.performDEF(param1, param2); - ``` - -### Sub-API 3.2 -- Description: This sub-API implements advanced algorithms for DEF operations. -- Usage: To use this sub-API, follow these steps: - 1. Step 1: Import the sub-API module using `require('api3/subapi2')`. - 2. Step 2: Call the `performAdvancedDEF()` function with the required parameters. -- Example: - ```javascript - const subapi = require('api3/subapi2'); - - subapi.performAdvancedDEF(param1, param2); - ``` - -## API 4 -- Description: This API provides utility functions for GHI operations. +## API Sign Up +- Description: This API allows users to sign up for a new account programmatically. - Usage: To use this API, follow these steps: - 1. Step 1: Import the API module using `require('api4')`. - 2. Step 2: Call the desired utility functions provided by the API. -- Example: - ```javascript - const api = require('api4'); - - api.utilityFunction1(); - api.utilityFunction2(); + 1. Step 1: API call to the `/api/signup?username={newUser}&email={Email}&password={Password}` endpoint with the required parameters. + 2. Step 2: The server will create a new user account and return a JSON response. +- Payload Example: + ```JSON + { + "status": "success", + "message": "User created" + } ``` + +## API Log In +- Description: This API allows users to log in to their account programmatically. +- Usage: To use this API, follow these steps: + 1. Step 1: API call to the `/api/login?username={user}&password={password}` endpoint with the required parameters. + 2. Step 3: The server will authenticate the user and return a JSON response. +- Payload Example: + ```JSON + { + "id": 123, + "username": "user123", + "email": "rr@ttt.yy", + "access_level": 1, + "password": "password123" + } + ``` \ No newline at end of file