Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mgibson2
New Member

Posting HTML for Question using canvas API, html not being parsed

Hi, Im trying to add a question with HTML content to a quiz using canvas api - see below for full call

question type is essay question - and the question text is HTML. when i view this in canvas i see all the HTML formatting. I see in the canvas UI there is an "HTML editor" option, that allows you to enter html formatting and see proper html output (not all the formatting). I need to do likewise in my API call. In the API doc I dont see any flag to indicate the content is HTML. what am i missing here? thanks for help

(api doc for create question : https://canvas.instructure.com/doc/api/quiz_questions.html#method.quizzes/quiz_questions.create )

 

call im trying to make with url encoded html in question text

 
Labels (1)
Tags (4)
0 Kudos
2 Replies
mgibson2
New Member

I would be surprised if there wasnt a way to do this - as surely you need to send html in for a question - but i dont see an option in the api params for this - which makes me think you have to put something in the text itself - i tried surrounding it with <html> </html> - didnt work

jerry_nguyen
Community Contributor

@mgibson2 

Don't encode the HTML script, POST the request as plain HTML (E.g. /questions?question[question_type]=text_only_question&question[question_text]=<strong>abc</strong>).

Canvas will also strip any HTML tags that are not in the allowed list. here: https://community.canvaslms.com/t5/Canvas-Question-Forum/Aceptable-HTML-Elements/m-p/57536/highlight...