Skip to content

Personality Test App API built on Java8, Spark, ORMLite, Moshi and MariaDB. Check README.md for documentation

Notifications You must be signed in to change notification settings

fourthperson/personality_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Personality Test API

Simple Personality-Test REST API for the Personality Test App built on Java8, Spark Web Framework, ORM Lite, Moshi, and MariaDB

Introduction

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.

Demo

API is hosted at https://perstestapi.iaklabs.ink as the base URL

Routes

Questions (GET)

/questions

Used to fetch a list of simple personality-test questions.

Request

Send a standard GET request to the /questions endpoint with no payload or body data.

Response

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 (POST)

/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.

Request

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.

Response

Returns the result of the analysis.


{
    "status": 200,
    "data": "Introverted"
}

About

Personality Test App API built on Java8, Spark, ORMLite, Moshi and MariaDB. Check README.md for documentation

Topics

Resources

Stars

Watchers

Forks

Languages