Developer Interface

Entity API

This part of the documentation covers all the interfaces of pyPreservica EntityAPI object.

class pyPreservica.EntityAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook: Callable | None = None, credentials_path: str = 'credentials.properties')[source]

A class for the Preservica Repository web services Entity API

https://us.preservica.com/api/entity/documentation.html

The EntityAPI allows users to interact with the Preservica repository

add_access_representation(entity: Entity, access_file: str, name: str = 'Access')[source]

Add a new Access representation to an existing asset.

Parameters:
  • entity (Entity) – The existing asset which will receive the new representation

  • access_file (str) – The new digital file

  • name (str) – The name of the new access representation defaults to “Access”

Returns:

add_group_metadata(csv_file: str) str[source]

Perform bulk additions of metadata with a CSV file. This is designed for metadata which populates a New Gen Metadata Group Returns The process ID which will track the updates Requires DataManagement permission

Parameters:

csv_file (str) – The path of the CSV metadata file

Returns:

The process ID

Return type:

str

add_identifier(entity: Entity, identifier_type: str, identifier_value: str)[source]

Add a new external identifier to an Entity object

Parameters:
  • entity (Entity) – The entity the identifier is added to

  • identifier_type (str) – The identifier type

  • identifier_value (str) – The identifier value

Returns:

An internal id for this external identifier

Return type:

str

add_metadata(entity: EntityT, schema: str, data) EntityT[source]

Add a new descriptive XML document to an existing entity

Parameters:
  • entity (Entity) – The entity to add the metadata to

  • schema (str) – The metadata schema URI

  • data (data) – The XML document as a string or as file bytes

Returns:

The updated entity with the new metadata

Return type:

Entity

add_metadata_as_fragment(entity: EntityT, schema: str, xml_fragment: str) EntityT[source]

Add a metadata fragment with a given namespace URI to an Entity Don’t parse the xml fragment which may add extra namespaces etc

Returns The updated Entity

Parameters:
  • xml_fragment (str) – The new XML as a string

  • entity (Entity) – The entity to update

  • schema (str) – The schema URI of the XML document

Return type:

Entity

add_physical_asset(title: str, description: str, parent: Folder, security_tag: str = 'open') Asset[source]

Create a new asset which represents a physical object

Returns Asset

Parameters:
  • title (str) – The title of the new Asset

  • description (str) – The description of the new Asset

  • parent (Folder) – The parent folder

  • security_tag (str) – The security tag, defaults to open

Returns:

The new physical object

Return type:

Asset

add_relation(from_entity: Entity, relationship_type: str, to_entity: Entity)[source]

Add a new relationship link between two Assets or Folders

Parameters:
  • from_entity (Entity) – The Source entity to link from

  • to_entity (Entity) – The Target entity

  • relationship_type (str) – The Relationship type

Returns:

relationship_type

Return type:

str

add_thumbnail(entity: Entity, image_file: str)[source]

Set the thumbnail for the entity to the uploaded image

Supported image formats are png, jpeg, tiff, gif and bmp. The image must be 10MB or less in size.

Parameters:
  • entity (Entity) – The entity

  • image_file (str) – The path to the image

all_descendants(folder: Folder | str | Entity | None = None) Generator[Entity, None, None][source]

Return all child entities recursively of a folder or repository down to the assets using a lazy iterator. The paging is done internally using a default page size of 100 elements. Callers can iterate over the result to get all children with a single call.

Parameters:

folder (str) – The parent folder reference, None for the children of root folders

Returns:

A set of entity objects (Folders and Assets)

Return type:

set(Entity)

all_events() Generator[source]

Returns a list of events for the user’s tenancy

This method uses a generator function to make repeated calls to the server for every page of results.

Returns:

A generator of events

Return type:

Generator

all_ingest_events(previous_days: int = 1) Generator[source]

Returns a list of ingest only events for the user’s tenancy

This method uses a generator function to make repeated calls to the server for every page of results.

Parameters:

previous_days (int) – The number of days to look back for events

Returns:

A generator of events

Return type:

Generator

all_metadata(entity: Entity) Generator[Tuple[str, str], None, None][source]

Retrieve all metadata fragments on an entity

Returns XML documents in a tuple

Parameters:

entity (Entity) – The entity with the metadata

Returns:

A list of Tuples, the first value is the schmea and the second is the metadata

Return type:

Generator[Tuple[str, str]]

asset(reference: str) Asset[source]

Returns an asset object back by its internal reference identifier

Parameters:

reference (str) – The unique identifier for the asset usually its uuid

Returns:

The Asset object

Return type:

Asset

Raises:

RuntimeError – if the identifier is incorrect

bitstream(url: str) Bitstream[source]

Fetch a bitstream object from the server using its URL

Parameters:

url (str) – The URL to the bitstream

Returns:

a bitstream object

Return type:

Bitstream

bitstream_bytes(bitstream: Bitstream, chunk_size: int = 4096) BytesIO[source]

Download a file represented as a Bitstream to a byteIO array

Returns the byteIO Returns None if the file does not contain the correct number of bytes (default 2k)

Parameters:
  • chunk_size – The buffer copy chunk size in bytes default

  • bitstream (Bitstream) – A Bitstream object

Returns:

The file in bytes

Return type:

byteIO

bitstream_chunks(bitstream: Bitstream, chunk_size: int = 4096) Generator[source]

Generator function to return bitstream chunks, allows the clients to process chunks as they are downloaded.

Parameters:
  • bitstream (Bitstream) – A bitstream object

  • chunk_size (int) – Optional size of the chunks to be downloaded

Returns:

Iterator

Return type:

Generator

bitstream_content(bitstream: Bitstream, filename: str, chunk_size: int = 4096) int[source]

Download a file represented as a Bitstream to a local filename

Returns the number of bytes written to the file Returns None if the file does not contain the correct number of bytes

Parameters:
  • chunk_size – The buffer copy chunk size in bytes default

  • bitstream (Bitstream) – A Bitstream object

  • filename (str) – The filename to write the bytes to

Returns:

The size of the file in bytes

Return type:

int

bitstream_location(bitstream: Bitstream) list[source]

” Retrieves information about a bitstreams storage locations

Parameters:

bitstream (Bitstream) – The bitstream object

Returns:

A list of strings containing all the storage locations of this bitstream

Return type:

list

bitstreams_for_asset(asset: Asset | Entity) Iterable[Bitstream][source]

Return all the active bitstreams within an asset. This includes all the representations and content objects

Parameters:

asset – The asset

Returns:

Iterable

children(folder: str | Folder | None = None, maximum: int = 100, next_page: str = None) PagedSet[source]

Return the child entities of a folder one page at a time. The caller is responsible for requesting the next page of results.

This function is deprecated, use descendants instead as the paging is automatic

Parameters:
  • folder (str) – The parent folder reference, None for the children of root folders

  • maximum (int) – The maximum size of the result set in each page

  • next_page (str) – A URL for the next page of results

Returns:

A set of entity objects

Return type:

set(Entity)

content_object(reference: str) ContentObject[source]

