Skip to content

Commit

Permalink
improve documentation about upload tracking prograss API
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy committed May 2, 2024
1 parent 5131055 commit 848aa67
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 155 deletions.
139 changes: 0 additions & 139 deletions devel/api/linked_resources/index.rst

This file was deleted.

60 changes: 44 additions & 16 deletions devel/api/usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,29 +281,39 @@ Example:
Tracking dataset upload progress
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When an upload request is executed, GeoNode creates an “upload objectand keeps updating its state and progress (it’s a property attribute, calculated on getting the response) attributes as the resource is being created and configured in Geoserver.
The states used include:
- READY
- RUNNING
- PENDING
- WAITING
- INCOMPLETE
- COMPLETE
- INVALID
- PROCESSED
When the dataset is successfully uploaded, the final state of the upload is set to ``PROCESSED`` and progress is calculated as ``100.0``.
In order to view ongoing uploads, and their states, you can use the API ``GET /api/v2/uploads`` or ``GET /api/v2/uploads/{id}`` if the upload id is known. You can also filter uploads with state.
Eg ``GET /api/v2/uploads?filter{state}=PROCESSED``
When an upload request is executed, GeoNode creates an "Execution request" and keeps updating its state and progress (it’s a property attribute, calculated on getting the response) attributes as the resource is being created and configured in Geoserver.
An execution can be in one of the following status:
- ``ready``
- ``running``
- ``failed``
- ``finished``
When the dataset is successfully uploaded, the final state of the upload is set to ``finished``.
In order to view status of the execution, the API method ``GET /api/v2/executionrequest/{execution_id}`` where ``{execution_id}`` is the value returned by the initial call to the upload API.
The returned object contains, beyond all the information related to the execution, the inputs that were passed to the execution request, and output params specific to the type of execution.
In the case of a dataset upload, the output params contain the URL of the catalog page for the new datast.
.. code-block:: json
"output_params": {
"detail_url": [
"/catalogue/#/dataset/9881"
]
},
You can also filter executions by status.
Eg ``GET /api/v2/executionrequest?filter{action}=import&filter{source}=upload&filter{status}=finished``
Example:
.. code-block:: python
import requests
url = "https://master.demo.geonode.org/api/v2/uploads"
url = "https://stable.demo.geonode.org/api/v2/executionrequest/5f640b6b-8c51-4514-a054-995133fee107"
headers = {
'Authorization': 'Basic dXNlcjpwYXNzd29yZA=='
}
Expand Down Expand Up @@ -630,3 +640,21 @@ The ``status_url`` property returns the URL to track kthe progress of the reques
The operation will be completed once the ``status`` property is updated with the value ``finished``.
Linked Resources Listing and Details
------------------------------------
All available linked_resources can be listed with API ``GET /api/v2/resources/{pk}/linked_resources``.
where pk Resource base id
Example Requests:
^^^^^^^^^^^^^^^^^
1. List all resource links
.. code-block:: python
import requests
url = "https://master.demo.geonode.org/api/v2/resources/{pk}/linked_resources"
response = requests.request("GET", url)

0 comments on commit 848aa67

Please sign in to comment.