Difference between revisions of "Archivematica API"

From Archivematica
Jump to navigation Jump to search
(Stub out page, describe status)
 
(Add transfer & ingest endpoints)
Line 4: Line 4:
  
 
== Transfer ==
 
== Transfer ==
 +
 +
=== Start Transfer ===
 +
* '''URL''': <code>/api/transfer/start_transfer/</code>
 +
* '''Verbs''': POST
 +
* Start a transfer.
 +
* '''Parameters''':
 +
** ''name'': Name of new transfer
 +
** ''type'': Type of the new transfer. One of: standard, unzipped bag, zipped bag, dspace
 +
** ''accession'': Accession number of new transfer
 +
** ''paths[]'': List of base64-encoded "<location_uuid>:<relative_path>" to be copied into the new transfer. Location UUIDs should be associated with this pipeline, and relative path should be relative to the location (TODO confirm relative vs absolute path).  E.g. NWJiYWJjMTMtMTIyNy00MWE3LWIwY2QtZjJhYzM1MjkxZTdmOi92YWdyYW50L3NhbXBsZWRhdGEvQ1NWbWV0YWRhdGE= (decoded: 5bbabc13-1227-41a7-b0cd-f2ac35291e7f:/vagrant/sampledata/CSVmetadata)
 +
** ''row_ids[]'': ID of the associated TransferMetadataSet for disk image ingest.  Can be provided as [""]
 +
* '''Fields''':
 +
** ''message'': "Copy successful."
 +
** ''path'': Path the transfer was copied to on start?
 +
 +
=== List Unapproved Transfers ===
 +
* '''URL''': <code>/api/transfer/unapproved</code>
 +
* '''Verbs''': GET
 +
* Returns a list of transfers waiting for approval.
 +
* '''Fields''':
 +
** ''message'': "Fetched unapproved transfers successfully."
 +
** ''results'': List of dicts with keys:
 +
*** ''type'': Transfer type. One of: standard, unzipped bag, zipped bag, dspace
 +
*** ''directory'': Directory the transfer is in currently
 +
*** ''uuid'': UUID of the transfer
 +
 +
=== Approve Transfer ===
 +
* '''URL''': <code>/api/transfer/approve</code>
 +
* '''Verbs''': POST
 +
* Approve a transfer waiting to be started.
 +
* '''Parameters''':
 +
** ''type'': Type of the transfer to approved. One of: standard, unzipped bag, zipped bag, dspace.
 +
** ''directory'': Name of the directory for the transfer to approve
 +
* '''Fields''':
 +
** ''message'': "Approval successful."
 +
** ''uuid'': UUID of the approved transfer
  
 
=== Status ===
 
=== Status ===
 
* '''URL''': <code>/transfer/status/<unit UUID>/</code>
 
* '''URL''': <code>/transfer/status/<unit UUID>/</code>
 
* '''Verbs''': GET
 
* '''Verbs''': GET
* Returns the status of the Transfer
+
* Returns the status of the transfer.
 
* '''Fields''':
 
* '''Fields''':
 
** ''status'': One of FAILED, REJECTED, USER_INPUT, COMPLETE or PROCESSING
 
** ''status'': One of FAILED, REJECTED, USER_INPUT, COMPLETE or PROCESSING
Line 20: Line 56:
 
** ''uuid'': UUID of the transfer, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"
 
** ''uuid'': UUID of the transfer, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"
  
 +
=== Start Reingest ===
 +
* '''URL''': <code>/api/transfer/reingest</code>
 +
* '''Verbs''': POST
 +
* Start a full reingest.
 +
* '''Parameters''':
 +
** ''name'': Name of the AIP. The AIP should also be found at <code>%sharedDirectory%/tmp/<name></code>
 +
** ''uuid'': UUID of the AIP to reingest
 +
* '''Fields''':
 +
** ''message'': "Approval successful."
 +
** ''reingest_uuid'': UUID of the reingested transfer
  
 
== Ingest ==
 
