2๐
โ
If your viewset already is tied to a router then you can use
@detail_route, or @list_route to point it to a url with the name of your viewset method.
Check this part of documentation : http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
Otherwise, it would make sense to use plan view class extending APIView and pointing a URL to it.
Viewsets are mainly useful when tied to a router.
๐คiankit
Source:stackexchange.com