42
This commit is contained in:
89
docs/api.md
89
docs/api.md
@@ -23,57 +23,48 @@ This document provides detailed information on how to use and implement the APIs
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## API 2
|
## Log In (Recommended)
|
||||||
- Description: This API provides functionality for ABC operations.
|
- Description: This API allows users to log in to their account through the browser.
|
||||||
- Usage: To use this API, follow these steps:
|
- Usage: To use this API, follow these steps:
|
||||||
1. Step 1: Import the API module using `require('api2')`.
|
1. Step 1: Redirect the user to the log-in page using the `/login` route.
|
||||||
2. Step 2: Call the `performABC()` function with the required parameters.
|
2. Step 2: Enter the user's credentials and submit the form.
|
||||||
- Example:
|
3. Step 3: A JSON response will be returned with the user's information.
|
||||||
```javascript
|
- Payload Example:
|
||||||
const api = require('api2');
|
```JSON
|
||||||
|
{
|
||||||
api.performABC(param1, param2);
|
"id": 123,
|
||||||
|
"username": "user123",
|
||||||
|
"email": "rr@ttt.yy",
|
||||||
|
"access_level": 1,
|
||||||
|
"password": "password123"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## API 3
|
## API Sign Up
|
||||||
- Description: This API offers advanced features for DEF operations.
|
- Description: This API allows users to sign up for a new account programmatically.
|
||||||
- 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.
|
|
||||||
- Usage: To use this API, follow these steps:
|
- Usage: To use this API, follow these steps:
|
||||||
1. Step 1: Import the API module using `require('api4')`.
|
1. Step 1: API call to the `/api/signup?username={newUser}&email={Email}&password={Password}` endpoint with the required parameters.
|
||||||
2. Step 2: Call the desired utility functions provided by the API.
|
2. Step 2: The server will create a new user account and return a JSON response.
|
||||||
- Example:
|
- Payload Example:
|
||||||
```javascript
|
```JSON
|
||||||
const api = require('api4');
|
{
|
||||||
|
"status": "success",
|
||||||
api.utilityFunction1();
|
"message": "User created"
|
||||||
api.utilityFunction2();
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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"
|
||||||
|
}
|
||||||
```
|
```
|
Reference in New Issue
Block a user