== Ingest ==
  
 +
=== Status ===
 
* '''URL''': <code>/ingest/status/<unit UUID>/</code>
 
* '''URL''': <code>/ingest/status/<unit UUID>/</code>
 
* '''Verbs''': GET
 
* '''Verbs''': GET
Line 35: Line 82:
 
** ''type'': "SIP"
 
** ''type'': "SIP"
 
** ''uuid'': UUID of the SIP, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"
 
** ''uuid'': UUID of the SIP, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"
 +
 +
=== List SIPS Waiting for User Input ===
 +
* '''URL''': <code>/api/ingest/waiting</code>
 +
* '''Verbs''': GET
 +
* Returns a list of SIPs waiting for user input.
 +
* '''Fields''':
 +
** ''message'': "Fetched units successfully."
 +
** ''results'': List of dicts with keys:
 +
*** ''sip_directory'': Directory the SIP is in currently
 +
*** ''sip_uuid'': UUID of the SIP
 +
*** ''sip_name'': Name of the SIP
 +
*** ''microservice'': Name of the current microservice
 +
 +
=== Reingest ===
 +
* '''URL''': <code>/api/ingest/reingest</code>
 +
* '''Verbs''': POST
 +
* Start a partial or metadata-only reingest.
 +
* '''Parameters''':
 +
** ''name'': Name of the AIP. The AIP should also be found at <code>%sharedDirectory%/tmp/<name></code>
 +
** ''uuid'': UUID of the AIP to reingest
 +
* '''Fields''':
 +
** ''message'': "Approval successful."
 +
** ''reingest_uuid'': UUID of the reingested SIP
 +
 +
=== Copy Metadata ===
 +
* '''URL''': <code>/api/ingest/copy_metadata_files/</code>
 +
* '''Verbs''': POST
 +
* Add metadata files to a SIP.
 +
* '''Parameters''':
 +
** ''sip_uuid'': UUID of the SIP to put files in
 +
** ''source_paths[]'': List of files to be copied, base64 encoded, in the format 'source_location_uuid:full_path'
 +
* '''Fields''':
 +
** ''error'': False
 +
** ''message'': "Files added successfully."

Revision as of 17:15, 26 October 2016

Endpoints require authentication with a username and API key. This can be submitted as GET parameters (eg ?username=demo&api_key=e6282adabed84e39ffe451f8bf6ff1a67c1fc9f2) or as a header (eg Authorization: ApiKey demo:e6282adabed84e39ffe451f8bf6ff1a67c1fc9f2)

Endpoints return JSON. If there's an error, they will return a 4xx or 5xx HTTP error code and a JSON body {'error': True, 'message': 'message describing error'}

Transfer

Start Transfer

  • URL: /api/transfer/start_transfer/
  • Verbs: POST
  • Start a transfer.
  • Parameters:
    • name: Name of new transfer
    • type: Type of the new transfer. One of: standard, unzipped bag, zipped bag, dspace
    • accession: Accession number of new transfer
    • paths[]: List of base64-encoded "<location_uuid>:<relative_path>" to be copied into the new transfer. Location UUIDs should be associated with this pipeline, and relative path should be relative to the location (TODO confirm relative vs absolute path). E.g. NWJiYWJjMTMtMTIyNy00MWE3LWIwY2QtZjJhYzM1MjkxZTdmOi92YWdyYW50L3NhbXBsZWRhdGEvQ1NWbWV0YWRhdGE= (decoded: 5bbabc13-1227-41a7-b0cd-f2ac35291e7f:/vagrant/sampledata/CSVmetadata)
    • row_ids[]: ID of the associated TransferMetadataSet for disk image ingest. Can be provided as [""]
  • Fields:
    • message: "Copy successful."
    • path: Path the transfer was copied to on start?

