more documentation
This commit is contained in:
parent
63a8e86313
commit
37656907d3
41
documentation/create_user.md
Normal file
41
documentation/create_user.md
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Create User
|
||||||
|
|
||||||
|
This API provides endpoints for user management, including user signup, login, and accessing user tests.
|
||||||
|
|
||||||
|
## Endpoint Details
|
||||||
|
|
||||||
|
Creates a new user in the database.
|
||||||
|
Endpoint
|
||||||
|
|
||||||
|
```js
|
||||||
|
POST /api/create_user
|
||||||
|
```
|
||||||
|
|
||||||
|
## Request Body
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"username": "example_user",
|
||||||
|
"password": "example_password"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Request
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST "https://example.com/api/create_user" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"username": "example_user", "password": "example_password"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Response
|
||||||
|
|
||||||
|
Upon successful execution, the endpoints return appropriate responses. Errors are logged for any database-related issues.
|
||||||
|
|
||||||
|
Ensure that you handle responses appropriately in your application.
|
||||||
|
|
||||||
|
This documentation provides details on user management endpoints, including signup, login, and accessing user tests.
|
36
documentation/get_user_tests.md
Normal file
36
documentation/get_user_tests.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Get User Tests
|
||||||
|
|
||||||
|
Retrieves tests associated with a specific user from the database.
|
||||||
|
|
||||||
|
## Endpoint
|
||||||
|
|
||||||
|
```js
|
||||||
|
GET /api/get_tests/<user_id>/<secret>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| - | - | - |
|
||||||
|
| user_id | integer | User ID of the user whose tests need to be retrieved |
|
||||||
|
| secret | String | Secret key for authentication |
|
||||||
|
|
||||||
|
## Example Request
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X GET "https://example.com/api/get_tests/123/your_secret_key_here"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Response
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"test_type": "words",
|
||||||
|
"test_length": 100,
|
||||||
|
"test_time": 300,
|
||||||
|
"test_seed": 987654321,
|
||||||
|
"quote_id": 123,
|
||||||
|
"wpm": 65,
|
||||||
|
"accuracy": 98
|
||||||
|
}
|
||||||
|
```
|
@ -1,22 +1,24 @@
|
|||||||
|
# Leaderboard
|
||||||
|
|
||||||
This API endpoint retrieves the highest test data from each user and returns it as a JSON array.
|
This API endpoint retrieves the highest test data from each user and returns it as a JSON array.
|
||||||
|
|
||||||
# Endpoint
|
## Endpoint
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /api/leaderboard
|
GET /api/leaderboard
|
||||||
```
|
```
|
||||||
|
|
||||||
# Request Parameters
|
## Request Parameters
|
||||||
|
|
||||||
This endpoint does not require any request parameters.
|
This endpoint does not require any request parameters.
|
||||||
|
|
||||||
# Example Request
|
## Example Request
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X GET "https://example.com/api/leaderboard"
|
curl -X GET "https://example.com/api/leaderboard"
|
||||||
```
|
```
|
||||||
|
|
||||||
# Response
|
## Response
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
|
31
documentation/login.md
Normal file
31
documentation/login.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Login
|
||||||
|
|
||||||
|
Authenticates a user and returns their user ID along with a secret key.
|
||||||
|
Endpoint
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
GET /api/login/<username>/<password>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| - | - | - |
|
||||||
|
| username | String |Username of the user |
|
||||||
|
| password | String |Password of the user |
|
||||||
|
|
||||||
|
## Example Request
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X GET "https://example.com/api/login/example_user/example_password"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Response
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"user_id": 123,
|
||||||
|
"secret": "random_secret_key"
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user