synthea_webservice/webservice/apps/api/urls.py

46 lines
1.5 KiB
Python

from django.urls import path, re_path, include
from rest_framework import permissions, routers
from drf_yasg2.views import get_schema_view
from drf_yasg2 import openapi
from . import views
from apps.synthea.api.views import SyntheaViewSet
from apps.synthea.api.serializers import SyntheaSerializer ,SyntheaModelsSerializer
schema_view = get_schema_view(
openapi.Info(
title="Synthea WebService API",
default_version='',
description="Info about Synthea WebServer API",
terms_of_service="https://www.rug.nl",
contact=openapi.Contact(email="cit@rug.nl"),
license=openapi.License(name="MIT License"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
generate_post = SyntheaViewSet.as_view({
'post': 'create'
})
# Main namespace for the API urls
app_name = 'api'
urlpatterns = [
re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
# Extra /api/info path for checking if the Hawk authentication is working.
# Also this will give the full url to the OpenAPI documentation
path('info/', views.Info.as_view(), name='info'),
path('states/', views.States.as_view(), name='states'),
path('modules/', views.Modules.as_view(), name='modules'),
path('generate/', generate_post, name='generate'),
]