Archivematica API client

Tools to interact with the Archivematica REST API

source

ArchivematicaAPIClient

 ArchivematicaAPIClient (dashboard_url:str, dashboard_username:str,
                         dashboard_api_key:str, storage_service_url:str,
                         storage_service_username:str,
                         storage_service_password:str)

A client for interacting with Matica’s API for file uploading, transferring, and ingesting processes.

First import the ArchivematicaAPIClient class.

from archivematica_tools.api import ArchivematicaAPIClient

To initialise the ArchivematicaAPIClient you need to provide the options.

.env file

DASHBOARD_URL=http://localhost:62080
DASHBOARD_USERNAME=test
DASHBOARD_API_KEY=test

STORAGE_SERVICE_URL=http://localhost:62081
STORAGE_SERVICE_USERNAME=test
STORAGE_SERVICE_PASSWORD=test
# 環境変数を参照
dashboard_url = os.environ.get("DASHBOARD_URL")
dashboard_username = os.environ.get("DASHBOARD_USERNAME")
dashboard_api_key = os.environ.get("DASHBOARD_API_KEY")

storage_service_url = os.environ.get("STORAGE_SERVICE_URL")
storage_service_username = os.environ.get("STORAGE_SERVICE_USERNAME")
storage_service_password = os.environ.get("STORAGE_SERVICE_PASSWORD")

aws_access_key_id = os.environ.get("AWS_ACCESS_KEY_ID")
aws_secret_access_key = os.environ.get("AWS_SECRET_ACCESS_KEY")
matica = ArchivematicaAPIClient(dashboard_url, dashboard_username, dashboard_api_key, storage_service_url, storage_service_username, storage_service_password)

Transfer

Initiates a file transfer process.


source

ArchivematicaAPIClient.v2beta_package

 ArchivematicaAPIClient.v2beta_package (transfer_type:str,
                                        transfer_accession:str,
                                        location_uuid:str, path:str,
                                        name:str, processing_config:str)

*Initiates a file transfer process.

Args: transfer_type: The type of the transfer. transfer_accession: The accession number for the transfer.

Returns: The directory associated with the transfer.*


source

ArchivematicaAPIClient.approve_transfer

 ArchivematicaAPIClient.approve_transfer (transfer_type:str,
                                          directory:str)

*Approves a file transfer after initiation.

Args: transfer_type (str): The type of the transfer. directory (str): The directory associated with the transfer.

Returns: Optional[str]: The UUID of the approved transfer, if available.*


source

ArchivematicaAPIClient.check_transfer_status

 ArchivematicaAPIClient.check_transfer_status (transfer_UUID:str)

*Checks the status of a file transfer until it is no longer processing.

Args: transfer_UUID: The UUID of the transfer to check.

Returns: The SIP UUID of the transfer.*


source

ArchivematicaAPIClient.transfer_delete

 ArchivematicaAPIClient.transfer_delete (transfer_UUIDs:list)

*Deletes the specified transfers.

Args: transfer_UUIDs: The list of transfer UUIDs to delete.

Returns: The results of the deletion.*


source

ArchivematicaAPIClient.transfer_completed

 ArchivematicaAPIClient.transfer_completed ()

*Checks for completed transfers.

Returns: The list of completed transfers.*

Ingest


source

ArchivematicaAPIClient.ingest

 ArchivematicaAPIClient.ingest (sip_UUID:str)

*Waits for the ingestion process to complete and returns the UUID of the ingested AIP.

Args: sip_UUID: The SIP UUID to ingest.

Returns: The UUID of the ingested AIP.*


source

ArchivematicaAPIClient.ingest_delete

 ArchivematicaAPIClient.ingest_delete (ingest_UUIDs:list)

*Deletes the specified ingestions.

Args: ingest_UUIDs: The list of ingest UUIDs to delete.

Returns: The results of the deletion.*


source

ArchivematicaAPIClient.ingest_completed

 ArchivematicaAPIClient.ingest_completed ()

*Checks for completed ingestions.

Returns: The list of completed ingestions.*

Storage Service


source

ArchivematicaAPIClient.v2_file

 ArchivematicaAPIClient.v2_file (size:int=20)

*Retrieves a list of files.

Args: size: The number of files to retrieve.

Returns: The list of files.*


source

ArchivematicaAPIClient.v2_file_delete_aip

 ArchivematicaAPIClient.v2_file_delete_aip (file_UUIDs:list,
                                            event_reason:str,
                                            pipeline:str, user_id:str,
                                            user_email:str)

*Deletes the specified files.

Args: file_UUIDs: The list of file UUIDs to delete. event_reason: The reason for the deletion. pipeline: The pipeline for the deletion. user_id: The user ID for the deletion. user_email: The user email for the deletion.

Returns: The results of the deletion.*


source

ArchivematicaAPIClient.v2_file_delete

 ArchivematicaAPIClient.v2_file_delete (file_UUIDs:list)

*Deletes the specified files.

Args: file_UUIDs: The list of file UUIDs to delete.

Returns: The results of the deletion.*


source

ArchivematicaAPIClient.get_aip_url

 ArchivematicaAPIClient.get_aip_url (ingest_UUID:str)

*Constructs and returns the URL for downloading the ingested AIP.

Args: ingest_UUID: The UUID of the ingested AIP.

Returns: The URL for downloading the AIP.*


source

ArchivematicaAPIClient.get_current_full_path

 ArchivematicaAPIClient.get_current_full_path (ingest_UUID:str)

*Retrieves the current full path of the ingested AIP by making an API call.

Args: ingest_UUID (str): The UUID of the ingested AIP.

Returns: Optional[str]: The current full path of the AIP if the request is successful, None otherwise.*