diff --git a/documentation/create_user.md b/documentation/create_user.md new file mode 100644 index 0000000..f18210d --- /dev/null +++ b/documentation/create_user.md @@ -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. \ No newline at end of file diff --git a/documentation/get_user_tests.md b/documentation/get_user_tests.md new file mode 100644 index 0000000..36d1677 --- /dev/null +++ b/documentation/get_user_tests.md @@ -0,0 +1,36 @@ +# Get User Tests + +Retrieves tests associated with a specific user from the database. + +## Endpoint + +```js +GET /api/get_tests// +``` + +## 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 +} +``` \ No newline at end of file diff --git a/documentation/leaderboard.md b/documentation/leaderboard.md index 4fb4974..0ebc29b 100644 --- a/documentation/leaderboard.md +++ b/documentation/leaderboard.md @@ -1,22 +1,24 @@ +# Leaderboard + This API endpoint retrieves the highest test data from each user and returns it as a JSON array. -# Endpoint +## Endpoint ``` GET /api/leaderboard ``` -# Request Parameters +## Request Parameters This endpoint does not require any request parameters. -# Example Request +## Example Request ```bash curl -X GET "https://example.com/api/leaderboard" ``` -# Response +## Response ```json [ diff --git a/documentation/login.md b/documentation/login.md new file mode 100644 index 0000000..17e66d7 --- /dev/null +++ b/documentation/login.md @@ -0,0 +1,31 @@ +# Login + +Authenticates a user and returns their user ID along with a secret key. +Endpoint + + +```js +GET /api/login// +``` + +## 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" +} +``` \ No newline at end of file