-
Notifications
You must be signed in to change notification settings - Fork 601
Django rest swagger post parameter #629
Comments
@marcgibbons Could you please let me know what i am missing? |
Join the question. Need a way to document POST/GET parameters |
Short anwser: you need to inhehit from -class TeamViewList(APIView, BaseView):
+class TeamViewList(GenericAPIView):
""" Long anwser: |
@marsam what if FBV with the decorator @api_view is used? |
@marsam Is there way to just display the input payload without serializer in the swagger docs? |
In my case I need just "data" field in POST requests. Views decorated as api_vew() and only one way how can I do it - add named group to URL dispatcher. In this case I will have not so elegant view of URL: url(r'^services/restart/(?P[\w-]+)$', views.service_restart, name='service_restart'). in v1 I can use YAML docstring, but I need to find solution for v2. Can someone help with this? |
@JenishGnanasicamani Found one solution:
In my case, I still don't know how to setup only POST request for this view. Any ideas? |
Found solution for my case: |
@vladmir |
Is there a solution for the Function Based View ? I found solutions only for CBV |
@likaiguo I am not able to get the data entry filed like your example here. I am using 'ViewSet' class for the views class to inherit from. And I set the Settings.py file as you have mentioned here. |
Hi all, I have recently integrated Django Rest Swagger 2 into an existing project, I faced alot of issues, and resolved them by finding solutions at different forums. Now I have documented all the required steps here: https://github.com/m-haziq/django-rest-swagger-docs with all possible issues I could face and their solutions. |
Hello, @m-haziq djangorestframework==3.6.4 I have used your documentation but still I'm not able to pass parameters in POST and GET methods. Here is my view: class PostAddActivitySet(APIView):
|
Hi @GyanP , there are two possibilities which are causing you issue: |
SWAGGER_SETTINGS = { Is not working to show the INPUT boxes for each JSON param of request body for POST/PUT. Any more changes to do? Using: |
solution :
also added parsers DRF SETTINGS in this order:
|
hii guys , |
I have integrated swagger with django rest framework, but the swagger docs does not create a input box to post data for post request.
Here is my view class snippet,
class TeamViewList(APIView, BaseView):
"""
Class based view to handle all operations related to Team Model
"""
logger = logging.getLogger(name)
def get_serializer(self):
return serializers.TeamSerializer
def post(self, request):
"""
To create a new team
"""
try:`
Url Mapping:
urlpatterns = [ url(r'^role/$', rest_views.UserTeamRoleView.as_view(), name='user_team_role'), url(r'^teams/$', rest_views.TeamViewList.as_view(), name='team_list'), url(r'^teams/(?P<name>[_a-zA-Z0-9\-]+)$', rest_views.TeamViewDetail.as_view(), name='team_detail'),
Generated Docs
There is no way to pass the input parameters for the post request.
The text was updated successfully, but these errors were encountered: