From 2b5f8c67f3dc0a8be417c0d139624acb479099f0 Mon Sep 17 00:00:00 2001 From: Arlo Date: Mon, 25 Mar 2024 10:23:00 +0000 Subject: [PATCH] Add post_user_test --- post_user_test.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 post_user_test.md diff --git a/post_user_test.md b/post_user_test.md new file mode 100644 index 0000000..5eae1b2 --- /dev/null +++ b/post_user_test.md @@ -0,0 +1,42 @@ +# Create Test API Endpoint + +## POST `/api/post_test` + +Post Test Data This API endpoint allows you to post test data, recording the results of a test taken by a user. + +## Request Parameters + +- `testType` - Type of the test ("words", "time", "quote", etc) +- `testLength` - Length of the test in number of items or +- `testTime` - Duration of the test in seconds +- `testSeed` - Seed for generating randomized test content +- `quoteId` - Identifier for a specific quote, if applicable +- `wpm` - Words per minute (typing speed) +- `accuracy` - Accuracy of responses (e.g., percentage) +- `userId` - Identifier of the user taking the test +- `secret` - Secret key for authentication and authorization + +## Responses + +- `200 OK` - The test has been added to the database sucessfully +- `401 UNAUTHORIZED` - The user has not been authenticated correctly +- `500 INTERNAL SERVER ERROR` - There has been a database error when attempting to + +## Example Request + +```bash +curl -X POST "https://example.com/api/post_test" \ + -H "Content-Type: application/json" \ + -d '{ + "testType": "typing", + "testLength": 100, + "testTime": 600, + "testSeed": "random_seed_123", + "quoteId": "quote_456", + "wpm": 65.5, + "accuracy": 98.2, + "userId": "user_789", + "secret": "your_secret_key_here" + }' +``` +