Page:
post_user_test
1
post_user_test
Arlo edited this page 2024-03-25 10:23:00 +00:00
Table of Contents
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 ortestTime
- Duration of the test in secondstestSeed
- Seed for generating randomized test contentquoteId
- Identifier for a specific quote, if applicablewpm
- Words per minute (typing speed)accuracy
- Accuracy of responses (e.g., percentage)userId
- Identifier of the user taking the testsecret
- Secret key for authentication and authorization
Responses
200 OK
- The test has been added to the database sucessfully401 UNAUTHORIZED
- The user has not been authenticated correctly500 INTERNAL SERVER ERROR
- There has been a database error when attempting to
Example Request
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"
}'