Skip to content

Commit

Permalink
Added documentation and example for metadata upload (#267)
Browse files Browse the repository at this point in the history
* Added documentation and example for metadata upload

* Added documentation and API schema for metadata upload
  • Loading branch information
ahmdthr authored Jan 18, 2023
1 parent a7ba63f commit 0fac5fb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
24 changes: 24 additions & 0 deletions devel/api/V2/schema/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,30 @@ paths:
schema:
$ref: '#/components/schemas/PaginatedSimpleMapList'
description: ''
/api/v2/datasets/{id}/metadata/:
put:
operationId: datasets_metadata_upload
description: API endpoint allowing to upload ISO-19115 compliant XML metadata for the dataset.
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this dataset.
required: true
tags:
- datasets
security:
- cookieAuth: []
- basicAuth: []
- {}
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Dataset'
description: ''
/api/v2/documents/:
get:
operationId: documents_list
Expand Down
22 changes: 22 additions & 0 deletions devel/api/usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,28 @@ Example:
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
3. Metadata
A complete metadata file conforming to ISO-19115 can be uploaded for a dataset.
- API: ``PUT /api/v2/datasets/{dataset_id}/metadata``
- Status Code: ``200``
Example:
.. code-block:: python
import requests
url = "http://localhost:8000/api/v2/datasets/1/metadata"
files=[
('metadata_file',('metadata.xml',open('/home/user/metadata.xml','rb'),'text/xml'))
]
headers = {
'Authorization': 'Basic dXNlcjpwYXNzd29yZA=='
}
response = requests.request("PUT", url, headers=headers, data={}, files=files)
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.
Expand Down

0 comments on commit 0fac5fb

Please sign in to comment.