Returns a content object back by its internal reference identifier

Parameters:

reference (str) – The unique identifier for the content object usually its uuid

Returns:

The content object

Return type:

ContentObject

Raises:

RuntimeError – if the identifier is incorrect

content_objects(representation: Representation) list[ContentObject][source]

Return a list of content objects for a representation

Parameters:

representation (Representation) – The representation

Returns:

List of content objects

Return type:

list(ContentObject)

create_folder(title: str, description: str, security_tag: str, parent: str = None) Folder[source]

Create a new Folder in the repository If parent is None then the new Folder will be created at the root of the repository

Returns The updated Entity

Parameters:
  • title – The title of the new folder

  • description – The description of the new folder

  • security_tag – The security_tag of the new folder

  • parent – The parent of the new folder, Can be None to create a root Folder

delete_asset(asset: Asset, operator_comment: str, supervisor_comment: str, credentials_path: str = 'credentials.properties')[source]

Initiate and approve the deletion of an asset.

Parameters:
  • credentials_path

  • asset (Asset) – The asset to delete

  • operator_comment (str) – The comments from the operator which are added to the logs

  • supervisor_comment (str) – The comments from the supervisor which are added to the logs

Returns:

The asset reference

Return type:

str

delete_folder(folder: Folder, operator_comment: str, supervisor_comment: str, credentials_path: str = 'credentials.properties')[source]

Initiate and approve the deletion of a folder.

Parameters:
  • folder (Folder) – The folder to delete

  • operator_comment (str) – The comments from the operator which are added to the logs

  • supervisor_comment (str) – The comments from the supervisor which are added to the logs

Returns:

The folder reference

Return type:

str

delete_identifiers(entity: Entity, identifier_type: str | None = None, identifier_value: str | None = None) Entity[source]

Delete identifiers on an Entity object

Setting identifier_type and identifier_value to None acts a wildcard deleting all identifiers on the entity

Parameters:
  • entity (Entity) – The entity the identifiers are deleted from

  • identifier_type (str) – The identifier type

  • identifier_value (str) – The identifier value

Returns:

entity

Return type:

Entity

delete_metadata(entity: Entity, schema: str) EntityT[source]

Delete an existing descriptive XML document on an entity by its schema This call will delete all fragments with the same schema

Parameters:
  • entity (Entity) – The entity to add the metadata to

  • schema (str) – The metadata schema URI

Returns:

The updated Entity

Return type:

Entity

delete_relationships(entity: Entity, relationship_type: str | None = None)[source]

Delete a relationship between two entities by its internal id

This function only deletes the relationship FROM the specified entity to another entity It does not delete relationships TO this entity

If relationship_type is not specified all relationships FROM this entity are deleted.

Parameters:
  • entity (Entity)

  • relationship_type (str) – The relationship type to delete

descendants(folder: Folder | str | Entity | None = None) Generator[Entity, None, None][source]

Return the immediate child entities of a folder using a lazy iterator. The paging is done internally using a default page size of 100 elements. Callers can iterate over the result to get all children with a single call.

Parameters:

folder (str) – The parent folder reference, None for the children of root folders

Returns:

A set of entity objects (Folders and Assets)

Return type:

set(Entity)

download(entity: Entity, filename: str) str[source]

Download the first generation of the access representation of an asset

Parameters:
  • entity (Entity) – The entity

  • filename (str) – The file the image is written to

Returns:

The filename

Return type:

str

download_opex(pid: str) str[source]

Download a completed OPEX export using the workflow process ID

Parameters:

pid (str) – A process id which identifiers the export workflow

Returns:

The downloaded zip file name

Return type:

str

entity(entity_type: EntityType, reference: str) EntityT[source]

Returns a generic entity based on its reference identifier

Parameters:
  • entity_type (EntityType) – The type of entity

  • reference (str) – The unique identifier for the entity

Returns:

The entity either Asset, Folder or ContentObject

Return type:

Entity

Raises:

RuntimeError – if the identifier is incorrect

entity_events(entity: Entity) Generator[source]

Returns a list of event actions performed against this entity

This method uses a generator function to make repeated calls to the server for every page of results.

Parameters:

entity (Entity) – The entity

Returns:

A list of events

Return type:

list

entity_from_event(event_id: str) Generator[source]

Returns an entity from the user’s tenancy :rtype: Generator

entity_identifiers(entity: Entity, external_identifier_type: str | None = None) set[ExternIdentifier][source]

Get all external identifiers on an entity

Returns the set of external identifiers on the entity

Parameters:
  • entity (Entity) – The Entity (Asset or Folder)

  • external_identifier_type – Optional identifier type to filter the results

export_opex(entity: Entity, **kwargs) str[source]

Initiates export of the entity and downloads the opex package Blocks until the package is downloaded

By default, includes content, metadata with the latest active generations and the parent hierarchy.

Arguments are kwargs map

IncludeContent IncludeMetadata IncludedGenerations IncludeParentHierarchy

Parameters:
  • entity (Entity) – The entity to export Asset or Folder

  • IncludeContent (str) – “Content”, “NoContent”

  • IncludeMetadata (str) – “Metadata”, “NoMetadata”, “MetadataWithEvents”

  • IncludedGenerations (str) – “LatestActive”, “AllActive”, “All”

  • IncludeParentHierarchy (str) – “true”, “false”

Returns:

The path to the opex ZIP file

Return type:

str

export_opex_async(entity: Entity, **kwargs) str[source]

Initiates export of the entity returns an id to track progress

export_opex_sync(entity: Entity, **kwargs) str[source]

Initiates export of the entity and downloads the opex package Blocks until the package is downloaded

By default, includes content, metadata with the latest active generations and the parent hierarchy.

Arguments are kwargs map

IncludeContent IncludeMetadata IncludedGenerations IncludeParentHierarchy

folder(reference: str) Folder[source]

Returns a folder object back by its internal reference identifier

Parameters:

reference (str) – The unique identifier for the folder usually its uuid

Returns:

The Folder object

Return type:

Folder

Raises:

RuntimeError – if the identifier is incorrect

generation(url: str, content_ref: str = None) Generation[source]

Retrieve a list of generation objects

Parameters:
  • url

  • content_ref

Returns:

Generation

Return type:

Generation

generations(content_object: ContentObject) list[Generation][source]

Return a list of Generation objects for a content object

Parameters:

content_object (ContentObject) – The content object

Returns:

list of generations

Return type:

list(Generation)

get_async_progress(pid: str) str[source]

Return the status of a running process

Parameters:

pid – The progress ID

Returns:

Workflow status

Return type:

str

has_thumbnail(entity: Entity) bool[source]

Does the entity have a thumbnail image attached Returns false if the entity has no thumbnail

Parameters:

entity – The entity

identifier(identifier_type: str, identifier_value: str) set[EntityT][source]

Return a set of entities with external identifiers which match the type and value

Parameters:
  • identifier_type (str) – The identifier type

  • identifier_value (str) – The identifier value

Returns:

Set of entity objects which have a reference and title attribute

Return type:

set(Entity)

