geonode.documents.api.views =========================== .. py:module:: geonode.documents.api.views Attributes ---------- .. autoapisummary:: geonode.documents.api.views.logger Classes ------- .. autoapisummary:: geonode.documents.api.views.DocumentViewSet Module Contents --------------- .. py:data:: logger .. py:class:: DocumentViewSet Bases: :py:obj:`dynamic_rest.viewsets.DynamicModelViewSet` API endpoint that allows documents to be viewed or edited. .. py:attribute:: http_method_names :value: ['get', 'patch', 'put', 'post'] .. py:attribute:: authentication_classes .. py:attribute:: permission_classes .. py:attribute:: filter_backends .. py:attribute:: queryset .. py:attribute:: serializer_class .. py:attribute:: pagination_class .. py:method:: perform_create(serializer) Function to create document via API v2. file_path: path to the file doc_file: the open file The API expect this kind of JSON: .. code-block:: json { "document": { "title": "New document", "metadata_only": true, "file_path": "/home/mattia/example.json" } } File path rappresent the filepath where the file to upload is saved. or can be also a form-data: .. code-block:: bash curl --location --request POST 'http://localhost:8000/api/v2/documents' \ --form 'title="Super Title2"' \ --form 'doc_file=@"/C:/Users/user/Pictures/BcMc-a6T9IM.jpg"' \ --form 'metadata_only="False"' .. py:method:: linked_resources(request, pk=None, *args, **kwargs)