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)[source]

Bases: object

Routes as methods of Isogeo API used to manipulate metadatas (resources).

catalogs(metadata: isogeo_pysdk.models.metadata.Metadata) → list[source]

Returns asssociated catalogs with a metadata. Just a shortcut.

Parameters:metadata (Metadata) – metadata object
Return type:list
create(workgroup_id: str, metadata: isogeo_pysdk.models.metadata.Metadata, check_exists: bool = 1, return_basic_or_complete: bool = 0) → isogeo_pysdk.models.metadata.Metadata[source]

Add a new metadata to a workgroup.

Parameters:
  • workgroup_id (str) – identifier of the owner workgroup
  • metadata (Metadata) – Metadata model object to create
  • check_exists (bool) –

    check if a metadata with the same title already exists into the workgroup:

    • 0 = no check
    • 1 = compare name [DEFAULT]
  • return_basic_or_complete (bool) –

    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 = basic (only the _id, title and attributes passed for the creation) [DEFAULT]
    • 1 = complete (make an addtionnal request)
Return type:

Metadata

delete(metadata_id: str) → requests.models.Response[source]

Delete a metadata from Isogeo database.

Parameters:metadata_id (str) – identifier of the resource to delete
download_xml(metadata: isogeo_pysdk.models.metadata.Metadata) → requests.models.Response[source]

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: str) → bool[source]

Check if the specified resource exists and is available for the authenticated user.

Parameters:resource_id (str) – identifier of the resource to verify
get(metadata_id: str, include: tuple = ()) → isogeo_pysdk.models.metadata.Metadata[source]

Get complete or partial metadata about a specific metadata (= resource).

Parameters:
  • metadata_id (str) – metadata UUID to get
  • include (list) –

    subresources that should be included. Available values:

    • one or various from MetadataSubresources (Enum)
    • ”all” to get complete metadata with every subresource included
keywords(metadata: isogeo_pysdk.models.metadata.Metadata, include: list = ['_abilities', 'count', 'thesaurus']) → list[source]

Returns asssociated keywords with a metadata. Just a shortcut.

Parameters:
  • metadata (Metadata) – metadata object
  • include (list) – subresources that should be returned. Available values:
  • ‘_abilities’
  • ‘count’
  • ‘thesaurus’
Return type:list
update(metadata: isogeo_pysdk.models.metadata.Metadata) → isogeo_pysdk.models.metadata.Metadata[source]

Update a metadata, but ONLY the root attributes, not the subresources.

Parameters:metadata (Metadata) – metadata object to update