Help / API Reference

Authentication

All calls to the FlexiQuiz API require your account API key to be passed within the request header X-API-KEY.

An API key for the account can be generated within the Settings screen by the user who originally created your FlexiQuiz account.

For more details please review our API overview

Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Error codes

FlexiQuiz returns standard HTTP error codes.

Code Description
200 OK
400 Bad Request
403 Forbidden
403.4 SSL required
404 Not Found
422 Unprocessable Entity
429 Exceeded request rate limit
500 Internal Server Error

Rate limits

FlexiQuiz limits the number of API requests that you can make for an API Key per minute and hour.

If the rate limit is exceeded then a code of 429: Exceeded request rate limit will be returned

Period Limit
Minute 25
Hour 150

Dates

All dates are returned using the UTC timezone and in the format yyyy-MM-dd hh:mm:ss

Example Date

2018-10-21 08:06:59

Get all quizzes

Returns a list of all quizzes in the account

The status element will be: in_design, open, closed

GET /v1/quizzes


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

[
    {
        "quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
        "name": "Aptitude",
        "status": "open"
    },
    {
        "quiz_id": "ef403ba9-e6ee-4cc6-a921-12ef135a7b3b",
        "name": "Numerical reasoning",
        "status": "in_design"
    }
]
                            
                        

Get a quiz

Returns a single quiz

The status element will be: in_design, open, closed

GET /v1/quizzes/{quiz_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

{
    "quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
    "name": "Aptitude",
    "status": "open"
}
                            
                        

Update a quiz

Updates the name and status of the specified quiz. When calling you can just include any fields you would like updated.

The example will change the status of the quiz to closed and leave the name unchanged.


Parameters

name (optional)

status (optional): the quiz status can be changed to open or closed

POST /v1/quizzes/{quiz_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -d status="closed" 

Example Response

{
    "message": "200: OK"
}
                            
                        

Delete a quiz

Deletes the specified quiz.

DELETE /v1/quizzes/{quiz_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -X DELETE 

Example Response

{
    "message": "200: OK"
}
                            
                        

Get all responses

Returns a list of all responses to a quiz.

status can be not_started not_submitted or submitted, percentage score 0-100, publish type, certificate_url and response_report_url, duration is in seconds

GET /v1/quizzes/{quiz_id}/responses


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

[
    {
        "response_id": "bf1dd7b8-a908-45bf-bd98-e62831de921a",
        "quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
        "quiz_name": "Aptitude",
        "first_name": "Jane",
        "last_name": "Jones",
        "email_address": "jane@flexiquiz.com",
        "user_id": null,
        "user_name": null,
        "date_submitted": "2018-10-18 08:36:45",
        "points": 84,
        "available_points": 84.00,
        "percentage_score": 100,
        "grade": "A",
        "pass": true,
        "duration": 625,
        "attempt": 1,
        "ip_address": "::1",
        "status": "submitted",
        "publish_type": "quiz_link",
        "certificate_url": "not_in_use",
        "response_report_url": "not_in_use",
        "registration_fields": [
            {
                "name": "First name",
                "value": "Jane"
            },
            {
                "name": "Last name",
                "value": "Jones"
            },
            {
                "name": "Email address",
                "value": "jane@flexiquiz.com"
            },
            {
                "name": "Office",
                "value": "New York"
            }
        ]
    },
    {
        "response_id": "3f8acd60-cbef-4e98-a0cd-0a10302dcd40",
        "quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
        "quiz_name": "Aptitude",
        "first_name": "Henry",
        "last_name": "Patterson",
        "email_address": "henry@flexiquiz.com",                                                       
        "user_id": "cee9808d-b234-4a8d-8526-8fea6c335056",
        "user_name": "henry@flexiquiz.com",
        "date_submitted": "2018-10-21 08:06:59",
        "points": 70,
        "available_points": 84.00,
        "percentage_score": 83,
        "grade": "B",
        "pass": true,
        "duration": 547,
        "attempt": 2,
        "ip_address": "::1",
        "status": "submitted",
        "publish_type": "assigned_user",
        "certificate_url": "not_in_use",
        "response_report_url": "not_in_use",
        "registration_fields": [ ]
    }
]
                        

Get a response

Returns a single response.

status, percentage score 0-100, publish type, certificate_url and response_report_url, duration is in seconds

GET /v1/quizzes/{quiz_id}/responses/{response_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

{
    "response_id": "bf1dd7b8-a908-45bf-bd98-e62831de921a",
    "quiz_id": "b96ad67c-34c9-4bce-bb2c-076f2619dacd",
    "quiz_name": "Aptitude",
    "first_name": "Jane",
    "last_name": "Jones",
    "email_address": "jane@flexiquiz.com",
    "user_id": null,
    "user_name": null,
    "date_submitted": "2018-10-18 08:36:45",
    "points": 84,
    "available_points": 84.00,
    "percentage_score": 100,
    "grade": "A",
    "pass": true,
    "duration": 625,
    "attempt": 1,
    "ip_address": "::1",
    "status": "submitted",
    "publish_type": "quiz_link",
    "certificate_url": "not_in_use",
    "response_report_url": "not_in_use",
    "registration_fields": [
        {
            "name": "First name",
            "value": "Jane"
        },
        {
            "name": "Last name",
            "value": "Jones"
        },
        {
            "name": "Email address",
            "value": "jane@flexiquiz.com"
        },
        {
            "name": "Office",
            "value": "New York"
        }
    ]
}

                        

Delete a response

Deletes the specified response.

DELETE /v1/quizzes/{quiz_id}/responses/{response_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/quizzes/b96ad67c-34c9-4bce-bb2c-076f2619dacd/responses/bf1dd7b8-a908-45bf-bd98-e62831de921a -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" -X DELETE 

Example Response

{
    "message": "200: OK"
}
                            
                        

Get all users

Returns a list of all users in the account.

GET /v1/users


Example Request

$ curl https://www.flexiquiz.com/api/v1/users -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

[
  {
    "user_id": "06e3244f-1381-4da4-aa75-996981b42edb",
    "user_name": "jemma@flexiquiz.com",
    "user_type": "respondent",
    "email_address": "jemma@flexiquiz.com",
    "first_name": "Jemma",
    "last_name": "Patrick",
    "time_zone": "Mountain Standard Time",
    "suspended": false,
    "manage_users": false,
    "manage_groups": false,
    "edit_quizzes": false,
    "quizzes": [
        {
            "quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
            "name": "Economics",
            "date_assigned": "2018-10-06 12:15:25"
        },
        {
            "quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
            "name": "Geography",
            "date_assigned": "2018-10-06 12:15:25"
        }
    ],
    "groups": [ ],
    "trainerquizzes": [ ],
    "trainergroups": [ ],
    "date_created": "2018-10-20 10:06:59"
  }
]
                            
                        

Get a user

Returns a user.

GET /v1/users/{user_id}


Example Request

$ curl https://www.flexiquiz.com/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb -H "X-API-KEY: fcb7f59c-2a4f-44a9-8281-34cbfd97be99" 

Example Response

{
    "user_id": "06e3244f-1381-4da4-aa75-996981b42edb",
    "user_name": "jemma@flexiquiz.com",
    "user_type": "respondent",
    "email_address": "jemma@flexiquiz.com",
    "first_name": "Jemma",
    "last_name": "Patrick",
    "time_zone": "Mountain Standard Time",
    "suspended": false,
    "manage_users": false,
    "manage_groups": false,
    "edit_quizzes": false,
    "quizzes": [
        {
            "quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
            "name": "Economics",
            "date_assigned": "2018-10-06 12:15:25"
        },
        {
            "quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
            "name": "Geography",
            "date_assigned": "2018-10-06 12:15:25"
        }
    ],
    "groups": [ ],
    "trainerquizzes": [ ],
    "trainergroups": [ ],
    "date_created": "2018-10-20 10:06:59"
}
                            
                        

Create a user

Creates a new user.

Parameters

user_name Unique name that user will use to login. This can also be an email address.
password Password to login with. The password must be a minimum of 6 characters.
user_type The type of user. Values can be respondent, trainer or administrator.
email_address The users email address.
first_name The users first name.
last_name The users last name.
suspended If set to true the user will not be able to login.
manage_users Only applicable for trainer and administrator user types
manage_groups Only applicable for trainer and administrator user types
edit_quizzes Only applicable for trainer and administrator user types
send_welcome_email If set to true will send a welcome email to the user with the userame and password. The username must be an email address or the email_address should be set.

Returns

Returns the user_id of the new user.

POST /v1/users


Example Request

$ curl http://localhost:49205/api/v1/users -H "X-API-KEY:  fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d user_name="jeff2@flexiquiz.com" -d password="Abdf1245*" -d user_type="respondent" -d email_address="jeff@flexiquiz.com" -d first_name="Jeff" -d last_name="Brady" -d suspended=false -d manage_users=false -d manage_groups=false -d edit_quizzes=false -d send_welcome_email=true 
                        

Example Response

{
    "user_id": "488cfc9e-dac5-41a6-b71a-1829ca4143f9"
}
                            
                        

Update a user

Updates a new user.

Parameters

All parameters are optional and only included parameters will be updated.

user_name Unique name that user will use to login. This can also be an email address.
password Password to login with. The password must be a minimum of 6 characters.
user_type The type of user. Values can be respondent, trainer or administrator.
email_address The users email address.
first_name The users first name.
last_name The users last name.
suspended If set to true the user will not be able to login.
manage_users Only applicable for trainer and administrator user types
manage_groups Only applicable for trainer and administrator user types
edit_quizzes Only applicable for trainer and administrator user types

POST /v1/users/{user_id}


Example Request

$ curl http://localhost:49205/api/v1/users/488cfc9e-dac5-41a6-b71a-1829ca4143f9 -H "X-API-KEY:  fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d suspended=true 
                        

Example Response

{                                                       
    "message": "200: OK"
}
                            
                        

Delete a user

Deletes a user.

DELETE /v1/users/{user_id}


Example Request

$ curl http://localhost:49205/api/v1/users/488cfc9e-dac5-41a6-b71a-1829ca4143f9 -H "X-API-KEY:  fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -X DELETE 
                        

Example Response

{                                                       
    "message": "200: OK"
}
                            
                        

Get assigned quizzes

Gets a list of all quizzes assigned to a user

GET /v1/users/{user_id}/quizzes


Example Request

$ curl http://localhost:49205/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/quizzes -H "X-API-KEY:  fcb5f59c-2a2f-44a9-8261-33cbfa97be99" 
                        

Example Response

[
    {
        "quiz_id": "fcb5f59c-2a2f-44a9-8261-33cbfa97be99",
        "name": "Economics",
        "date_assigned": "2018-10-06 12:15:25"
    },
    {
        "quiz_id": "563db846-0eb4-4b9c-a2ca-21132874275d",
        "name": "Geography",
        "date_assigned": "2018-10-06 12:15:25"
    }
]
                            
                        

Assign a quiz

Assigns a quiz to a user

POST /v1/users/{user_id}/quizzes


Example Request

$ curl http://localhost:49205/api/v1/users/06e3244f-1381-4da4-aa75-996981b42edb/quizzes -H "X-API-KEY:  fcb5f59c-2a2f-44a9-8261-33cbfa97be99" -d quiz_id="1153af46-9580-4672-af78-f23ce2577a14"
                        

Example Response

{                                                       
    "message": "200: OK"
}