XBlock REST API student_view_data can not get html data

Hi,
I am testing OpenEdx with Tutor. I can not get html content from student_view_data with the following API:
http://local.overhang.io/api/courses/v1/blocks/?all_blocks=true&requested_fields=graded,format, student_view_multi_device&depth=all&student_view_data=html&course_id=course-v1%3AedX%2BDemoX%2BDemo_Course

Response:
{
“root”: “block-v1:edX+DemoX+Demo_Course+type@course+block@course”,
“blocks”: {
“block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4”: {
“id”: “block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4”,
“block_id”: “030e35c4756a4ddc8d40b95fbbfff4d4”,
“lms_web_url”: “http://edx.myaspara.com/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4”,
“legacy_web_url”: “http://edx.myaspara.com/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4?experience=legacy”,
“student_view_url”: “http://edx.myaspara.com/xblock/block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4”,
“type”: “html”,
“display_name”: “Blank HTML Page”,
“graded”: false,
“student_view_data”: {
“enabled”: false,
“message”: “To enable, set FEATURES["ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA"]”
}
},
}
}

Is this something to do with my tutor configuration?

Thanks for any suggestions.

Is this something to do with my tutor configuration?

Yes :slight_smile: As you can see in the output you included, this is not enabled by default:

So you have to turn on this feature via a setting, as it says. You can do so via a Tutor plugin, and there are plenty of examples in the documentation about exactly this thing - using a plugin to enable one of the FEATURES settings. A tutor plugin can be as simple as a single python file, so it doesn’t have to be complex. But it is unfortunately more involved than simply changing a tutor setting from the command line.

1 Like

Thank you for replying. I did successfully create a Tutor plugin and enable it as follow:

hooks.Filters.ENV_PATCHES.add_item(
(
“openedx-lms-common-settings”,
“”"
FEATURES[“ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA”] = True
“”"
)

and I did check the value has been changed to ‘True’ with the following command:
tutor config printvalue ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA

But still… the student_view_data return the same message :melting_face:

That won’t tell you if it’s working, because it’s not a Tutor setting. You need to use

tutor local run lms ./manage.py lms shell
from django.conf import settings
settings.FEATURES["ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA"]

to check if it’s working.

Hi. I’m facing this very same issue. Checking as you mentioned, returns True but I’m still getting the said error in my response. I saw some other docs mentioning republishing the course as it’s cached. Do they mean re running the course by “republish” or just publishing that specific section again? Is there any other way for clearing / updating the cache?