2π
Now whenever I am trying to do a POST call using the url path /api/v1/notification/pk/property_id {where pk and property_id} passed as url parameter.
In POST
call, you donβt pass the data in url. It must be passed as request body.
POST
/api/v1/notifications/
Request body:
{
"property_info": "<id>",
"property_type": "<id>"
}
In the ListCreateAPIView
, there is no post
method, if you want to override the view for a POST
call make use of def create(self, request):
method.
Have a look at the implementation[1] of CreateModelMixin
.
[1] https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/mixins.py#L14-L23
[2] http://www.django-rest-framework.org/api-guide/generic-views/#listcreateapiview
π€Saurabh Kumar
Source:stackexchange.com