Non-Model REST API Plugin Development? #1817
-
Hi All I've just started diving into making a REST API endpoint in my nautobot plugin. I'm trying to make a rest endpoint which is not tied to a nautobot model, and I'm totally lost. The nautobot documentation only includes examples for building a rest API endpoint using a ModelViewSet on a custom model. I tried following the django_rest_framework documentation for creating a non-model The solution to that problem was to add Trouble is, the documentation in django_rest_framework for non-model views leverages
At this point, I'm completely lost. Any tips or advice would be really appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
So These are set by default via the
You should safely be able to remove the EDIT: See below why |
Beta Was this translation helpful? Give feedback.
So
ModelViewSet
eventually inherits fromAPIView
(viaModelViewSet
>GenericViewSet
>GenericAPIView
>APIView
) and nowhere in the chain does it do anything fancy with theauthentication_classes
.These are set by default via the
settings.py
:You should safely be able to remove the
authentication_classes
andfrom their documented example.permission_classes
EDIT: See below why
permission_classes
must be set.