Skip to content

feat: add REST API for task creation & status retrieve#32

Merged
kdmccormick merged 1 commit intokdmccormick:kdmccormick/import-from-modulestorefrom
andrii-hantkovskyi:hantkovskyi/modulestore-migration/rest-api
Jun 24, 2025
Merged

feat: add REST API for task creation & status retrieve#32
kdmccormick merged 1 commit intokdmccormick:kdmccormick/import-from-modulestorefrom
andrii-hantkovskyi:hantkovskyi/modulestore-migration/rest-api

Conversation

@andrii-hantkovskyi
Copy link

Description

Implements a REST API for creating and tracking modulestore migration tasks.

  • POST /api/modulestore_migrator/v0/imports/
    Creates a new import task.
    Request and response include source, target, composition level, and replace options.

    Request Example:

    {
      "source": "course-v1:edX+DemoX+2024_T1",
      "target": "library-v1:org1+lib_1",
      "composition_level": "unit",
      "replace_existing": true,
      "target_collection_slug": "algebra"
    }

    Response Example:

    {
      "name": "migrate_from_modulestore",
      "state": "Validating migration parameters",
      "state_text": "Cancelling any redundant migration tasks",
      "completed_steps": 0,
      "total_steps": 11,
      "attempts": 1,
      "created": "2025-06-01T10:00:00Z",
      "modified": "2025-06-01T10:00:00Z",
      "artifacts": [],
      "modulestoremigration": {
        "source": "course-v1:edX+DemoX+2024_T1",
        "target": "library-v1:org1+lib_1",
        "composition_level": "unit",
        "replace_existing": true,
        "target_collection_slug": "videos"
      }
    }
  • GET /api/modulestore_migrator/v0/imports/<uuid>/
    Retrieves the status and details of an import task by UUID.

    Response Example:

    {
      "name": "migrate_from_modulestore",
      "state": "Running",
      "state_text": "Importing course structure",
      "completed_steps": 5,
      "total_steps": 11,
      "attempts": 1,
      "created": "2025-06-01T10:00:00Z",
      "modified": "2025-06-01T10:02:00Z",
      "artifacts": [],
      "modulestoremigration": {
        "source": "course-v1:edX+DemoX+2024_T1",
        "target": "library-v1:org1+lib_1",
        "composition_level": "unit",
        "replace_existing": true,
        "target_collection_slug": "videos"
      }
    }

This enables asynchronous content migration with real-time status tracking via the API, improving automation and observability for admin-driven content workflows.

@kdmccormick kdmccormick self-requested a review June 13, 2025 16:15
@kdmccormick kdmccormick merged commit d78da49 into kdmccormick:kdmccormick/import-from-modulestore Jun 24, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments