From 9b81f1aed6cf9a5d223b9f788223f244a8a03215 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 21 Feb 2017 11:22:41 -0500 Subject: REST: Add '/bundle' endpoint I had initially resisted adding a '/bundle' endpoint to the API as I wanted to kill this feature in favour of series. However, series are not a like-for-like replacement for bundles. Among other things, series do not provide the composability of bundles: bundles can be manually created, meaning you can use bundles to group not only multiple patches but also multiple series (or at least the patches in those series). Seeing as we're not getting rid of this feature, we should expose it via the API. Bundles are little unusual, in that they can be public or private, thus, we should only show bundles that are public or belonging to the currently authenticated user, if any. For now, this is a read-only endpoint. We may well allow creation of bundles via the API once we figure out how to do this cleanly. Signed-off-by: Stephen Finucane Reviewed-by: Andy Doan --- patchwork/urls.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'patchwork/urls.py') diff --git a/patchwork/urls.py b/patchwork/urls.py index 09b8b31..57d5cd7 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -158,6 +158,7 @@ if settings.ENABLE_REST_API: raise RuntimeError( 'djangorestframework must be installed to enable the REST API.') + from patchwork.api import bundle as api_bundle_views from patchwork.api import check as api_check_views from patchwork.api import cover as api_cover_views from patchwork.api import event as api_event_views @@ -208,6 +209,12 @@ if settings.ENABLE_REST_API: url(r'^series/(?P[^/]+)/$', api_series_views.SeriesDetail.as_view(), name='api-series-detail'), + url(r'^bundles/$', + api_bundle_views.BundleList.as_view(), + name='api-bundle-list'), + url(r'^bundles/(?P[^/]+)/$', + api_bundle_views.BundleDetail.as_view(), + name='api-bundle-detail'), url(r'^projects/$', api_project_views.ProjectList.as_view(), name='api-project-list'), -- cgit v1.2.3