From: Stephen Finucane Date: Wed, 26 Apr 2017 23:58:04 +0000 (+0100) Subject: REST: Allow users to omit version entirely X-Git-Tag: v2.0.0-rc1~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=868f63b0e366f442cfa158db6ecea8e1027491f1;p=thirdparty%2Fpatchwork.git REST: Allow users to omit version entirely This is super handy for debugging/development of Patchwork and Patchwork clients alike. Signed-off-by: Stephen Finucane --- diff --git a/docs/api/rest.rst b/docs/api/rest.rst index 75e31f6f..17509134 100644 --- a/docs/api/rest.rst +++ b/docs/api/rest.rst @@ -86,6 +86,23 @@ overview of existing API clients, refer to :doc:`../usage/clients`. own instance of Patchwork locally <../development/installation>` and experiment with that instead. +Versioning +---------- + +By default, all requests will receive the latest version of the API: currently +``1.0``: + +.. code-block:: http + + GET /api HTTP/1.1 + +You should explicitly request this version through the URL to prevent API +changes breaking your application: + +.. code-block:: http + + GET /api/1.0 HTTP/1.1 + Schema ------ diff --git a/patchwork/urls.py b/patchwork/urls.py index 8c8c172f..f700f386 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -232,7 +232,7 @@ if settings.ENABLE_REST_API: ] urlpatterns += [ - url(r'^api/(?P(1.0))/', include(api_patterns)), + url(r'^api/(?:(?P(1.0))/)?', include(api_patterns)), ]