isogeo_pysdk.api.routes_metadata module
Isogeo API v1 - API Routes for Resources (= Metadata) entity
See: http://help.isogeo.com/api/complete/index.html#definition-resource
- class isogeo_pysdk.api.routes_metadata.ApiMetadata(api_client=None)
Bases:
object
Routes as methods of Isogeo API used to manipulate metadatas (resources).
- catalogs(metadata)
Returns asssociated catalogs with a metadata. Just a shortcut.
- create(workgroup_id, metadata, return_basic_or_complete=0)
Add a new metadata to a workgroup.
- Parameters
workgroup_id (str) – identifier of the owner workgroup
metadata (Metadata) – Metadata model object to create
return_basic_or_complete (int) –
creation of metada uses a bulk script. So, by default API does not return the complete object but the minimal info. This option allow to overrides the basic behavior. Options:
0 = dry (only the _id, title and attributes passed for the creation) [DEFAULT]
1 = basic without any include (requires an additionnal request)
2 = complete with all include (requires an additionnal request)
- Return type
- Example
# create a local metadata my_metadata = Metadata( title="My awesome metadata", # required type="vectorDataset", # required abstract="Here comes my **awesome** description with a piece of markdown." # optional ) # push it online isogeo.metadata.create( workgroup_id=WORKGROUP_UUID, metadata=my_metadata )
- delete(metadata_id)
Delete a metadata from Isogeo database.
- download_xml(metadata)
Download the metadata exported into XML ISO 19139.
- Parameters
metadata (Metadata) – metadata object to export
- Return type
Response
- Example
# get the download stream xml_stream = isogeo.metadata.download_xml(Metadata(_id=METADATA_UUID)) # write it to a file with open("./{}.xml".format("metadata_exported_as_xml"), "wb") as fd: for block in xml_stream.iter_content(1024): fd.write(block)
- exists(resource_id)
Check if the specified resource exists and is available for the authenticated user.
- get(metadata_id, include=())
Get complete or partial metadata about a specific metadata (= resource).
- keywords(metadata, include=('_abilities', 'count', 'thesaurus'))
Returns asssociated keywords with a metadata. Just a shortcut.
- Parameters
‘_abilities’
‘count’
‘thesaurus’
- Return type
- update(metadata, _http_method='PATCH')
Update a metadata, but ONLY the root attributes, not the subresources.
Certain attributes of the Metadata object to update are required:
_id
editionProfile
type
See: https://github.com/isogeo/isogeo-api-py-minsdk/issues/116
- Parameters
- Return type
- Returns
the updated metadata or the request error.
- Example
# get a metadata my_metadata = isogeo.metadata.get(metadata_id=METADATA_UUID) # add an updated watermark in the abstract my_metadata.abstract += '**Updated!**' # push it online isogeo.metadata.update(my_metadata)