identifiers_for_entity(entity: Entity) set[Tuple][source]

Return a set of identifiers which belong to the entity

Parameters:

entity (Entity) – The entity

Returns:

Set of identifiers as tuples

Return type:

set(Tuple)

integrity_checks(bitstream: Bitstream) Generator[source]

Return integrity checks for a bitstream

merge_assets(assets: list[Asset], title: str, description: str) str[source]

Create a new Asset with the content from each Asset in supplied list This call will create a new multipart Asset which contains all the content from list of Assets.

The return value is the progress status of the merge operation.

merge_folder(folder: Folder) str[source]

Create a new Asset with the content from each Asset in the Folder

This call will create a new multipart Asset which contains all the content from the Folder.

The new Asset which is created will have the same title, description and parent as the Folder.

The return value is the progress status of the merge operation.

metadata(uri: str) str[source]

Fetch the metadata document by its identifier, this is the key from the entity metadata map

Parameters:

uri (str) – The metadata identifier

Returns:

An XML document as a string

Return type:

str

metadata_for_entity(entity: Entity, schema: str) str | None[source]

Fetch the first metadata document which matches the schema URI from an entity

param Entity entity:

The entity containing the metadata

param str schema:

The metadata schema URI

return:

The first XML document on the entity matching the schema URI

rtype:

str

metadata_tag_for_entity(entity: Entity, schema: str, tag: str, isXpath: bool = False) str | None[source]

Retrieve the first value of the tag from a metadata template given by schema

Returns XML document as a string

Parameters:
  • isXpath – True if the tag name is a fully qualified xpath expression

  • entity – The entity with the metadata

  • schema – The schema URI

  • tag – The tag name

move(entity: EntityT, dest_folder: Folder) EntityT[source]

Move an entity (asset or folder) to a new folder This call is an alias for the move_sync (blocking) method.

Parameters:
  • entity (Entity) – The entity to move either asset or folder

  • dest_folder (Entity) – The new destination folder. This can be None to move a folder to the root of the repository

Returns:

The updated entity

Return type:

Entity

move_async(entity: Entity, dest_folder: Folder) str[source]

Move an Entity (Asset or Folder) to a new Folder If dest_folder is None then the entity must be a Folder and will be moved to the root of the repository

Returns a process ID asynchronous (without blocking)

Returns The updated Entity

Parameters:
  • entity (Entity) – The entity to move either asset or folder

  • dest_folder (Entity) – The new destination folder. This can be None to move a folder to the root of the repository

Returns:

Progress ID token

Return type:

str

move_sync(entity: EntityT, dest_folder: Folder) EntityT[source]

Move an entity (asset or folder) to a new folder This call blocks until the move is complete

Parameters:
  • entity (Entity) – The entity to move either asset or folder

  • dest_folder (Entity) – The new destination folder. This can be None to move a folder to the root of the repository

Returns:

The updated entity

Return type:

Entity

relationships(entity: Entity, page_size: int = 25) Generator[Relationship, None, None][source]

List the relationship links between entities

Parameters:
  • page_size – The number of items returned in a single server call

  • entity – The Source Entity

Type:

page_size: int

Type:

entity: An Entity type such as Asset, Folder etc

Returns:

Generator

Return type:

Relationship

remove_thumbnail(entity: Entity)[source]

Remove the thumbnail for the entity to the uploaded image

Parameters:

entity (Entity) – The entity with the thumbnail

replace_generation_async(content_object: ContentObject, file_name, fixity_algorithm=None, fixity_value=None) str[source]

Replace the last active generation of a content object with a new digital file.

Starts the workflow and returns a process ID

Parameters:
  • content_object (ContentObject) – The content object to replace

  • file_name (str) – The path to the new content object

  • fixity_algorithm (str) – Optional fixity algorithm

  • fixity_value (str) – Optional fixity value

Returns:

Process ID

Return type:

str

replace_generation_sync(content_object: ContentObject, file_name, fixity_algorithm=None, fixity_value=None) str[source]

Replace the last active generation of a content object with a new digital file.

Starts the workflow and blocks until the workflow completes.

Parameters:
  • content_object (ContentObject) – The content object to replace

  • file_name (str) – The path to the new content object

  • fixity_algorithm (str) – Optional fixity algorithm

  • fixity_value (str) – Optional fixity value

Returns:

Completed workflow status

Return type:

str

representations(asset: Asset) set[Representation][source]

Return a set of representations for the asset

Representations are used to define how the information object are composed in terms of technology and structure.

Parameters:

asset (Asset) – The asset containing the required representations

Returns:

Set of Representation objects

Return type:

set(Representation)

save(entity: EntityT) EntityT[source]

Updates the title and description of an entity The security tag and parent are not saved via this method call

Parameters:

entity (Entity) – The entity (asset, folder, content_object) to be updated

Returns:

The updated entity

Return type:

Entity

security_tag_async(entity: Entity, new_tag: str)[source]

Change the security tag of an asset or folder This is a non blocking call which returns immediately.

Parameters:
  • entity (Entity) – The entity (asset, folder) to be updated

  • new_tag (str) – The new security tag to be set on the entity

Returns:

A progress id which can be used to monitor the workflow

Return type:

str

security_tag_sync(entity: EntityT, new_tag: str) EntityT[source]

Change the security tag of an asset or folder This is a blocking call which returns after all entities have been updated.

Parameters:
  • entity (Entity) – The entity (asset, folder) to be updated

  • new_tag (str) – The new security tag to be set on the entity

Returns:

The updated entity

Return type:

Entity

thumbnail(entity: Entity, filename: str, size=Thumbnail.LARGE)[source]

Get the thumbnail image for an asset or folder

Parameters:
  • entity (Entity) – The entity

  • filename (str) – The file the image is written to

  • size (Thumbnail) – The size of the thumbnail image

Returns:

The filename

Return type:

str

update_identifiers(entity: Entity, identifier_type: str | None = None, identifier_value: str | None = None)[source]

Update external identifiers based on Entity and Type

Returns the internal identifier DB Key

Parameters:
  • entity – The entity to delete identifiers from

  • identifier_type – The type of the identifier to delete.

  • identifier_value – The value of the identifier to delete.

update_metadata(entity: EntityT, schema: str, data: Any) EntityT[source]

Update an existing descriptive XML document on an entity

Parameters:
  • entity (Entity) – The entity to add the metadata to

  • schema (str) – The metadata schema URI

  • data (data) – The XML document as a string or as a file bytes

Returns:

The updated Entity

Return type:

Entity

updated_entities(previous_days: int = 1) Generator[source]

Fetch a list of entities which have changed (been updated) over the previous n days.

This method uses a generator function to make repeated calls to the server for every page of results.

Parameters:

previous_days (int) – The number of days to check for changes.

Returns:

A list of entities

Return type:

list

user_security_tags(with_permissions: bool = False) dict[source]

Return security tags available for the current user

Parameters:

with_permissions (bool) – Return the permissions for each security tag

Returns:

dict of security tags

Return type:

dict

xml_asset(reference: str) str[source]

Retrieve an Asset by its reference

