REST API to export modulestore XBlocks as OLX.
This was originally a separate plugin called openedx-olx-rest-api. It provides a Studio API that any user with course authoring permission can use to get the OLX of an individual XBlock or a unit. Without this, the only way to get an XBlock's OLX was to download the tarball of the entire course. Examples of usage (be logged in to Studio on devstack): Simple HTML XBlock: http://localhost:18010/api/olx-export/v1/xblock/block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4/ Exporting a unit: http://localhost:18010/api/olx-export/v1/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@134df56c516a4a0dbb24dd5facef746e/ Example output for an HTML block: { "root_block_id":"block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4", "blocks":{ "block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4":{ "olx":"<html display_name=\"Blank HTML Page\"><![CDATA[\n<p><strong>Welcome to the edX Demo Course Introduction.</strong></p>\n]]></html>\n" } } } The code is designed primarily for use when importing content into Blockstore. So it will: * Export HTML blocks as a combined OLX/HTML file, with the HTML in a CDATA section * Convert vertical blocks to unit blocks (unit is like a vertical but has no UI elements) * Detect static files (such as images) used by the XBlock and list the absolute URL of each static file in the "static_files": {...} JSON element for each XBlock that has at least one static file usage. This can handle static files that are in mongo ("contentstore" / "Files & Uploads") as well as files generated on-the-fly during OLX serialization via the export_fs API (mostly this is video transcripts).
This commit is contained in:
1
setup.py
1
setup.py
@@ -95,6 +95,7 @@ setup(
|
||||
# consolidate the multiple discussions-related Django apps and
|
||||
# either put them in the openedx/ dir, or in another repo entirely.
|
||||
"discussion = lms.djangoapps.discussion.apps:DiscussionConfig",
|
||||
"olx_rest_api = openedx.core.djangoapps.olx_rest_api.apps:OlxRestApiAppConfig",
|
||||
"plugins = openedx.core.djangoapps.plugins.apps:PluginsConfig",
|
||||
"schedules = openedx.core.djangoapps.schedules.apps:SchedulesConfig",
|
||||
"theming = openedx.core.djangoapps.theming.apps:ThemingConfig",
|
||||
|
||||
Reference in New Issue
Block a user