From 7297675ce8d7dd92e875519f56f99561bb7f1f10 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 20 Oct 2020 19:39:55 +0200 Subject: [PATCH] change API documentation --- rowers/templates/developers.html | 30 +++++++++++++++++++++++------- rowers/urls.py | 1 + rowsandall_app/settings.py | 13 ++++++++++--- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/rowers/templates/developers.html b/rowers/templates/developers.html index d8e5125e..20492942 100644 --- a/rowers/templates/developers.html +++ b/rowers/templates/developers.html @@ -138,7 +138,7 @@

-

API documentation

+

API endpoints

Once you have a registered app, you have gone through the authorization and have successfully obtained an access token, you can use it to place @@ -147,12 +147,28 @@

The workout summary data and the stroke data are obtained and sent separately.

-

-

-

+

Challenges are accessed through /rowers/api/challenges/ + and /rowers/api/challenges/{id} where {id} is the ID of the challenge. Allowed method + is GET.

+

Entries are accessed through /rowers/api/entries/ + and /rowers/api/entries/{id} where {id} is the ID of the entry. + Allowed methods are GET.

+

Charts are accessed through /rowers/api/charts/ + and /rowers/api/charts/{id} where {id} is the ID of the chart. + Allowed method are GET, DELETE.

+

Courses are accessed through /rowers/api/geocourses/ + and /rowers/api/geocourses/{id} where {id} is the ID of the Course. + Allowed method are GET.

+

Course Standard Collections are accessed through /rowers/api/standardcollections/ + and /rowers/api/standardcollections/{id} where {id} is the ID of the Standard Collection. + Allowed method are GET.

+

Individual Course Standards are accessed through /rowers/api/standards/{id} where {id} is the ID of the Course Standard. + Allowed method are GET.

+

Workouts are accessed through /rowers/api/workouts/ + and /rowers/api/workouts/{id} where {id} is the ID of the Workout. + Allowed method are GET, POST, DELETE.

+ +

POST stroke data - API

diff --git a/rowers/urls.py b/rowers/urls.py index 28c47cb8..f395f590 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -20,6 +20,7 @@ from rest_framework.permissions import * from rowers import views from django.contrib.auth import views as auth_views from django.views.generic.base import TemplateView +from django.utils.decorators import method_decorator from rowers.permissions import ( IsOwnerOrNot,IsOwnerOrReadOnly, diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 052829b9..0591ee09 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -431,7 +431,7 @@ REST_FRAMEWORK = { # 'rest_framework.permissions.DjangoModelPermissions' ], 'DEFAULT_AUTHENTICATION_CLASSES': ( -# 'rest_framework.authentication.BasicAuthentication', + 'rest_framework.authentication.BasicAuthentication', # 'rest_framework.authentication.SessionAuthentication', # 'rest_framework.authentication.TokenAuthentication', 'oauth2_provider.contrib.rest_framework.OAuth2Authentication', @@ -441,7 +441,7 @@ REST_FRAMEWORK = { } SWAGGER_SETTINGS = { - 'SECURITY_DEFINITION': { + 'SECURITY_DEFINITIONS': { 'basic': { 'type':'basic' }, @@ -449,9 +449,16 @@ SWAGGER_SETTINGS = { 'type':'oauth2', 'authorizationUrl':'/rowers/o/authorize', 'flow': 'implicit', - } + }, + 'api_key': { + 'type': 'apiKey', + 'in': 'header', + 'name': 'Authorization' + }, }, 'SHOW_REQUEST_HEADERS': True, + 'USE_SESSION_AUTH': True, + 'JSON_EDITOR': True, } # Analytics