Skip to content

admin create_question.json

Timothy Duffy edited this page Mar 8, 2015 · 1 revision

###admin/create_question.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_question.json?token=238236fa-0e1a-499c-8051-c46e2f416387

There are two parts of an assignment: the assignment itself, and the questions that go along with it. Yellr supports multiple questions to support multiple languages. The create_question.json is a HTTP POST event, and takes Four mandatory fields.

language_code
    The two letter language code for the question ('en', 'es', 'fr', etc.)

question_text
    This is the text of the question, in whatever language is defined by the 
    language_code field

description
    This is a field that allows additional information to be presented about the question.
    This is a nice way to keep the question brief and concise, while still giving enough information
    within this field for the user to understand why the asking person wanted to know.

question_type
    This is the type of question: free text, multiple choice, ect.
    Examples: 'free_text', 'multiple_choice'

[ OPTIONAL ]
answers
    Optionally you can include a field called answers.  This field is a JSON array of
    strings.  This is used for questions types such as multiple choice.  You are allowed
    up to ten options.  You do not need to specify all ten if they are not used.

A valid response will include a success field, and a question_id field. This ID is used with the publish_assignment.json api to link questions to assignments.

{
    "success": true
    "question_id": 5
}

There are two different errors that can come back:

{
    "error_text": "Missing 'token' field in request.",
    "success": false
}

{
    "error_text": "One or more of the following fields is missing or invalid: 
                   language_code, question_text, question_type. ",
    "success": false
}
Clone this wiki locally