Browse: Home / REST API Routes v1 /

Questions

Schema #

The schema defines all the fields that exist within a question record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.

_id
integer

Unique identifier for the object.

Read only

Context: view, edit, embed

_quizId
integer

The ID of the quiz associated with the question.

Read only

Context: view, edit, embed

_sort
integer

The order of the question in the quiz

Context: view, edit

_title
string

The title for the object.

Context: view, edit

_question
string

The question content

Context: view, edit

_correctMsg
string

The message to show when the answer is correct.

Context: view, edit

_incorrectMsg
string

The message to show when the answer is incorrect.

Context: view, edit

_correctSameText
boolean

Whether the incorrect and correct message are same.

Context: view, edit

_tipEnabled
boolean

The message to show when the answer is incorrect.

Context: view, edit

_tipMsg
string

The solution hint for the question.

Context: view, edit

_points
boolean

The total number of points that can be obtained from the question

Context: view, edit

_showPointsInBox
boolean

Whether to show points in box.

Context: view, edit

_answerPointsActivated
boolean

Whether the individual points for the answers are activated.

Context: view, edit

_answerType
string

The type of the answer.

Context: view, edit

One of: single, multiple, free_answer, sort_answer, matrix_sort_answer, cloze_answer, essay, assessment_answer

_answerPointsDiffModusActivated
boolean, null

Whether the different points modus is activated.

Context: view, edit

_disableCorrect
boolean

Whether to distinguish between correct and incorrect when the different point modus is activated.

Context: view, edit

_matrixSortAnswerCriteriaWidth
integer

The percentage width of the criteria table column for matrix sort answer.

Context: view, edit

_answerData
array

An array of answer data objects

Context: view, edit

question_id
integer

The question post ID.

Read only

Context: view, edit, embed

question_post_title
string

The question post title.

Context: view, edit

Retrieve a Question #

Definition & Example Request #

GET /ldlms/v1/sfwd-questions/<id>

Query this endpoint to retrieve a specific question record.

$ curl https://example.com/wp-json/ldlms/v1/sfwd-questions/<id>

Sample Response #

{
    "_id": 429,
    "_quizId": 46,
    "_sort": 1,
    "_title": "Question: 1",
    "_question": "In this video Fein states at 1:34 <em>"We often relate to the body as an instrument that helps bring what's happening in our minds into the world, and often this relationship is ______." </em>",
    "_correctMsg": "Nice job.",
    "_incorrectMsg": "See the correct answer highlighted in green above.",
    "_correctSameText": false,
    "_tipEnabled": false,
    "_tipMsg": "",
    "_points": 1,
    "_showPointsInBox": false,
    "_answerPointsActivated": false,
    "_answerType": "single",
    "_answerPointsDiffModusActivated": null,
    "_disableCorrect": false,
    "_matrixSortAnswerCriteriaWidth": 20,
    "_answerData": [
        {
            "_answer": "a. Painful",
            "_html": false,
            "_points": 0,
            "_correct": false,
            "_sortString": "",
            "_sortStringHtml": false,
            "_graded": false,
            "_gradingProgression": "not-graded-none",
            "_gradedType": null
        },
        {
            "_answer": "b. Problematic",
            "_html": false,
            "_points": 0,
            "_correct": false,
            "_sortString": "",
            "_sortStringHtml": false,
            "_graded": false,
            "_gradingProgression": "not-graded-none",
            "_gradedType": null
        },
        {
            "_answer": "c. Superficial",
            "_html": false,
            "_points": 0,
            "_correct": true,
            "_sortString": "",
            "_sortStringHtml": false,
            "_graded": false,
            "_gradingProgression": "not-graded-none",
            "_gradedType": null
        },
        {
            "_answer": "d. Stupid",
            "_html": false,
            "_points": 0,
            "_correct": false,
            "_sortString": "",
            "_sortStringHtml": false,
            "_graded": false,
            "_gradingProgression": "not-graded-none",
            "_gradedType": null
        }
    ],
    "question_id": 82968,
    "question_post_title": "Question: 1"
}

Arguments #

id

The question ID

Required: 1

Update a Question #

Arguments #

id

The question ID

Required: 1

Definition #

POST /ldlms/v1/sfwd-questions/<id>

Example Request #

$ curl -X POST https://example.com/wp-json/ldlms/v1/sfwd-questions/<id> -d '{"_title":"Question title"}'

Delete a Question #

Arguments #

id

The question ID

Required: 1

Definition #

DELETE /ldlms/v1/sfwd-questions/<id>

Example Request #

$ curl -X DELETE https://example.com/wp-json/ldlms/v1/sfwd-questions/<id>