A partial archive of edxchange.opencraft.com as of Wednesday July 13, 2022.

REST API for course import / export

pdpinch

An API for course import and export would make moving courses between edX instances easier and more reliable. It would also make it possible to automate sharing of courseware between content authors and integration with other tools for editing and archiving (e.g. git).

A number of developers have come up with ad hoc ways to automate import and export, but a proper API would provide a stable interface.

Natea

Yeah, the manual export of tarball and importing it again is a dance that can’t easily be automated right now. A REST API would be very useful!

antoviaque

@pdpinch There has been work done on this, which was even merged and reverted, and then abandoned - it could be picked up: https://github.com/edx/edx-platform/pull/10357

I also see in the open PRs at the moment that Joel has started some work on this too: https://github.com/edx/edx-platform/pull/14899 - I’ll post there to ask for details and point him to this thread.

jbarciauskas

Definitely planning to continue this work, yes

antoviaque

@jbarciauskas Cool, I see that you pushed some more code there - great to see this moving forward!

antoviaque

@pdpinch Seeing that @jbarciauskas got this API merged into Ginkgo (kudos! Cf https://github.com/edx/edx-platform/pull/15547 ), if you get to have a look at it, can you say if that ends up covering the import part of your use-case?

Natea

It’s not a REST API, but thought I’d mention that we’ve been using this script for bulk importing courses into Open edX. https://github.com/appsembler/openedx-course-migration-tool

OmarIthawi

The API is interesting. Much better than manual imports for sure. The tasks and celery integration can be tricky to manage for batch imports.

As @Natea mentioned, we’ve been using that script and would possibly do a major revamp to it to help us import 50+ courses at once. A use-case that some of our customers needed.

Also the API don’t seem to have library import support, right? Which is something that we also need.

anna

Hi,

Any news with this one? We are currently struggling in Campus with Import/Export of courses between environments…

Anna

pdpinch

I don’t think much has changed since this was last discussed, but if you’re having specific issues with import & export, I know some workarounds (and a few things that just don’t work).

For example, besides importing and exporting through studio, there are Django management commands to do the same. And there’s a little know feature to export and import courses to git.

smarnach

We looked into the current state of affairs at OpenCraft, and this is what already exists:

  • A REST API to import course tarballs. This API allows to import a course from a tarball. It doesn’t seem to work with OpenStack Swift at the moment, but I don’t think anyone except for us is using this for object storage. Another thing to be aware of is that the Open edX default configuration for nginx only allows uploads up to 100 MB in size, so if you want to import bigger courses you need to tweak your configuration.
  • The import and export_course Django management commands to import a directory structure and export tarballs from the command line.
  • The git_add_course Django management command that accepts a Git repository URL and imports a course from there.

So the only thing that is missing is a REST API for course export, but implementing this would be relatively straight-forward.

anna

That is great actually. BTW, we are still having some Unicode issues with the import/export tool.
A question: is there any need in importing/exporting components between courses? We’ve had a couple of customers asking for that.

frbddnforest

I came here from :


with an answer from @antoviaque -
My interest is maybe simpler than an API to export / import content: I am interested in extracting data from the courses present on Edx, like description and transcription of a course, the offering institution and instructor, and the url. Is there any functionality present that allow to do this, without instantiating a whole edx instance ?