Returns an XML document of the full Asset

Parameters:

reference – The unique identifier of the entity

class pyPreservica.Generation[source]

Generations represent changes to content objects over time, as formats become obsolete new generations may need to be created to make the information accessible.

original

original generation (True or False)

active

active generation (True or False)

format_group

format for this generation

effective_date

effective date generation

bitstreams

list of Bitstream objects

properties

list of technical properties each property is dict object containing PUID, PropertyName and Value

formats

list of technical formats each format is dict object containing PUID, FormatName and FormatVersion

class pyPreservica.Bitstream[source]

Bitstreams represent the actual computer files as ingested into Preservica, i.e. the TIFF photograph or the PDF document

filename

The filename of the original bitstream

length

The file size in bytes of the original Bitstream

fixity

Dictionary object of fixity values for this bitstream, the key is the algorithm name and the value is the fixity value

class pyPreservica.Representation[source]

Representations are used to define how the information object are composed in terms of technology and structure.

rep_type

The type of representation

name

The name of representation

asset

The asset the representation belongs to

class pyPreservica.Entity[source]

Entity is the base class for assets, folders and content objects They all have the following attributes

reference

The unique internal reference for the entity

title

The title of the entity

description

The description of the entity

security_tag

The security tag of the entity

parent

The unique internal reference for this entity’s parent object

The parent of an Asset is always a Folder

The parent of a Folder is always a Folder or None for a folder at the root of the repository

The parent of a Content Object is always an Asset

metadata

A map of descriptive metadata attached to the entity.

The key of the map is the metadata identifier used to retrieve the metadata document and the value is the schema URI

entity_type

Assets have entity type EntityType.ASSET

Folders have entity type EntityType.FOLDER

Content Objects have entity type EntityType.CONTENT_OBJECT

class pyPreservica.Asset[source]

Asset represents the information object or intellectual unit of information within the repository.

reference

The unique internal reference for the asset

title

The title of the asset

description

The description of the asset

security_tag

The security tag of the asset

parent

The unique internal reference for this asset’s parent folder

metadata

A dict of descriptive metadata attached to the asset.

The key of the dict is the metadata identifier used to retrieve the metadata document and the value is the schema URI

entity_type

Assets have entity type EntityType.ASSET

class pyPreservica.Folder[source]

Folder represents the structure of the repository and contains both Assets and Folder objects.

reference

The unique internal reference for the folder

title

The title of the folder

description

The description of the folder

security_tag

The security tag of the folder

parent

The unique internal reference for this folder’s parent folder

metadata

A map of descriptive metadata attached to the folder.

The key of the map is the metadata identifier used to retrieve the metadata document and the value is the schema URI

entity_type

Assets have entity type EntityType.FOLDER

class pyPreservica.ContentObject[source]

ContentObject represents the internal structure of an asset.

reference

The unique internal reference for the content object

title

The title of the content object

description

The description of the content object

security_tag

The security tag of the content object

parent

The unique internal reference for this content object parent asset

metadata

A map of descriptive metadata attached to the content object.

The key of the map is the metadata identifier used to retrieve the metadata document and the value is the schema URI

entity_type

Content objects have entity type EntityType.CONTENT_OBJECT

class pyPreservica.EntityType(*values)[source]

Enumeration of the Entity Types

class pyPreservica.RelationshipDirection(*values)[source]
class pyPreservica.IntegrityCheck(check_type, success, date, adapter, fixed, reason)[source]

Class to hold information about completed integrity checks

Content API

This part of the documentation covers all the interfaces of pyPreservica ContentAPI object.

class pyPreservica.ContentAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook: Callable | None = None, credentials_path: str = 'credentials.properties')[source]

The ContentAPI class provides the search interface to the Preservica repository.

full_text(reference: str) str | None[source]

Return the full text index value for asset. The reference must be for an Asset.

If the Asset has been OCR’d then this will return the OCR text

Parameters:

reference – The Asset reference

Return The value of the full text index or None if not found:

Rtype str:

object_details(entity_type, reference: str, exclude_dates: bool = False) dict[source]
Parameters:
  • exclude_dates (bool) – excludes cmis:createdBy, cmis:creationDate, cmis:lastModifiedBy, cmis:lastModificationDate

  • entity_type

  • reference

Returns:

Dictionary of object attributes

search_fields(query: str = '%', fields: list[Field] | None = None, page_size: int = 25) Generator[source]

Run a search query with multiple fields

Parameters:
  • query – The main search query.

  • fields – List of search fields

  • page_size – The default search page size

Returns:

search result

search_index_filter_hits(query: str = '%', filter_values: dict | None = None) int[source]

Run a search query with filters and return the number of hits only

Parameters:
  • query – The main search query.

  • filter_values – Dictionary of index names and values

Returns:

Number of search results

search_index_filter_list(query: str = '%', page_size: int = 25, filter_values: dict | None = None, sort_values: dict | None = None) Generator[source]

Run a search query with optional filters

Parameters:
  • query – The main search query.

  • page_size – The default search page size

  • filter_values – Dictionary of index names and values

  • sort_values – Dictionary of sort index names and values

Returns:

search result

user_security_tags(with_permissions: bool = False)[source]

Return available security tags

Returns:

dict of security tags

Return type:

dict

Upload API

This part of the documentation covers all the interfaces of pyPreservica UploadAPI object.

pyPreservica.simple_asset_package(preservation_file: str | None = None, access_file: str | None = None, export_folder: str | None = None, parent_folder=None, compress=True, **kwargs)[source]

Create a Preservica package containing a single Asset from a single preservation file and an optional access file. The Asset contains one Content Object for each representation.

If only the preservation file is provided the asset has one representation

Parameters:
  • preservation_file (str) – Path to the preservation file

  • access_file (str) – Path to the access file

  • export_folder (str) – The package location folder

  • parent_folder (Folder) – The folder to ingest the asset into

  • compress (bool) – Compress the ZIP file

  • Title (str) – Asset Title

  • Description (str) – Asset Description

  • SecurityTag (str) – Asset SecurityTag

  • CustomType (str) – Asset CustomType

  • Preservation_Content_Title (str) – Title of the Preservation Representation Content Object

  • Preservation_Content_Description (str) – Description of the Preservation Representation Content Object

  • Access_Content_Title (str) – Title of the Access Representation Content Object

  • Access_Content_Description (str) – Description of the Access Representation Content Object

  • Asset_Metadata (dict) – Dictionary of Asset metadata documents

  • Identifiers (dict) – Dictionary of Asset rd party identifiers

pyPreservica.complex_asset_package(preservation_files_list: list | None = None, access_files_list: list | None = None, export_folder=None, parent_folder=None, compress=True, **kwargs)[source]

Create a Preservica package containing a single Asset from a multiple preservation files and optional access files. The Asset contains multiple Content Objects within each representation.

If only the preservation files are provided the asset has one representation

param list preservation_files_list:

Paths to the preservation files

param list access_files_list:

Paths to the access files

param str export_folder:

The package location folder

param Folder parent_folder:

The folder to ingest the asset into

param bool compress:

