Skip to content

Commit

Permalink
feat: TNL-11173 Authoring API is v0 for now
Browse files Browse the repository at this point in the history
But won't be for long: views left in v1 folder
  • Loading branch information
bszabo committed Nov 1, 2023
1 parent be4aa3f commit 34dc085
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 41 deletions.
60 changes: 60 additions & 0 deletions cms/djangoapps/contentstore/rest_api/v0/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,26 @@
from openedx.core.constants import COURSE_ID_PATTERN
from .views import AdvancedCourseSettingsView, CourseTabSettingsView, CourseTabListView, CourseTabReorderView

# The Authoring API is being offered on a short time basis as a v0 version, but this will soon be deprecated and
# only a v1 version will be offered. The views were developed under v1, under a belief this is how we'd be
# introducing the API. For now, just keep them there
from .. import (
AssetsCreateRetrieveView,
AssetsUpdateDestroyView,
VideoEncodingsDownloadView,
VideoFeaturesView,
VideoImagesView,
VideosCreateUploadView,
VideosUploadsView,
TranscriptView,
XblockCreateView,
XblockView
)

app_name = "v0"

VIDEO_ID_PATTERN = r'(?P<edx_video_id>[-\w]+)'

urlpatterns = [
re_path(
fr"^advanced_settings/{COURSE_ID_PATTERN}$",
Expand All @@ -28,4 +46,46 @@
CourseTabReorderView.as_view(),
name="course_tab_reorder",
),

# Authoring API
re_path(
fr'^file_assets/{settings.COURSE_ID_PATTERN}/$',
assets.AssetsCreateRetrieveView.as_view(), name='cms_api_create_retrieve_assets'
),
re_path(
fr'^file_assets/{settings.COURSE_ID_PATTERN}/{settings.ASSET_KEY_PATTERN}$',
assets.AssetsUpdateDestroyView.as_view(), name='cms_api_update_destroy_assets'
),
re_path(
fr'^videos/encodings/{settings.COURSE_ID_PATTERN}$',
videos.VideoEncodingsDownloadView.as_view(), name='cms_api_videos_encodings'
),
path(
'videos/features/',
videos.VideoFeaturesView.as_view(), name='cms_api_videos_features'
),
re_path(
fr'^videos/images/{settings.COURSE_ID_PATTERN}/{VIDEO_ID_PATTERN}$',
videos.VideoImagesView.as_view(), name='cms_api_videos_images'
),
re_path(
fr'^videos/uploads/{settings.COURSE_ID_PATTERN}/$',
videos.VideosCreateUploadView.as_view(), name='cms_api_create_videos_upload'
),
re_path(
fr'^videos/uploads/{settings.COURSE_ID_PATTERN}/{VIDEO_ID_PATTERN}$',
videos.VideosUploadsView.as_view(), name='cms_api_videos_uploads'
),
re_path(
fr'^video_transcripts/{settings.COURSE_ID_PATTERN}$',
transcripts.TranscriptView.as_view(), name='cms_api_video_transcripts'
),
re_path(
fr'^xblock/{settings.COURSE_ID_PATTERN}/$',
xblock.XblockCreateView.as_view(), name='cms_api_create_xblock'
),
re_path(
fr'^xblock/{settings.COURSE_ID_PATTERN}/{settings.USAGE_KEY_PATTERN}$',
xblock.XblockView.as_view(), name='cms_api_xblock'
),
]
43 changes: 2 additions & 41 deletions cms/djangoapps/contentstore/rest_api/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,45 +84,6 @@
name="course_rerun"
),

# CMS API
re_path(
fr'^file_assets/{settings.COURSE_ID_PATTERN}/$',
assets.AssetsCreateRetrieveView.as_view(), name='cms_api_create_retrieve_assets'
),
re_path(
fr'^file_assets/{settings.COURSE_ID_PATTERN}/{settings.ASSET_KEY_PATTERN}$',
assets.AssetsUpdateDestroyView.as_view(), name='cms_api_update_destroy_assets'
),
re_path(
fr'^videos/encodings/{settings.COURSE_ID_PATTERN}$',
videos.VideoEncodingsDownloadView.as_view(), name='cms_api_videos_encodings'
),
path(
'videos/features/',
videos.VideoFeaturesView.as_view(), name='cms_api_videos_features'
),
re_path(
fr'^videos/images/{settings.COURSE_ID_PATTERN}/{VIDEO_ID_PATTERN}$',
videos.VideoImagesView.as_view(), name='cms_api_videos_images'
),
re_path(
fr'^videos/uploads/{settings.COURSE_ID_PATTERN}/$',
videos.VideosCreateUploadView.as_view(), name='cms_api_create_videos_upload'
),
re_path(
fr'^videos/uploads/{settings.COURSE_ID_PATTERN}/{VIDEO_ID_PATTERN}$',
videos.VideosUploadsView.as_view(), name='cms_api_videos_uploads'
),
re_path(
fr'^video_transcripts/{settings.COURSE_ID_PATTERN}$',
transcripts.TranscriptView.as_view(), name='cms_api_video_transcripts'
),
re_path(
fr'^xblock/{settings.COURSE_ID_PATTERN}/$',
xblock.XblockCreateView.as_view(), name='cms_api_create_xblock'
),
re_path(
fr'^xblock/{settings.COURSE_ID_PATTERN}/{settings.USAGE_KEY_PATTERN}$',
xblock.XblockView.as_view(), name='cms_api_xblock'
),
# Authoring API
# Do not use under v1 yet (Nov. 23). The Authoring API is still experimental and the v0 versions should be used
]

0 comments on commit 34dc085

Please sign in to comment.