Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Import course api via URL #36070

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

awais786
Copy link
Contributor

@awais786 awais786 commented Jan 2, 2025

Do not review still in progress

This PR enhances the course import API by introducing the ability to import a course using a URL. Users can now provide a file URL to import a course, enabling greater flexibility and ease of use.

  1. Added support for the file_url parameter to allow importing courses directly from a URL.
  2. Downloads the file from the specified URL and processes it for course import.

Test via curl

curl --location 'http://localhost:18010/api/courses/v0/import/course-v1:edX+DemoX+Demo_Course/' \
--header 'Authorization: JWT token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-CSRFToken: awtUGVlYyMwLWaaS' \
--data-raw '{
    "file_url": "https://raw.githubusercontent.com/awais786/courses/main/edly/AI%20Courses/course.v2_c3p0f.tar.gz"
}'
output 
{"task_id":"e264cb4e-ea1f-4884-ab01-a374eb1ddc4c"}%

Now verify the task state by using taskid e264cb4e-ea1f-4884-ab01-a374eb1ddc4c and filename

curl --location 'http://localhost:18010/api/courses/v0/import/course-v1:edX+DemoX+Demo_Course/?task_id=e264cb4e-ea1f-4884-ab01-a374eb1ddc4c&filename=course.v2_c3p0f.tar.gz' \
--header 'Authorization: JWT token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-CSRFToken: awtUGVlYyMwLWaaSS'
output

{"state":"Succeeded"}%

@awais786 awais786 changed the title feat!: updating import api, now it will download course for url also. feat!: Import course api via URL Jan 2, 2025
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.

1 participant