API Views¶
Warning
Check your groups!
When creating a Target
via the API, one of the accepted parameters is a list of groups that will have permission
to view the Target
. If you neglect to specify any groups, your Target
will only be visible to the user that
created the Target
. Please be sure to specify groups!!
Tip
Better API documentation
The available parameters for RESTful API calls are not available here. However, if you navigate to /api/targets/
and click the OPTIONS
button, you can easily view all of the available parameters.
- class tom_targets.api_views.TargetViewSet(**kwargs)¶
Viewset for Target objects. By default supports CRUD operations. See the docs on viewsets: https://www.django-rest-framework.org/api-guide/viewsets/
To view supported query parameters, please use the
OPTIONS
endpoint, which can be accessed through the web UI.Please note that ``groups`` are an accepted query parameters for the ``CREATE`` endpoint. The ``groups`` parameter will specify which ``groups`` can view the created Target. If no ``groups`` are specified, the ``Target`` will only be visible to the user that created the ``Target``. Make sure to check your ``groups``!!
In order to create new
TargetName
orTargetExtra
objects, a dictionary with the new values must be appended to thealiases
ortargetextra_set
lists. Ifid
is included, the API will attempt to update an existingTargetName
orTargetExtra
. If noid
is provided, the API will attempt to create new entries.TargetName
andTargetExtra
objects can only be deleted or specifically retrieved via the/api/targetname/
or/api/targetextra/
endpoints.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- serializer_class¶
alias of
tom_targets.serializers.TargetSerializer
- class tom_targets.api_views.TargetNameViewSet(**kwargs)¶
Viewset for TargetName objects. Only
GET
andDELETE
operations are permitted.To view available query parameters, please use the OPTIONS endpoint, which can be accessed through the web UI.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- class tom_targets.api_views.TargetExtraViewSet(**kwargs)¶
Viewset for TargetExtra objects. Only
GET
andDELETE
operations are permitted.To view available query parameters, please use the OPTIONS endpoint, which can be accessed through the web UI.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- class tom_targets.api_views.TargetListViewSet(**kwargs)¶
Viewset for TargetList objects. Only
GET
andDELETE
operations are permitted.To view available query parameters, please use the OPTIONS endpoint, which can be accessed through the web UI.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- serializer_class¶
alias of
tom_targets.serializers.TargetListSerializer