CaPPr Big5 API

This document describes how to use the CaPPr Big5 API. For general information about how to use the API, please consult the general API documentation.

Account

Get account information.

Method

GET

URL

/account

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -X GET https://api.cappr.org/account

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
429 Too many requests

Response properties

title (string)

Account title.

language (string)

Account language.

email (boolean)

Shows if email address needs to be provided when creating a session.

password (boolean)

Shows if password needs to be provided when creating a session.

subject (boolean)

Shows if subject needs to be provided when creating a session.

position (boolean)

Shows if position needs to be provided when creating a session.

test (boolean)

Shows if a test round is presented during flow.

report (string)

Account report type.

set (object)

Set (flow) information.

positions (array)

List of possible positions.

Example responses

200

{
    "title": "Account",
    "language": "en",
    "email": true,
    "password": false,
    "subject": false,
    "position": true,
    "test": true,
    "report": "score",
    "set": {
        "description": "Big 5",
        "algorithm": "big5",
        "polarity": "bipolar",
        "image": true,
        "caption": true
    },
    "positions": [
        {
            "id": 1,
            "description": "Position 1"
        },
        {
            "id": 2,
            "description": "Position 2"
        },
        ...
    ]
}

Session

Create a session.

Method

POST

URL

/session

Data parameters

email (string)

User email address. Only needed when account response email value is true.

password (string)

Password. Only needed when account response password value is true.

subject (string)

Desciption of object. Only needed when account response subject value is true.

position (int)

ID of position. Only needed when account response position value is true.

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -F "email=info@company.com"
    -X POST https://api.cappr.org/session

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
406 Invalid information provided
429 Too many requests

Response properties

uid (string)

Session UID.

email (string)

Stored email address.

errors (array)

List of errors, can contain:

Value Description
ACCOUNT_EXPIRED Account has expired
ACCOUNT_LIMIT Account session limit is reached
EMAIL_INCORRECT Email address is empty or format is incorrect
PASSWORD_EXPIRED Provided password has expired
PASSWORD_INCORRECT Provided password is incorrect
PASSWORD_LIMIT Limit for provided is reached

Example responses

200

{
    "uid": "a99QIOYlv4pqcQwI",
    "email": "info@company.com"
}

406

{
    "errors": [
        "EMAIL_INCORRECT"
    ]
}

Question

Get the current question or generate a new one.

Method

GET

URL

/session/:uid/question

URL parameters

uid (string, required)

Session UID.

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -X GET https://api.cappr.org/session/a99QIOYlv4pqcQwI/question

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
429 Too many requests

Response properties

id (int)

Question ID.

progress (int)

Contains the current test round (1 to 5, 0 for test round).

done (boolean)

Indicates if flow is done.

cards (array)

Collection of cards. bipolar sets contain two cards, unipolar sets only one. Questions can contain an image and/or a caption property. To determine if your current set has one or more of these fields consult the set information in the account response.

Example responses

200

{
    "id": 1,
    "progress": 0,
    "done": false,
    "cards": [
        {
            "id": 1,
            "display": {
                "image": "https://ftp.cappr.org/cards/1.jpg",
                "caption": "Books"
            }
        },
        {
            "id": 2,
            "display": {
                "image": "https://ftp.cappr.org/cards/2.jpg",
                "caption": "Casino"
            }
        }
    ]
}

Answer

Answer a question.

Method

POST

URL

/session/:uid/answer

URL parameters

uid (string, required)

Session UID.

Data parameters

question_id (int, required)

ID of question to be answered.

answer (int, required)

For sets with polariy unipolar this must be 0 (no) or 1 (yes), for bipolar sets this must be the Card ID of the chosen card.

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -F "question_id=1"
    -F "answer=2"
    -X POST https://api.cappr.org/session/a99QIOYlv4pqcQwI/answer

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
429 Too many requests

Response properties

question_id (int)

Given question ID.

answer (int)

Given answer.

Example responses

200

{
    "question_id": 1,
    "answer": "2"
}

Report

Get the flow outcome report. To determine your report type consult the account response.

Method

GET

URL

/session/:uid/report

URL parameters

uid (string, required)

Session UID.

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -X GET https://api.cappr.org/session/a99QIOYlv4pqcQwI/report

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
406 Invalid information provided
429 Too many requests

Response properties

Report responses differ per report type and are mostly self explanatory.

Example responses

200

{
    "o": 4.67,
    "c": 2.4,
    "e": 4.1,
    "a": 3.75,
    "n": 4.67
}

Match

Calculate the match between session and input.

Method

GET

URL

/session/:uid/match?o=:o&c=:c&e=:e&a=:a&n=:n

URL parameters

uid (string, required)

Session UID.

o (float, required)

Big5 OCEAN's 'O' score (min. 1, max. 5).

c (float, required)

Big5 OCEAN's 'C' score (min. 1, max. 5).

e (float, required)

Big5 OCEAN's 'E' score (min. 1, max. 5).

a (float, required)

Big5 OCEAN's 'A' score (min. 1, max. 5).

n (float, required)

Big5 OCEAN's 'N' score (min. 1, max. 5).

Example request

curl
    -H "Content-Type: multipart/form-data"
    -H "Authorization: Basic ZnJlZDpmcmVk"
    -X GET https://api.cappr.org/session/a99QIOYlv4pqcQwI/match?o=1&c=1.2&e=4.8&a=1.1&n=1.7

Response codes

Value Description
200 OK
400 Invalid request
401 Authentication error
406 Invalid information provided
429 Too many requests

Response properties

session (object)

Session score.

input (object)

Input score.

match (int)

Match percentage.

Example responses

200

{
    "session": {
        "o": 1,
        "c": 1,
        "e": 1,
        "a": 1,
        "n": 1
    },
    "input": {
        "o": 1,
        "c": 1.2,
        "e": 4.8,
        "a": 1.1,
        "n": 1.7
    },
    "match": 81
}