Compress the ZIP file

param str Title:

Asset Title

param str Description:

Asset Description

param str SecurityTag:

Asset SecurityTag

param str CustomType:

Asset CustomType

param str Preservation_Content_Title:

Title of the Preservation Representation Content Object

param str Preservation_Content_Description:

Description of the Preservation Representation Content Object

param str Access_Content_Title:

Title of the Access Representation Content Object

param str Access_Content_Description:

Description of the Access Representation Content Object

param dict Asset_Metadata:

Dictionary of Asset metadata documents

param dict Identifiers:

Dictionary of Asset rd party identifiers

optional kwargs map ‘Title’ Asset Title ‘Description’ Asset Description ‘SecurityTag’ Asset Security Tag ‘CustomType’ Asset Type ‘Preservation_Content_Title’ Content Object Title of the Preservation Object ‘Preservation_Content_Description’ Content Object Description of the Preservation Object ‘Access_Content_Title’ Content Object Title of the Access Object ‘Access_Content_Description’ Content Object Description of the Access Object ‘Preservation_Generation_Label’ Generation Label for the Preservation Object ‘Access_Generation_Label’ Generation Label for the Access Object ‘Asset_Metadata’ Map of metadata schema/documents to add to asset ‘Identifiers’ Map of asset identifiers ‘Preservation_files_fixity_callback’ Callback to allow external generated fixity values ‘Access_files_fixity_callback’ Callback to allow external generated fixity values ‘IO_Identifier_callback’ Callback to allow external generated Asset identifier ‘Preservation_Representation_Name’ Name of the Preservation Representation ‘Access_Representation_Name’ Name of the Access Representation

pyPreservica.csv_to_xml(csv_file, xml_namespace, root_element, file_name_column='filename', export_folder=None, additional_namespaces=None)[source]

Export the rows of a CSV file as XML metadata documents which can be added to Preservica assets

Parameters:
  • csv_file (str) – Path to the csv file

  • xml_namespace (str) – The XML namespace for the created XML documents

  • root_element (str) – The root element for the XML documents

  • file_name_column (str) – The CSV column which should be used to name the xml files

  • export_folder (str) – The path to the export folder

  • additional_namespaces (dict) – A map of prefix, uris to use as additional namespaces

pyPreservica.csv_to_xsd(csv_file, xml_namespace, root_element, export_folder=None, additional_namespaces=None)[source]

Create a XSD definition based on the csv file

pyPreservica.csv_to_cmis_xslt(csv_file, xml_namespace, root_element, title='Metadata Title', export_folder=None, additional_namespaces=None)[source]

Create a custom CMIS transform to display metadata within UA.

class pyPreservica.UploadAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook=None, credentials_path: str = 'credentials.properties')[source]
clean_upload_bucket(bucket_name: str, older_than_days: int = 90)[source]

Clean up objects in an upload bucket which are older than older_than_days.

ingest_web_video(url=None, parent_folder=None, **kwargs)[source]

Ingest a web video such as YouTube etc based on the URL

Parameters:
  • url (str) – URL to the YouTube video

  • parent_folder (Folder) – The folder to ingest the video into

  • Title (str) – Optional asset title

  • Description (str) – Optional asset description

  • SecurityTag (str) – Optional asset security tag

  • Identifiers (dict) – Optional asset 3rd party identifiers

  • Asset_Metadata (dict) – Optional asset additional descriptive metadata

  • callback (callback) – Optional upload progress callback

Raises:

RuntimeError

upload_buckets() dict[source]

Get a list of available upload buckets

Returns:

dict of bucket names and regions

upload_credentials(location_id: str) dict[source]

Retrieves temporary upload credentials (Amazon STS, or Azure SAS) for this location.

Returns:

dict

upload_locations() dict[source]

Upload locations are configured on the Sources page as ‘SIP Upload’. :return: dict

upload_zip_package(path_to_zip_package, folder=None, callback=None, delete_after_upload=False)[source]

Uploads a zip file package directly to Preservica and starts an ingest workflow

Parameters:
  • path_to_zip_package (str) – Path to the package

  • folder (Folder) – The folder to ingest the package into

  • callback (Callable) – Optional callback to allow the callee to monitor the upload progress

  • delete_after_upload (bool) – Delete the local copy of the package after the upload has completed

Returns:

preservica-progress-token to allow the workflow progress to be monitored

Return type:

str

Raises:

RuntimeError

upload_zip_package_to_Azure(path_to_zip_package: str, container_name: str, folder=None, delete_after_upload=False, show_progress=False)[source]

Uploads a zip file package to an Azure container connected to a Preservica Cloud System

Parameters:
  • path_to_zip_package (str) – Path to the package

  • container_name (str) – container connected to the ingest workflow

  • folder (Folder) – The folder to ingest the package into

  • delete_after_upload (bool) – Delete the local copy of the package after the upload has completed

upload_zip_package_to_S3(path_to_zip_package: str, bucket_name: str, folder=None, callback=None, delete_after_upload=False)[source]

Uploads a zip file package to an S3 bucket connected to a Preservica Cloud System

Parameters:
  • path_to_zip_package (str) – Path to the package

  • bucket_name (str) – Bucket connected to an ingest workflow

  • folder (Folder) – The folder to ingest the package into

  • callback (Callable) – Optional callback to allow the callee to monitor the upload progress

  • delete_after_upload (bool) – Delete the local copy of the package after the upload has completed

upload_zip_to_Source(path_to_zip_package: str, container_name, folder=None, delete_after_upload=False, show_progress=False)[source]

Uploads a zip file package to either an Azure container or S3 bucket depending on the Preservica system deployment

Parameters:
  • path_to_zip_package (str) – Path to the package

  • container_name (str) – container connected to the ingest workflow

  • folder (Folder) – The folder to ingest the package into

  • delete_after_upload (bool) – Delete the local copy of the package after the upload has completed

  • show_progress (bool) – Show upload progress bar

Retention Management API

https://eu.preservica.com/api/entity/documentation.html#/%2Fretention-policies

class pyPreservica.RetentionPolicy(name: str, reference: str)[source]
class pyPreservica.RetentionAssignment(entity_reference: str, policy_reference: str, api_id: str, start_date, expired=False)[source]
class pyPreservica.RetentionAPI(username=None, password=None, tenant=None, server=None, use_shared_secret=False, two_fa_secret_key: str = None, protocol: str = 'https', request_hook: Callable = None, credentials_path: str = 'credentials.properties')[source]
add_assignments(entity: Entity, policy: RetentionPolicy) RetentionAssignment[source]

Assign a retention policy to an Asset.

Parameters:
  • entity (Entity) – The Preservica Entity to assign a policy to

  • policy (RetentionPolicy) – The RetentionAssignment

Returns:

The RetentionAssignment

Return type:

RetentionAssignment

assignable_policy(reference: str, status: bool)[source]

Make a policy assignable

Parameters:
  • reference (str) – The policy ID

  • status (bool) – The assignable status

Returns:

assignments(entity: Entity) Generator[RetentionPolicy, None, None][source]