List Unapproved Transfers

  • URL: /api/transfer/unapproved
  • Verbs: GET
  • Returns a list of transfers waiting for approval.
  • Fields:
    • message: "Fetched unapproved transfers successfully."
    • results: List of dicts with keys:
      • type: Transfer type. One of: standard, unzipped bag, zipped bag, dspace
      • directory: Directory the transfer is in currently
      • uuid: UUID of the transfer

Approve Transfer

  • URL: /api/transfer/approve
  • Verbs: POST
  • Approve a transfer waiting to be started.
  • Parameters:
    • type: Type of the transfer to approved. One of: standard, unzipped bag, zipped bag, dspace.
    • directory: Name of the directory for the transfer to approve
  • Fields:
    • message: "Approval successful."
    • uuid: UUID of the approved transfer

Status

  • URL: /transfer/status/<unit UUID>/
  • Verbs: GET
  • Returns the status of the transfer.
  • Fields:
    • status: One of FAILED, REJECTED, USER_INPUT, COMPLETE or PROCESSING
    • name: Name of the transfer, e.g. "imgs"
    • sip_uuid: If status is COMPLETE, this field will exist with either the UUID of the SIP or 'BACKLOG'
    • microservice: Name of the current microservice
    • directory: Name of the directory, e.g. "imgs-52dd0c01-e803-423a-be5f-b592b5d5d61c"
    • path: Full path to the transfer, e.g. "/var/archivematica/sharedDirectory/watchedDirectories/SIPCreation/completedTransfers/imgs-52dd0c01-e803-423a-be5f-b592b5d5d61c/"
    • message: "Fetched status for <transfer UUID> successfully."
    • type: "transfer"
    • uuid: UUID of the transfer, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"

Start Reingest

  • URL: /api/transfer/reingest
  • Verbs: POST
  • Start a full reingest.
  • Parameters:
    • name: Name of the AIP. The AIP should also be found at %sharedDirectory%/tmp/<name>
    • uuid: UUID of the AIP to reingest
  • Fields:
    • message: "Approval successful."
    • reingest_uuid: UUID of the reingested transfer

Ingest

Status

  • URL: /ingest/status/<unit UUID>/
  • Verbs: GET
  • Returns the status of the SIP
  • Fields:
    • status: One of FAILED, REJECTED, USER_INPUT, COMPLETE or PROCESSING
    • name: Name of the SIP, e.g. "imgs"
    • microservice: Name of the current microservice
    • directory: Name of the directory, e.g. "imgs-52dd0c01-e803-423a-be5f-b592b5d5d61c"
    • path: Full path to the transfer, e.g. "/var/archivematica/sharedDirectory/currentlyProcessing/imgs-52dd0c01-e803-423a-be5f-b592b5d5d61c/"
    • message: "Fetched status for <SIP UUID> successfully."
    • type: "SIP"
    • uuid: UUID of the SIP, e.g. "52dd0c01-e803-423a-be5f-b592b5d5d61c"

List SIPS Waiting for User Input

  • URL: /api/ingest/waiting
  • Verbs: GET
  • Returns a list of SIPs waiting for user input.
  • Fields:
    • message: "Fetched units successfully."
    • results: List of dicts with keys:
      • sip_directory: Directory the SIP is in currently
      • sip_uuid: UUID of the SIP
      • sip_name: Name of the SIP
      • microservice: Name of the current microservice

Reingest

  • URL: /api/ingest/reingest
  • Verbs: POST
  • Start a partial or metadata-only reingest.
  • Parameters:
    • name: Name of the AIP. The AIP should also be found at %sharedDirectory%/tmp/<name>
    • uuid: UUID of the AIP to reingest
  • Fields:
    • message: "Approval successful."
    • reingest_uuid: UUID of the reingested SIP

Copy Metadata

  • URL: /api/ingest/copy_metadata_files/
  • Verbs: POST
  • Add metadata files to a SIP.
  • Parameters:
    • sip_uuid: UUID of the SIP to put files in
    • source_paths[]: List of files to be copied, base64 encoded, in the format 'source_location_uuid:full_path'
  • Fields:
    • error: False
    • message: "Files added successfully."