List

Resource: /api/v2/assessment_questions

HTTPS Request Method: GET

Description: A list of assessment questions that match the specified parameters. If no optional parameters are specified, the full list of assessment questions associated with the account is returned.

Results are limited to 5000 records.

Required Parameters:

  • api_key
  • Either course[code], course[id] or assessment[id]

Optional Parameters:

The following optional parameters must be within the assessment_question key:

  • assessment_question_section_id
  • position
  • question_type
  • weight
  • is_random_choices
  • body
  • feedback
  • created_at
  • updated_at
  • feedback_on_invalid_answer
  • grading_instructions
  • rank_details
  • multiple_choice_text_option
  • is_optional

Dates and datetimes should be in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format and can be given as ranges if separated by a comma.

The following optional parameters should be outside of the assessment_question key:

  • per_page (allows ability to set number of results per page)
  • page (page of paginated results you would like)

Note: the default number of results is 50 per page.

Example Requests and Responses:

Simple Request with No Optional Parameters:

curl -X GET -d '{"api_key": "123456", "assessment":{"id":"35"}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions

Example Response:

[
  {
    "id": 94,
    "position": 2,
    "question_type": "true_false",
    "weight": 1,
    "is_random_choices": false,
    "body": "Is it true?",
    "feedback": null,
    "feedback_on_invalid_answer": "",
    "grading_instructions": null,
    "grid_arrays": {
      "rows": [],
      "columns": []
    },
   "rank_details":null,
    "assessment_question_section": {
      "id": 49,
      "name": "Default"
    },
    "assessments": [
      {
        "id": 37,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
  },
  {
    "id": 93,
    "position": 1,
    "question_type": "multiple_choice",
    "weight": 1,
    "is_random_choices": false,
    "body": "What is the airspeed velocity of an un-ladened swallow?",
    "feedback": null,
    "feedback_on_invalid_answer": "",
    "grading_instructions": null,
    "grid_arrays": {
      "rows": [],
      "columns": []
    },
   "rank_details":null,
    "assessment_question_section": {
      "id": 49,
      "name": "Default"
    },
    "assessments": [
      {
        "id": 35,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
  }
]

Request with Optional Parameters Example:

curl -X GET -d '{"api_key": "123456", "assessment":{"id":"35"}, "assessment_question":{"question_type":"multiple_choice"}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions

Example Response:

[
  {
    "id": 93,
    "position": 1,
    "question_type": "multiple_choice",
    "weight": 1,
    "is_random_choices": false,
    "body": "What is the airspeed velocity of an un-ladened swallow?",
    "feedback": null,
    "feedback_on_invalid_answer": "",
    "grading_instructions": null,
    "grid_arrays": {
      "rows": [],
      "columns": []
    },
   "rank_details":null,
    "assessment_question_section": {
      "id": 49,
      "name": "Default"
    },
    "assessments": [
      {
        "id": 35,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
  }
]

Request Using Pagination Example:

curl -X GET -d '{"api_key": "123456", "assessment":{"id":"35"}, "per_page":"2", "page":"1"}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions

Example Response:

[
  {
    "id": 94,
    "position": 2,
    "question_type": "true_false",
    "weight": 1,
    "is_random_choices": false,
    "body": "Is it true?",
    "feedback": null,
    "feedback_on_invalid_answer": "",
    "grading_instructions": null,
    "grid_arrays": {
      "rows": [],
      "columns": []
    },
    "rank_details":null,
    "assessment_question_section": {
      "id": 49,
      "name": "Default"
    },
    "assessments": [
      {
        "id": 35,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
  },
  {
    "id": 93,
    "position": 1,
    "question_type": "multiple_choice",
    "weight": 1,
    "is_random_choices": false,
    "body": "What is the airspeed velocity of an un-ladened swallow?",
    "feedback": null,
    "feedback_on_invalid_answer": "",
    "grading_instructions": null,
    "grid_arrays": {
      "rows": [],
      "columns": []
    },
    "rank_details":null,
    "assessment_question_section": {
      "id": 49,
      "name": "Default"
    },
    "assessments": [
      {
        "id": 35,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
  }
]




Read

Resource: /api/v2/assessment_questions/id_of_resource

HTTPS Request Method: GET

Description: A single assessment question that matches the id passed in.

Required Parameters:

  • api_key
  • Either course[code], course[id] or assessment[id]
  • id of resource at end of url

Example Request:

curl -X GET -d '{"api_key": "123456", "assessment":{"id":"35"}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions/94

Example Response:

{
  "id": 94,
  "position": 2,
  "question_type": "true_false",
  "weight": 1,
  "is_random_choices": false,
  "body": "Is it true?",
  "feedback": null,
  "feedback_on_invalid_answer": "",
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [],
    "columns": []
  },
"rank_details":null,
  "assessment_question_section": {
    "id": 49,
    "name": "Default"
  },
    "assessments": [
      {
        "id": 35,
        "name": "A Whole Lotta Party and a Review copy",
        "assessment_type": "assessment",
        "pass_message": null,
        "fail_message": null,
        "is_random_choices": false,
        "instructions": "",
        "course_assessment": {
          "id": 106,
          "name": "A Whole Lotta Party and a Review copy"
        }
      }
    ]
}




Create

Resource: /api/v2/assessment_questions

HTTPS Request Method: POST

Description: Creates a new assessment question object.

Required Parameters:

  • api_key
  • Either course[code], course[id] or assessment[id]
  • assessment_question[body, question_type, assessment_question_section_id]

Potentially Required Parameters:

If the question_type is true_false, mutiple_choice, sequence, matching, grid, or numeric_grid, you must also include:

  • assessment_question_choices_attributes

This key has additional requirements, depending on the type of question being created. Those will be detailed with each question type in the Create section below.

Optional Parameters:

The following optional parameters must be within the assessment_question key:

  • position
  • weight
  • is_random_choices (boolean)
  • feedback
  • created_at
  • updated_at
  • feedback_on_invalid_answer
  • grading_instructions
  • multiple_choice_text_option (boolean)
  • is_optional (boolean)
  • media_asset_url: the URL where the image will be fetched by the Create endpoint and attached to the AssessmentQuestion. For performance reasons please store the File in a Google Cloud Storage bucket. Maximum file size is 10 megabytes.

The following optional parameters should be outside of the assessment_question key:

  • rank_from: the integer that starts the numerical scale for ranking (default is 1)
  • rank_to: the integer that ends the numerical scale for ranking (default is 5)
  • rank_least: the label that describes the start of the numerical scale (default is "Least")
  • rank_most: the label that describes the start of the numerical scale (default is "Most")
  • rows: a JSON array of values to be used for rows in the grid_array (only for "grid" and "numeric_grid" type questions)
  • columns: a JSON array of values to be used for columns in the grid_array (only for "grid" and "numeric_grid" type questions)
  • true_or_false: define the correct answer by providing the string "true" or "false" (only for "true_false" type questions)

Example Request that sets rows and columns:

curl -X "POST" "http://demo.exceedlms.test:3000/api/v2/assessment_questions/?api_key=123456&assessment%5Bid%5D=1&course%5Bid%5D=4&assessment_question%5Bassessment_question_section_id%5D=1&assessment_question%5Bquestion_type%5D=grid&assessment_question%5Bbody%5D=something" -H 'Content-Type: application/json' -H 'Accept: application/json' -d $'{ "columns": ["Green","Yellow"], "rows": ["Apple","Banana"] }'

Note: The following parameters are limited to 255 characters:

  • assessment_question[question_type]

Example Requests:

Due to the many types of assessment questions, the requests and responses will be broken down by question_type.

True or False:

curl -X POST -d '{"api_key": "123456", "assessment":{"id":"35"}, "true_or_false":"true", "assessment_question":{"assessment_question_section_id":"49", "question_type":"true_false", "weight":"1", "body":"The Panthers are Awesome from the API", "assessment_question_choices_attributes":{"0":{"body":""}, "1":{"body":""}}}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions 

Example Response:

{
  "id": 97,
  "position": 3,
  "question_type": "true_false",
  "weight": 1,
  "is_random_choices": false,
  "body": "The Panthers are Awesome from the API",
  "feedback": null,
  "feedback_on_invalid_answer": null,
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [],
    "columns": []
  },
"rank_details":null,
  "assessment_question_section": {
    "id": 49,
    "name": "Default"
  },
  "assessments": [
    {
      "id": 35,
      "name": "A Whole Lotta Party and a Review copy",
      "assessment_type": "assessment",
      "pass_message": null,
      "fail_message": null,
      "is_random_choices": false,
      "instructions": "",
      "course_assessment": {
        "id": 106,
        "name": "A Whole Lotta Party and a Review copy"
      }
    }
  ]
}

Notes:

true_or_false should be outside of the assessment_question key

You will no doubt notice the following elements:

"assessment_question_choices_attributes":{"0":{"body":""}, "1":{"body":""}}

These are all required. Even though the true_or_false key actually sets the required response to be true or false, an AssessmentQuestion needs AssessmentQuestionChoices, and those need a body to be valid. So even though the body is an empty string, you must include it.

Multiple Choice:

curl -X POST -d '{"api_key": "123456", "assessment":{"id":"35"}, "assessment_question":{"assessment_question_section_id":"49", "question_type":"multiple_choice", "weight":"1", "body":"What is your favorite color?", "assessment_question_choices_attributes":{"0":{"is_correct":"1", "body":"Blue", "position": "2"}, "1":{"is_correct":"0", "body":"No, yellow!", "position": "1"}}}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions 

Example Response:

{
  "id": 98,
  "position": 4,
  "question_type": "multiple_choice",
  "weight": 1,
  "is_random_choices": false,
  "body": "What is your favorite color?",
  "feedback": null,
  "feedback_on_invalid_answer": null,
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [],
    "columns": []
  },
"rank_details":null,
  "assessment_question_section": {
    "id": 49,
    "name": "Default"
  },
  "assessment_question_choices":[
{
   "id": 301, 
   "body":"Blue", 
   "is_correct": true,  
   "position": 2, 
   "answer": null
}, 
{
   "id": 302, 
   "body":"No, yellow!", 
   "is_correct": false,  
   "position": 1, 
   "answer": null
}
  ],
  "assessments": [
    {
      "id": 35,
      "name": "A Whole Lotta Party and a Review copy",
      "assessment_type": "assessment",
      "pass_message": null,
      "fail_message": null,
      "is_random_choices": false,
      "instructions": "",
      "course_assessment": {
        "id": 106,
        "name": "A Whole Lotta Party and a Review copy"
      }
    }
  ]
}

Notes about the assessment_question_choices_attributes:

You will no doubt notice the following elements:

"assessment_question_choices_attributes":{"0":{"is_correct":"1", "body":"Blue"}, "1":{"is_correct":"0", "body":"No, yellow!"}}}

These are all required. You place the choices in order, starting at index 0. If you do not want to enter the choices in order, use the optional "position" attribute described below. The correct choice should have the is_correct set to 1. Each needs a body to be valid.

Optional assessment_question_choices_attributes: The "position" attribute provides control over the order in which the choices will be displayed to the learner. The value should be an integer greater than 0. Choices will be displayed in ascending order.



Update

Resource: /api/v2/assessment_questions/id_of_resource

HTTPS Request Method: PATCH or PUT

Description: Updates an assessment question object.

Required Parameters:

  • api_key
  • Either course[code], course[id] or assessment[id]
  • id of resource at end of url
  • assessment_question key is also required with one or more of the optional parameters below

Optional Parameters:

The following optional parameters must be within the assessment_question key:

  • body
  • question_type
  • assessment_question_section_id (this parameter is not allowed when updating)
  • position
  • weight
  • is_random_choices (boolean)
  • feedback
  • created_at
  • updated_at
  • feedback_on_invalid_answer
  • _grading_instructions _
  • multiple_choice_text_option (boolean)
  • is_optional (boolean)
  • media_asset_url: the URL where the image will be fetched by the Create endpoint and attached to the AssessmentQuestion. For performance reason please store the File in a Google Cloud Storage bucket. Maximum file size is 10 megabytes.
  • assessment_question_choices_attributes: you'll need to supply the id for the choice(s) you're wanting to update. Otherwise, it will append instead of update the choice(s). To delete a choice, you’ll need to supply a _destroy parameter.

Example Request To Delete a Choice:

curl -X PATCH -d '{"api_key": "123456", "assessment":{"id":"35"}, "assessment_question_choices_attributes":{"0": {"id": "3", "body": "ABC", "is_correct": "1"}, "1": {"id": "4", "_destroy": "1"}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions/97
  • See the Create endpoint details for descriptions of what attributes are required here depending on the question_type.

The following optional parameters should be outside of the assessment_question key:

  • rank_from: the integer that starts the numerical scale for ranking (default is 1)
  • rank_to: the integer that ends the numerical scale for ranking (default is 5)
  • rank_least: the label that describes the start of the numerical scale (default is "Least")
  • rank_most: the label that describes the start of the numerical scale (default is "Most")
  • rows: a JSON array of values to be used for rows in the grid_array (only for "grid" and "numeric_grid" type questions)
  • columns: a JSON array of values to be used for columns in the grid_array (only for "grid" and "numeric_grid" type questions)
  • *true_or_false: * define the correct answer by providing the string "true" or "false" (only for "true_false" type questions)

Example Request to update rows and columns:

curl -X "PATCH" "http://demo.exceedlms.test:3000/api/v2/assessment_questions/217?api_key=123456&assessment%5Bid%5D=1" -H 'Content-Type: application/json' -H 'Accept: application/json' -d $'{ "columns": ["Green","Yellow"], "rows": ["Apple","Banana"] }'

Example Request:

curl -X PATCH -d '{"api_key": "123456", "assessment":{"id":"35"}, "rank_from": "2", "rank_to": "4", "rank_least": "Least Satisfied", "rank_most": "Most Satisfied", "assessment_question":{"body":"The Panthers are really, really Awesome from the API", "media_asset_url": "http://www.example.com/image.png" }}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions/97

Example Response:

{
  "id": 97,
  "position": 3,
  "question_type": "true_false",
  "weight": 1,
  "is_random_choices": false,
  "body": "The Panthers are really, really Awesome from the API",
  "feedback": null,
  "feedback_on_invalid_answer": null,
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [],
    "columns": []
  },
"rank_details": {
"from": 2,
"to": 4,
"least": "Least Satisfied",
"most": "Most Satisfied"
},
  "assessment_question_section": {
    "id": 49,
    "name": "Default"
  },
"media_asset": {
   "id": 347,
   "media_file_name": "image.png"
},
  "assessments": [
    {
      "id": 35,
      "name": "A Whole Lotta Party and a Review copy",
      "assessment_type": "assessment",
      "pass_message": null,
      "fail_message": null,
      "is_random_choices": false,
      "instructions": "",
      "course_assessment": {
        "id": 106,
        "name": "A Whole Lotta Party and a Review copy"
      }
    }
  ]
}

Example Request:

curl -X "PATCH" "https://demo.exceed.test:3000/api/v2/assessment_questions/2006?api_key=123456&assessment%5Bid%5D=331&assessment_question%5Bis_optional%5D=true&assessment_question%5Bmultiple_choice_text_option%5D=true" \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -d $'{
  "columns": [
    "Yes",
    "No",
    "Maybe"
  ],
  "rows": [
    "I have already used the products/platforms discussed.",
    "If no, do you have plans to in the future?",
    "Do you like them?"
  ]
}'

Example Response:

{
  "id": 2006,
  "position": 3,
  "question_type": "grid",
  "weight": 0,
  "is_random_choices": false,
  "body": "Choose the best answers from the options below. ",
  "feedback": null,
  "feedback_on_invalid_answer": "",
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [
      "I have already used the products/platforms discussed.",
      "If no, do you have plans to in the future?",
      "Do you like them?"
    ],
    "columns": [
      "Yes",
      "No",
      "Maybe"
    ]
  },
  "rank_details": null,
  "multiple_choice_text_option": true,
  "is_optional": true,
  "assessment_question_section": {
    "id": 648,
    "name": "Survey Questions"
  },
  "assessment_question_choices": [],
  "assessment": [
    {
      "id": 331,
      "assessment_type": "assessment",
      "instructions": "",
      "pass_message": "Nice job!",
      "fail_message": "Almost!",
      "is_random_choices": true,
      "course_assessment": {
        "id": 2332,
        "name": "What's new with Web Designer?"
      }
    }
  ]
}




Delete

Resource: /api/v2/assessment_questions/id_of_resource

HTTPS Request Method: DELETE

**Description: **Destroys an assessment question section object.

Required Parameters:

  • api_key
  • id of resource at end of url
  • Either course[code], course[id] or assessment[id]

WARNING: Deleting this object will also destroy all related:

  • assessment_question_choices
  • assessment_response_questions
  • assessment_question_choice_actions

Example Request:

curl -X DELETE -d '{"api_key": "123456", "assessment":{"id":"35"}}' -H "Content-type: application/json" -H "Accept: application/json" http://your-subdomain.exceedlms.com/api/v2/assessment_questions/97

Example Response:

{
  "id": 97,
  "position": 3,
  "question_type": "true_false",
  "weight": 1,
  "is_random_choices": false,
  "body": "The Panthers are really, really Awesome from the API",
  "feedback": null,
  "feedback_on_invalid_answer": null,
  "grading_instructions": null,
  "grid_arrays": {
    "rows": [],
    "columns": []
  },
"rank_details":null,
  "assessment_question_section": {
    "id": 49,
    "name": "Default"
  },
  "assessments": [
    {
      "id": 35,
      "name": "A Whole Lotta Party and a Review copy",
      "assessment_type": "assessment",
      "pass_message": null,
      "fail_message": null,
      "is_random_choices": false,
      "instructions": "",
      "course_assessment": {
        "id": 106,
        "name": "A Whole Lotta Party and a Review copy"
      }
    }
  ]
}

Note: Even though we respond with the object, rest assured it has been removed from our system. Subsequent calls to delete it will result in an error.