Return a list of retention policies for an entity.

Parameters:

entity (class:Entity) – The entity to fetch assignments for

Returns:

Policy assignments

Return type:

Generator[RetentionAssignment]

create_policy(**kwargs)[source]

Create a new policy

Arguments are kwargs map

Name Description SecurityTag StartDateField Period PeriodUnit ExpiryAction ExpiryActionParameters Restriction Assignable

delete_policy(reference: str)[source]

Delete a retention policy

Parameters:

reference (str) – The policy reference

policies() Generator[RetentionPolicy, None, None][source]

Return a list of all retention policies Returns a maximum of 100 policies for each call to the server

Returns:

Generator of retention policies

Return type:

Generator[RetentionPolicy]

policy(reference: str) RetentionPolicy[source]

Return a retention policy by reference

Parameters:

reference (str) – The policy reference

Returns:

The retention policy

Return type:

RetentionPolicy

policy_by_name(name: str) RetentionPolicy[source]

Return a retention policy by name

Parameters:

name (str) – The policy name

Returns:

The retention policy

Return type:

RetentionPolicy

remove_assignments(retention_assignment: RetentionAssignment)[source]

Delete a retention policy from an asset

Parameters:

retention_assignment (RetentionAssignment) – The Preservica Entity to assign a policy to

Returns:

The Asset Reference

Return type:

str

update_policy(reference: str, **kwargs)[source]

Update an existing policy

Arguments are kwargs map

Name Description SecurityTag StartDateField Period PeriodUnit ExpiryAction ExpiryActionParameters Restriction Assignable

Workflow API

Note

The Workflow API is available for Enterprise Preservica users

https://eu.preservica.com/api/admin/documentation.html

class pyPreservica.WorkflowContext(workflow_id: str, workflow_name: str)[source]

Defines a workflow context. The workflow context is the pre-defined workflow which is ready to run

class pyPreservica.WorkflowInstance(instance_id: int)[source]

Defines a workflow Instance. The workflow Instance is a context which has been executed

class pyPreservica.WorkflowAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook: Callable | None = None, credentials_path: str = 'credentials.properties')[source]

A class for calling the Preservica Workflow API

This API can be used to programmatically manage the Preservica Workflows.

https://demo.preservica.com/sdb/rest/workflow/documentation.html

get_workflow_contexts(definition: str) list[WorkflowContext][source]

Return a list of Workflow Contexts which have the same Workflow Definition

Parameters:

definition (str) – The Workflow Definition ID

Returns:

List of Workflow Contexts

Return type:

list

get_workflow_contexts_by_type(workflow_type: str) list[WorkflowContext][source]

Return a list of Workflow Contexts which have the same Workflow type

Parameters:

workflow_type (str) – The Workflow type Ingest, Access, Transformation or DataManagement

Returns:

List of Workflow Contexts

Return type:

list

start_workflow_instance(workflow_context: WorkflowContext, **kwargs)[source]

Start a workflow context

Returns a Correlation Id which is used to monitor the workflow progress

Parameters:
  • workflow_context (WorkflowContext) – The workflow context to start

  • kwargs – Key/Values to pass to the workflow instance

Returns:

correlation_id

Return type:

str

terminate_workflow_instance(instance_ids)[source]

Terminate a workflow by its instance id

Parameters:

instance_ids (int or a list of int) – The Workflow instance

workflow_instance(instance_id: int) WorkflowInstance[source]

Return a workflow instance by its Id

Parameters:

instance_id (int) – The Workflow instance

Returns:

workflow_instance

Return type:

WorkflowInstance

workflow_instances(workflow_state: str, workflow_type: str, **kwargs) Generator[WorkflowInstance, None, None][source]

Return a list of Workflow instances

Parameters:
  • workflow_state – The Workflow state Aborted, Active, Completed, Finished_Mixed_Outcome, Pending, Suspended, Unknown, or Failed

  • workflow_type – The Workflow type Ingest, Access, Transformation or DataManagement

Administration and Management API

Note

The Administration and Management API needs to be enabled by the help desk.

https://eu.preservica.com/sdb/rest/workflow/documentation.html

class pyPreservica.AdminAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook=None, credentials_path: str = 'credentials.properties')[source]
add_security_tag(tag_name) str[source]

Create a new security tag

Parameters:

tag_name (str) – The new security tag

Returns:

The new security tag

Return type:

str

add_system_role(role_name) str[source]

Create a new user role

Parameters:

role_name (str) – The new role

Returns:

The new role

Return type:

str

add_user(username: str, full_name: str, roles: list[str], externally_authenticated: bool = False) dict[source]

Add a new user

Parameters:
  • externally_authenticated

  • username (str) – email address of the preservica user

  • full_name (str) – Users real name

  • roles (list) – List of roles assigned to the user

Returns:

dictionary of user attributes

Return type:

dict

add_xml_document(name: str, xml_data: Any, document_type: str = 'MetadataTemplate')[source]

Add a new XML document to Preservica The default type of XML document is a descriptive metadata template

Options are:

MetadataDropdownLists -> Authority Lists CustomIndexDefinition -> Custom Search Indexes MetadataTemplate -> Metadata Template UploadWizardConfigurationFile -> Upload Wizard Config ConfigurationFile -> Heritrix Config File

Parameters:
  • name (str) – The name of the xml document

  • xml_data – The xml schema as a UTF-8 string or as a file like object

  • document_type (str) – The type of the XML document, defaults to descriptive metadata templates

Returns:

Return type:

None

add_xml_schema(name: str, description: str, originalName: str, xml_data: Any)[source]

Add a new XSD document to Preservica

Parameters:
  • name (str) – Name for the XSD schema

  • description (str) – Description for the XSD schema

  • originalName (str) – The original file name for the schema on disk

  • xml_data (Any) – The xml schema as a UTF-8 string or a file like object

Returns:

Return type:

None

add_xml_transform(name: str, input_uri: str, output_uri: str, purpose: str, originalName: str, xml_data: Any)[source]

Add a new XML transform to Preservica

Parameters:
  • name (str) – The name of the XML transform

  • input_uri (str) – The URI of the input XML document

  • output_uri (str) – The URI of the output XML document

  • purpose (str) – The purpose of the transform, “transform” , “edit”, “view”

  • originalName (str) – The original file name of the transform

  • xml_data (Any) – The transform xml as a string or file like object

Returns:

Return type:

None

all_users() list[str][source]

Return a list of all users in the system

Return list of usernames:

Return type:

list

change_user_display_name(username: str, new_display_name: str) dict[source]

Change the user display name

Parameters:
  • username (str) – email address of the preservica user

  • new_display_name (str) – Users real name

Returns:

dictionary of user attributes

Return type:

dict

current_user()[source]

Returns details about the current authenticated user :return: dictionary of user attributes :rtype: dict

delete_security_tag(tag_name)[source]

Delete a security tag

Parameters:

tag_name (str) – The security tag to delete

delete_system_role(role_name)[source]

Delete a system role

Parameters:

role_name (str) – The role to delete

delete_user(username: str)[source]

