1 post_user_test
Arlo edited this page 2024-03-25 10:23:00 +00:00

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

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" 
	}'