Data API Views¶
Warning
Check your groups!
When creating a DataProduct via the API and you have set TARGET_PERMISSIONS_ONLY to False, one of the
accepted parameters is a list of groups that will have permission to view the DataProduct. If you neglect to
specify any groups, your DataProduct will only be visible to the user that created the DataProduct. 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/reduceddatums/ and click the OPTIONS button, you can easily view all of the available parameters.
From the GET view, you can experiment with the available filters and see an example of the request.
- class tom_dataproducts.api_views.DataProductViewSet(**kwargs)¶
Viewset for DataProduct objects. Supports list, create, and delete.
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 ``DataProduct``. If no ``groups`` are specified, the ``DataProduct`` will only be visible to the user that created the ``DataProduct``. Make sure to check your ``groups``!!
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- filterset_class¶
alias of
DataProductFilter
- get_queryset()¶
Gets the set of
DataProductobjects that the user has permission to view.- Returns:
Set of
DataProductobjects- Return type:
QuerySet
- class tom_dataproducts.api_views.ReducedDatumViewSet(**kwargs)¶
Viewset for ReducedDatum objects. Supports list, create, and delete.
To view supported 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.
- filterset_class¶
alias of
ReducedDatumFilter
- class tom_dataproducts.filters.DataProductFilter(data=None, queryset=None, *, request=None, prefix=None)¶
- Filters are available for DataProduct objects:
target_name: Filter by target name or alias.
facility: Filter by the facility of the observation record associated with the data product.
- Access these filters via the API endpoint:
GET /api/dataproducts/?target_name=<name>&facility=<facility>
- class tom_dataproducts.filters.ReducedDatumFilter(data=None, queryset=None, *, request=None, prefix=None)¶
- Filters are available for ReducedDatum objects:
target__id: Filter by target ID.
target_name: Filter by target name or alias.
data_product_pk: Filter by the primary key of the associated DataProduct.
data_product_product_id: Filter by the “Product ID” or filename of the associated DataProduct.
source_name: Filter by the name of the source.
data_type: Filter by the type of data (e.g., ‘photometry’, ‘spectrum’).
- Access these filters via the API endpoint:
GET /api/reduceddatums/?target__id=<id>&data_type=<type>