Delete a user

Parameters:

username (str) – email address of the preservica user

delete_xml_document(uri: str)[source]

Delete an XML document from Preservica’s XML document store

Parameters:

uri (str) – The URI of the xml document to delete

Returns:

Return type:

None

delete_xml_schema(uri: str)[source]

Delete an XML schema from Preservica

Parameters:

uri (str) – The URI of the xml schema to delete

Returns:

Return type:

None

delete_xml_transform(input_uri: str, output_uri: str)[source]

Delete a XSD document from Preservica

Parameters:
  • input_uri (str) – The URI of the input XML document

  • output_uri (str) – The URI of the output XML document

Returns:

Return type:

None

disable_user(username)[source]

Disable a Preservica User to prevent them logging in

Parameters:

username (str) – email address of the preservica user

enable_user(username)[source]

Enable a Preservica User

Parameters:

username (str) – email address of the preservica user

security_tags() list[str][source]

List all the security tags in the system

Returns:

list of security tags

Return type:

list

system_roles() list[str][source]

List all the user access roles in the system

Returns:

list of roles

Return type:

list

user_details(username: str) dict[source]

Get the details of a user by their username

Parameters:

username (str) – email address of the preservica user

Returns:

dictionary of user attributes

Return type:

dict

user_report(report_name='users.csv')[source]

Create a report on all tenancy users :return:

xml_document(uri: str) str | None[source]

fetch the metadata XML document as a string by its URI

Parameters:

uri (str) – The URI of the xml document

Returns:

The XML document as a string

Return type:

str

xml_documents() List[source]

fetch the list of XML documents stored in Preservica

Returns:

List of XML documents stored in Preservica

Return type:

list

xml_schema(uri: str) str | None[source]

Fetch the metadata schema XSD document as a string by its URI

Parameters:

uri (str) – The URI of the xml schema

Returns:

The XML schema as a string

Return type:

str

xml_schemas() List[source]

fetch the list of metadata schema XSD documents stored in Preservica

Returns:

List of XML schema’s stored in Preservica

Return type:

list

xml_transform(input_uri: str, output_uri: str) str | None[source]

fetch the XML transform as a string by its URIs

Parameters:
  • input_uri (str) – The URI of the input XML document

  • output_uri (str) – The URI of the output XML document

Returns:

The XML transform as a string

Return type:

str

xml_transforms() List[source]

fetch the list of xml transforms stored in Preservica

Returns:

List of XML transforms stored in Preservica

Return type:

list

Process Monitor API

https://us.preservica.com/api/processmonitor/documentation.html

class pyPreservica.MonitorStatus(*values)[source]
FAILED = 'Failed'
PENDING = 'Pending'
RECOVERABLE = 'Recoverable'
RUNNING = 'Running'
SUCCEEDED = 'Succeeded'
SUSPENDED = 'Suspended'
class pyPreservica.MonitorCategory(*values)[source]
AUTOMATED = 'Automated'
DATA_MANAGEMENT = 'DataManagement'
EXPORT = 'Export'
INGEST = 'Ingest'
class pyPreservica.MonitorAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook=None, credentials_path: str = 'credentials.properties')[source]

A class for the Preservica Repository Process Monitor API

https://us.preservica.com/api/processmonitor/documentation.html

API for retrieving and updating monitoring information about processes.

messages(monitor_id, status: MessageStatus = None) Generator[source]

List of messages for a process

Parameters:
  • monitor_id (str) – The Process ID

  • status (MessageStatus) – The message status, info, warning, error etc.

Returns:

Generator for each message, each message is a dict object

monitors(status: MonitorStatus = None, category: MonitorCategory = None) Generator[source]

Get a filtered list of non-abandoned process monitors

Parameters:
  • status (MonitorStatus) – process status values (Pending, Running, Succeeded, Failed, Suspended, Recoverable)

  • category (MonitorCategory) – process categories (Ingest, Export, DataManagement, Automated)

Returns:

Generator for each monitor

timeseries(monitor_id)[source]

Get the historical record of progress for a single monitor

Parameters:

monitor_id (str) – The Process ID

Returns:

List of timeseries information

WebHook API

https://us.preservica.com/api/webhook/documentation.html

class pyPreservica.TriggerType(*values)[source]

Enumeration of the Web hooks Trigger Types

CHANGE_ASSET_VISIBILITY = 'CHANGE_ASSET_VISIBILITY'
INDEXED = 'FULL_TEXT_INDEXED'
INGEST_FAILED = 'INGEST_FAILED'
MOVED = 'MOVED'
SECURITY_CHANGED = 'CHANGED_SECURITY_DESCRIPTOR'
class pyPreservica.WebHooksAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook=None, credentials_path: str = 'credentials.properties')[source]

Class to register new webhook endpoints

subscribe(url: str, triggerType: TriggerType, secret: str)[source]

Subscribe to a new web hook

Parameters:
  • url

  • triggerType

  • secret

Returns:

json_response

subscriptions()[source]

Return all the current active web hook subscriptions as a json document

Returns:

list of web hooks

unsubscribe(subscription_id: str)[source]

Unsubscribe from the provided webhook.

Parameters:

subscription_id

Returns:

unsubscribe_all()[source]

Unsubscribe from all webhooks. :return:

Authority Records API

https://eu.preservica.com/api/reference-metadata/documentation.html

This API is used for managing the Authority records within Preservica.

class pyPreservica.Table(name: str, security_tag: str, displayField: str = None, metadataConnections: list = [])[source]
class pyPreservica.AuthorityAPI(username: str | None = None, password: str | None = None, tenant: str | None = None, server: str | None = None, use_shared_secret: bool = False, two_fa_secret_key: str | None = None, protocol: str = 'https', request_hook=None, credentials_path: str = 'credentials.properties')[source]
add_record(table: Table, record: dict)[source]

Add a new record to an existing table

Parameters:
  • table – The Table to add the record to

  • record – The record as a dictionary

Type:

table: Table

Type:

record: dict

Returns:

A single record

Return type:

dict

add_records(table: Table, csv_file, encoding=None)[source]

Add new records to an existing table from a CSV document

Parameters:
  • table – The Table to add the record to

  • csv_file – The path to the CSV document

  • encoding – The encoding used to open the csv document

Type:

table: Table

Type:

csv_file: str

Type:

encoding: str

add_table(new_table: Table)[source]

Add a new authority table

Returns:

An authority table

Return type:

Table

delete_record(reference: str)[source]

Delete a record from a table by its reference

Parameters:

reference – The reference of the record to delete

Type:

reference: str

record(reference: str) dict[source]

Return a record by its reference

Parameters:

reference – The reference of the record

Type:

reference: str

Returns:

A single record

Return type:

dict

records(table: Table) List[dict][source]

Return all records from a table

Parameters:

table – The authority table to return the records from

Type:

table: Table

Returns:

List of records

Return type:

list[dict]

table(reference: str) Table[source]

fetch an authority table by its reference

Parameters:

reference – The reference for the authority table

Type:

reference: str

Returns:

An authority table of interest

Return type:

Table

