Simple Personality-Test REST API for the Personality Test App built on Java8, Spark Web Framework, ORM Lite, Moshi, and MariaDB
The API receives and returns only JSON application/json
.
Each response JSON body has a status
key which is an integer and a data
key which contains the
data pertaining to that response.
Status value 200
means Success, with the requested information in the data
key.
Status value 500
means that an error occurred, and it will return a string
description of the error under the data
key.
API is hosted at https://perstestapi.iaklabs.ink as the base URL
/questions
Used to fetch a list of simple personality-test questions.
Send a standard GET request to the /questions
endpoint with no payload or body data.
Returns JSON with an array of 20 questions under the data
key
{
"status": 200,
"data": [
{
"id": 1,
"text": "I prefer one-on-one conversations to group activities",
"created_on": "2022-09-26 13:58:06"
},
{
"id": 2,
"text": "I often prefer to express myself in writing",
"created_on": "2022-09-26 13:58:19"
},
{
"id": 3,
"text": "I seem to care about wealth, fame, and status less than my peers",
"created_on": "2022-09-26 13:58:37"
}
]
}
/evaluate
Used to evaluate the user's answers. Accepts input in JSON format. Content-Type has to be application/json
when calling this request with a JSON body.
The incoming JSON Body for the request should be as follows:
{
"answer_count": 5,
"answers": "true;false;true;true;true"
}
where answer_count
is the number of questions that the user answered, and answers
is a
concatenated string of "true" and "false" answers to the questions, separated by a semicolon;
.
Any spaces in the answers
string will be removed.
Returns the result of the analysis.
{
"status": 200,
"data": "Introverted"
}