tables() Set[Table][source]

List reference metadata tables

Returns:

Set of authority tables

Return type:

set(Table)

Metadata Groups API

https://us.preservica.com/api/metadata/documentation.html#/%2Fgroups

The Metadata Groups API is designed allows the creation of custom metadata within NGI (New Generation Interface).

class pyPreservica.Group(name: str, description: str)[source]
description: str
fields: List[GroupField]
group_id: str
name: str
schemaUri: str
class pyPreservica.GroupField(field_id: str, name: str, field_type: GroupFieldType = GroupFieldType.STRING, maxLength: int = -1, default: str = '', visible: bool = True, editable: bool = True, minOccurs: int = 0, maxOccurs: int = 1, indexed: bool = True, values: List = None)[source]
default: str
editable: bool
field_id: str
field_type: GroupFieldType
indexed: bool
maxLength: int
maxOccurs: int
minOccurs: int
name: str
values: List[str]
visible: bool
class pyPreservica.GroupFieldType(*values)[source]
DATE = 'DATE'
LONG_STRING = 'LONGSTRING'
NUMBER = 'NUMBER'
STRING = 'STRING'
class pyPreservica.MetadataGroupsAPI(username: str = None, password: str = None, tenant: str = None, server: str = None, use_shared_secret: bool = False, two_fa_secret_key: str = None, protocol: str = 'https', request_hook: Callable = None, credentials_path: str = 'credentials.properties')[source]
add_fields(group_id: str, new_fields: List[GroupField]) dict[source]

Add new metadata fields to an existing Group

The new fields are appended to the end of the group

Parameters:
  • group_id (str) – The group ID of the group to update

  • new_fields (List[GroupField]) – The list of new fields to add to the group

Returns:

The updated Metadata Group as a JSON dict

Return type:

dict

add_form(json_form: dict | str)[source]

Create a new Metadata form using a JSON dictionary object or document

Parameters:

json_form (dict) – JSON dictionary or string

Returns:

JSON document

Return type:

dict

add_group(group_name: str, group_description: str, fields: List[GroupField]) dict[source]

Create a new Metadata Group GroupFields

Parameters:
  • group_name (str) – The name of the new Group

  • group_description (str) – The description of the new Group

  • fields (List[GroupField]) – The list of fields

Returns:

The new metadata Group as a JSON dict

Return type:

dict

add_group_json(json_object: dict | str) dict[source]

Create a new Metadata Group using a JSON dictionary object or document

Parameters:

json_object (dict) – JSON dictionary or string

Returns:

JSON document

Return type:

dict

delete_form(form_id: str)[source]

Delete a form by its ID

delete_group(group_id: str)[source]

Delete a new Metadata Group using its ID

Parameters:

group_id (str) – Group ID

Returns:

Return type:

None

delete_group_namespace(schema: str)[source]

Delete a new Metadata Group using its schema URI

Parameters:

schema (str) – The Group namespace schema URI

Returns:

None

Return type:

None

download_template(form_name: str)[source]

Download a template csv to allow bulk input of data

form(form_id: str) dict[source]

Return a Form as a JSON dict object

Parameters:

form_id (str) – The Form id

Returns:

JSON document

Return type:

dict

forms(schema_uri: str | None = None) dict[source]

Return all the metadata Forms in the tenancy as a list of JSON dict objects

Parameters:

schema_uri (str) – The Form schema Uri

Returns:

List of JSON dictionary object

Return type:

dict

group(group_id: str) Group[source]

Return a Group object by its ID

Parameters:

group_id (str) – The Group id

Returns:

The metadata Group Object

Return type:

Group

group_json(group_id: str) dict[source]

Return a Group as a JSON object

Parameters:

group_id (str) – The Group id

Returns:

JSON document

Return type:

dict

groups() Generator[Group, None, None][source]

Return all the metadata Groups in the tenancy as Group Objects

Returns:

Generator of Group Objects

Return type:

Group

groups_json() List[dict][source]

Return all the metadata Groups in the tenancy as a list of JSON dict objects

Returns:

List of JSON dictionary object

Return type:

List[dict]

Settings API

https://eu.preservica.com/api/settings/documentation.html

API for retrieving information about configuration settings.

class pyPreservica.SettingsAPI(username=None, password=None, tenant=None, server=None, use_shared_secret=False, two_fa_secret_key: str = None, protocol: str = 'https', request_hook: Callable = None, credentials_path: str = 'credentials.properties')[source]

API for retrieving information about configuration settings.

Includes methods for:

  • metadata-enrichment

metadata_enrichment_add_profile(name: str, active: bool = True)[source]

Create a metadata enrichment profile to control automatic metadata enrichment of content and return it. Profiles define a set of behaviours that will be applied when the profile is selected by a rule. A profile has no effect if it is not used by a rule. Includes settings for PII identification. PII detection tools may be run against the full text extracted from content.

Parameters:
  • name (str) – The profile name

  • active (bool) – The profile active status

Returns:

The metadata enrichment profile

Return type:

dict

metadata_enrichment_add_rule(profile_id: str, priority: int = 1)[source]

Create a metadata enrichment rule to control when metadata enrichment profiles are applied and return it. Rules define where particular behaviours, defined by profiles, will be applied. Rules are evaluated in order, with the first matching rule being applied. Note that not specifying, or specifying an empty selection implies that the rule will be applied to all content. Currently only securityDescriptorSelector, representationSelector and hierarchySelector are supported selectors. If a rule already exists for the requested priority, existing rules will be shifted down priority to accommodate the new entry.

Parameters:
  • profile_id (str) – The profile id

  • priority (int) – The rule priority

Returns:

The metadata enrichment rule

Return type:

dict

metadata_enrichment_delete_profile(profile_id: str) None[source]

Deletes a metadata enrichment profile

Parameters:

profile_id (str) – The profile name

Returns:

No return value

Return type:

None

metadata_enrichment_delete_rule(rule_id: str)[source]

Deletes a metadata enrichment rule.

Parameters:

rule_id (str) – The rule id

Returns:

No return value

Return type:

None

metadata_enrichment_profile(profile_id: str) dict[source]

Returns a single profile by its ID Profiles define a set of behaviours that will be applied when the profile is selected by a rule. A profile has no effect if it is not used by a rule. Includes settings for PII identification. PII detection tools may be run against the full text extracted from content.

Parameters:

profile_id (str) – The profile name

Returns:

The metadata enrichment profile

Return type:

dict

metadata_enrichment_profiles() dict[source]

Returns the list of all metadata enrichment profiles. Profiles define a set of behaviours that will be applied when the profile is selected by a rule. A profile has no effect if it is not used by a rule. Includes settings for PII identification. PII detection tools may be run against the full text extracted from content.

metadata_enrichment_rules(profile_id: str = None) dict[source]

Returns a list of metadata enrichment rules. An empty selection implies that the rule is applied to all content. Rules define where particular behaviours, defined by profiles, will be applied. Rules are evaluated in order, with the first matching rule being applied.

Parameters:

profile_id (str) – The rules for a specific profile id, Set to None for all rules