SlideShare a Scribd company logo
1 of 40
Download to read offline
Archivematica
API and AMClient Scripts
Ross Spencer @ Artefactual Systems, Inc.
rspencer@artefactual.com
Introduction
● Developer at Artefactual, November 2017
● One of a handful working on the Archivematica Project
● Background in digital preservation:
○ The National Archives UK
○ Archives New Zealand
● Current work interests:
○ Dataverse Integration for Scholars Portal
○ Technical training (next camp, Houston in November!)
○ And of course, improving our API and Docs!
What is an API
API stands for Application Programming Interface
A description of a software library or web service and how users and
software agents are expected to interact with it.
Common uses of an API might be to contribute, or retrieve data from a web
service.
“
There are APIs for Everything!
https://github.com/toddmotto/public-apis
Archivematica’s APIs
Two Primary APIs:
Storage Service: https://wiki.archivematica.org/Storage_Service_API
Archivematica: https://wiki.archivematica.org/Archivematica_API
Additionally:
SWORD: https://wiki.archivematica.org/Sword_API
Plus AtoM: https://www.accesstomemory.org/en/docs/2.4/#api
Jargon
Endpoints: The API address (URL) that performs a particular action according
to its specification.
SFTP: Secure (encrypted) file transfer protocol
cURL: Command line tool for transferring and retrieving data.
HTTPie: A simpler more user friendly cURL like tool!
Verbs: Actions associated with an API command, GET (retrieve), POST
(submit).
Jargon
Processing configuration: Archivematica’s configuration file which
determines the defaults associated with microservices, e.g. ‘Normalize for
Access’.
Decision Points: Microservices which halt by default unless configured
otherwise.
RPC: Remote procedure call. A method of interacting with the Archivematica
job server where decision points need to be manually moved along.
Devtools: Repository of tools capturing some miscellaneous Archivematica
functionality.
Jargon
AMClient.py: A set of procedures that group API calls together, or make it
easier to make an individual call.
CLI: Command-line interface, or terminal. Text-based interaction with the
operating system using special commands.
Regular Workflow
> Location configured in Storage Service, (e.g. UUID:
6b82c1f5-2b87-49ba-8e5f-947759201518)
> SFTP data to a location (e.g. /home/transfer-data/)
> Transfer is started via /api/transfer/start_transfer endpoint
> With processingMCP.xml configured to be as automated
as possible; transfer should run to completion...
Configuring our transfer...
API Calls
Starting a transfer using cURL:
curl -v -X POST 
-H "Authorization: ApiKey test:test" 
--data "name=api-demo-1&type=standard" 
--data "paths[]=
[$(echo -n '6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' 
| base64 -w 0)]" 
"http://127.0.0.1:62080/api/transfer/start_transfer/"
API Calls
Starting a transfer using HTTPie:
http --pretty=format 
-f 
POST "http://127.0.0.1:62080/api/transfer/start_transfer/" 
Authorization:"ApiKey test:test" 
name="api-demo-1" 
type="standard" 
paths[]="
[$(echo -n '6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' 
| base64 -w 0)]"
What’s going on here?
--data
Submit as URL Encoded Form -f
(Verb) Submit data to the server: POST
API Endpoint: “http://127.0.0.1:62080/api/transfer/start_transfer/”
API User and Key as a HTTP Header Authorization:"ApiKey test:test"
Transfer Name name="api-demo-1"
Transfer Type type="standard"
Transfer source UUID and paths to
the data in the Transfer Source
encoded as Base64
paths[]="
[$(echo -n
'6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' |
base64 -w 0)]"
How do I find the location?
Via the Storage Service UI, or Storage Service API:
http --pretty=format 
GET "http://127.0.0.1:62081/api/v2/location/" 
Authorization:"ApiKey test:test"
Location :: Response
{
"description": "Archivematica Transfer Source",
"enabled": true,
"path": "/home",
"pipeline": [
"/api/v2/pipeline/1df71c34-7372-45f8-a7b5-455d7fc16d56/"
],
"purpose": "TS",
"quota": null,
"relative_path": "home",
"resource_uri": "/api/v2/location/ef938612-846e-4585-b665-c5596305547b/",
"space": "/api/v2/space/021f8842-39be-42f5-93ee-b9b9014ec34a/",
"used": "0",
"uuid": "ef938612-846e-4585-b665-c5596305547b"
},
Location :: Response
We can access the structure (JSON) and find the pieces we require to
construct a path:
● "relative_path": "home",
● "uuid": "ef938612-846e-4585-b665-c5596305547b",
Becomes:
● 'ef938612-846e-4585-b665-c5596305547b: 
/home/archivematica/archivematica-sampledata/api-demo/udenver'
API Calls
If something went wrong starting the transfer:
HTTP/1.1 403 FORBIDDEN
Connection: keep-alive
Content-Language: en
Content-Type: application/json
Date: Thu, 20 Sep 2018 22:56:29 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Language, Cookie
{
"error": true,
"message": "API key not valid."
}
API Calls
Or something else went wrong:
HTTP/1.1 500 INTERNAL SERVER ERROR
Server: nginx
Date: Thu, 20 Sep 2018 23:04:22 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Language, Cookie
Content-Language: en
API Calls
Response if it went well:
{
"message": "Copy successful.",
"path": "/var/archivematica/.../api-demo-1/"
}
HTTP/1.1 200 OK
Connection: keep-alive
Content-Language: en
Content-Type: application/json
Date: Thu, 20 Sep 2018 22:51:57 GMT
Server: nginx/1.14.0
Transfer-Encoding: chunked
Vary: Accept-Language, Cookie
Next Steps
Approve Transfer:
http --pretty=format 
-f 
POST "http://127.0.0.1:62080/api/transfer/approve" 
Authorization:"ApiKey test:test" 
type="standard" 
directory="api-demo-1"
And what’s going on there?
Submit as URL Encoded Form -f
(Verb) Submit data to the server: POST
API Endpoint: “http://127.0.0.1:62080/api/transfer/approve”
API User and Key as a HTTP Header Authorization:"ApiKey test:test"
Transfer type type=”standard”
Directory to approve (consider that this directory
has become ‘api-demo-1’ in the watched transfers
folder)
directory=”api-demo-1”
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Language: en
Content-Type: application/json
Date: Fri, 21 Sep 2018 16:30:22 GMT
Server: nginx/1.14.0
Transfer-Encoding: chunked
Vary: Accept-Language, Cookie
{
"message": "Approval successful.",
"uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b"
}
Lets’ try it out...
Outputs become inputs...
Our transfer UUID can be used for a status update:
● "uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b"
http --pretty=format 
-f 
GET "http://127.0.0.1:62080/api/transfer/status/1a06315f-0962-4f73-9f89-65d26c087a2b/" 
Authorization:"ApiKey test:test"
Which provides a SIP UUID
{
"directory": "api-demo-1-1a06315f-0962-4f73-9f89-65d26c087a2b",
"message": "Fetched status for 1a06315f-0962-4f73-9f89-65d26c087a2b successfully.",
"microservice": "Check transfer directory for objects",
"name": "api-demo-1",
"path": "/var/archivematica/.../api-demo-1-1a06315f-0962-4f73-9f89-65d26c087a2b/",
"sip_uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534",
"status": "COMPLETE",
"type": "transfer",
"uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b"
}
Outputs become inputs...
Our SIP UUID can be used for a status update as well:
● "uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534"
http --pretty=format 
-f 
GET "http://127.0.0.1:62080/api/ingest/status/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" 
Authorization:"ApiKey test:test"
Which tells us where our AIP is...
{
"directory": "api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534",
"message": "Fetched status for d29d91ff-1dff-4a4b-a855-2556d2ed3534 successfully.",
"microservice": "Remove the processing directory",
"name": "api-demo-1",
"path": "/var/archivematica/.../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534/",
"status": "COMPLETE",
"type": "SIP",
"uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534"
}
Let’s see for ourselves...
Reingest.py
● Script created for Canadian Center of Architects (CCA)
● Link: https://bit.ly/2zlJzqB
● Relies on being run and re-run, e.g. via CRON
● Once a status of COMPLETE for a SIP is returned, a new job is started
● Automation-tools transfer.py was the basis for that work
Point of Note
The Storage Service is the better place to retrieve an update on a package’s
status. COMPLETE in Archivematica is simply a status from the microservice
processing, so…
http --pretty=format 
GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" 
Authorization:"ApiKey test:test"
Point of Note
{
"current_full_path": "/var/.../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534.7z",
"current_location": "/api/v2/location/a21bb3cb-b573-44aa-8ac6-3244ae1efdfa/",
"current_path": ".../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534.7z",
"encrypted": false,
"misc_attributes": {},
"origin_pipeline": "/api/v2/pipeline/46d06310-ecba-4632-a6c4-ffcd9c2a7088/",
"package_type": "AIP",
"related_packages": [],
"replicas": [],
"replicated_package": null,
"resource_uri": "/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/",
"size": 6796913,
"status": "UPLOADED",
"uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534"
}
Working with Packages
Download a package:
http 
GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/download/" 
Authorization:"ApiKey test:test"
+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+
Working with Packages
Download an individual file:
http 
GET "http://127.0.0.1:62081/api/v2/file/{sip-uuid}/
extract_file/?relative_path_to_file=api-demo-1-{sip-uuid}
/data/METS.{sip-uuid}.xml" 
Authorization:"ApiKey test:test"
Archivematica AIP Structure:
https://www.archivematica.org/en/docs/archivematica-1.7/user-manual/archival-storage/aip-structure/
Downloading...
AMClient.py
● Wraps API functionalities as a CLI tool.
● Used inside the Automation Tools, and Automated Testing. It is also a very
convenient script for developers to use…
● Examples:
python -m transfers.amclient get-pipelines 
--ss-user-name test 
--ss-url http://127.0.0.1:62081 
test | python -m json.tool
python -m transfers.amclient aips 
--ss-user-name test 
--ss-url http://127.0.0.1:62081 
test | python -m json.tool
Devtools - mcp-rpc-cli
If the processing configuration accidentally contains decision points but you
still want to move a transfer forward automatically, use mcp-rpc-cli:
● Demo: https://asciinema.org/a/195109
● Archivematica Documentation: https://bit.ly/2OIUzUu
Support for this tool is unlikely after Archivematica 1.8
Looking to the future
Just slightly beyond Archivematica 1.8, and a little bit in 1.8 too… (Resource
oriented; masking of complexity (e.g. no-longer two-steps to approve); more
considered API design practice)
http --pretty=format 
POST 127.0.0.1:62080/api/v2beta/package 
"Authorization: ApiKey test:test" 
processing_config=automated 
path=$(echo -n '/home/archivematica/archivematica-sampledata/api-demo/udenver' | base64 -w 0) 
name=v2_beta_endpoint_example
Fin
Thank you!

More Related Content

What's hot

AWS RDS Benchmark - Instance comparison
AWS RDS Benchmark - Instance comparisonAWS RDS Benchmark - Instance comparison
AWS RDS Benchmark - Instance comparisonRoberto Gaiser
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScaleMariaDB plc
 
Apache Arrow: Open Source Standard Becomes an Enterprise Necessity
Apache Arrow: Open Source Standard Becomes an Enterprise NecessityApache Arrow: Open Source Standard Becomes an Enterprise Necessity
Apache Arrow: Open Source Standard Becomes an Enterprise NecessityWes McKinney
 
The evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityThe evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityJulian Hyde
 
How Scylla Manager Handles Backups
How Scylla Manager Handles BackupsHow Scylla Manager Handles Backups
How Scylla Manager Handles BackupsScyllaDB
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Ryan Blue
 
Pandas UDF: Scalable Analysis with Python and PySpark
Pandas UDF: Scalable Analysis with Python and PySparkPandas UDF: Scalable Analysis with Python and PySpark
Pandas UDF: Scalable Analysis with Python and PySparkLi Jin
 
ITIL Service Strategy
ITIL Service StrategyITIL Service Strategy
ITIL Service StrategyMarvin Sirait
 
Airflow at lyft for Airflow summit 2020 conference
Airflow at lyft for Airflow summit 2020 conferenceAirflow at lyft for Airflow summit 2020 conference
Airflow at lyft for Airflow summit 2020 conferenceTao Feng
 
Powering Interactive BI Analytics with Presto and Delta Lake
Powering Interactive BI Analytics with Presto and Delta LakePowering Interactive BI Analytics with Presto and Delta Lake
Powering Interactive BI Analytics with Presto and Delta LakeDatabricks
 
ENEL Electricity Topology Network on Neo4j Graph DB
ENEL Electricity Topology Network on Neo4j Graph DBENEL Electricity Topology Network on Neo4j Graph DB
ENEL Electricity Topology Network on Neo4j Graph DBNeo4j
 
Data Warehousing in the Cloud: Practical Migration Strategies
Data Warehousing in the Cloud: Practical Migration Strategies Data Warehousing in the Cloud: Practical Migration Strategies
Data Warehousing in the Cloud: Practical Migration Strategies SnapLogic
 
How to Build Data Science Teams
How to Build Data Science TeamsHow to Build Data Science Teams
How to Build Data Science TeamsGanes Kesari
 
Transform Your Telecom Operations with Graph Technologies
Transform Your Telecom Operations with Graph TechnologiesTransform Your Telecom Operations with Graph Technologies
Transform Your Telecom Operations with Graph TechnologiesNeo4j
 
Overview of Apache Flink: Next-Gen Big Data Analytics Framework
Overview of Apache Flink: Next-Gen Big Data Analytics FrameworkOverview of Apache Flink: Next-Gen Big Data Analytics Framework
Overview of Apache Flink: Next-Gen Big Data Analytics FrameworkSlim Baltagi
 
Administration guide (Online Charging System)
Administration guide (Online Charging System)Administration guide (Online Charging System)
Administration guide (Online Charging System)Ankur Gupta
 
Hadoop Distributed file system.pdf
Hadoop Distributed file system.pdfHadoop Distributed file system.pdf
Hadoop Distributed file system.pdfvishal choudhary
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresFederico Razzoli
 
Data Lake - Multitenancy Best Practices
Data Lake - Multitenancy Best PracticesData Lake - Multitenancy Best Practices
Data Lake - Multitenancy Best PracticesCitiusTech
 
Reducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresReducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresEDB
 

What's hot (20)

AWS RDS Benchmark - Instance comparison
AWS RDS Benchmark - Instance comparisonAWS RDS Benchmark - Instance comparison
AWS RDS Benchmark - Instance comparison
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
Apache Arrow: Open Source Standard Becomes an Enterprise Necessity
Apache Arrow: Open Source Standard Becomes an Enterprise NecessityApache Arrow: Open Source Standard Becomes an Enterprise Necessity
Apache Arrow: Open Source Standard Becomes an Enterprise Necessity
 
The evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its CommunityThe evolution of Apache Calcite and its Community
The evolution of Apache Calcite and its Community
 
How Scylla Manager Handles Backups
How Scylla Manager Handles BackupsHow Scylla Manager Handles Backups
How Scylla Manager Handles Backups
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)
 
Pandas UDF: Scalable Analysis with Python and PySpark
Pandas UDF: Scalable Analysis with Python and PySparkPandas UDF: Scalable Analysis with Python and PySpark
Pandas UDF: Scalable Analysis with Python and PySpark
 
ITIL Service Strategy
ITIL Service StrategyITIL Service Strategy
ITIL Service Strategy
 
Airflow at lyft for Airflow summit 2020 conference
Airflow at lyft for Airflow summit 2020 conferenceAirflow at lyft for Airflow summit 2020 conference
Airflow at lyft for Airflow summit 2020 conference
 
Powering Interactive BI Analytics with Presto and Delta Lake
Powering Interactive BI Analytics with Presto and Delta LakePowering Interactive BI Analytics with Presto and Delta Lake
Powering Interactive BI Analytics with Presto and Delta Lake
 
ENEL Electricity Topology Network on Neo4j Graph DB
ENEL Electricity Topology Network on Neo4j Graph DBENEL Electricity Topology Network on Neo4j Graph DB
ENEL Electricity Topology Network on Neo4j Graph DB
 
Data Warehousing in the Cloud: Practical Migration Strategies
Data Warehousing in the Cloud: Practical Migration Strategies Data Warehousing in the Cloud: Practical Migration Strategies
Data Warehousing in the Cloud: Practical Migration Strategies
 
How to Build Data Science Teams
How to Build Data Science TeamsHow to Build Data Science Teams
How to Build Data Science Teams
 
Transform Your Telecom Operations with Graph Technologies
Transform Your Telecom Operations with Graph TechnologiesTransform Your Telecom Operations with Graph Technologies
Transform Your Telecom Operations with Graph Technologies
 
Overview of Apache Flink: Next-Gen Big Data Analytics Framework
Overview of Apache Flink: Next-Gen Big Data Analytics FrameworkOverview of Apache Flink: Next-Gen Big Data Analytics Framework
Overview of Apache Flink: Next-Gen Big Data Analytics Framework
 
Administration guide (Online Charging System)
Administration guide (Online Charging System)Administration guide (Online Charging System)
Administration guide (Online Charging System)
 
Hadoop Distributed file system.pdf
Hadoop Distributed file system.pdfHadoop Distributed file system.pdf
Hadoop Distributed file system.pdf
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
 
Data Lake - Multitenancy Best Practices
Data Lake - Multitenancy Best PracticesData Lake - Multitenancy Best Practices
Data Lake - Multitenancy Best Practices
 
Reducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresReducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with Postgres
 

Similar to Introduction to the Archivematica API (September 2018)

Manage your APIs and Microservices with an API Gateway
Manage your APIs and Microservices with an API GatewayManage your APIs and Microservices with an API Gateway
Manage your APIs and Microservices with an API GatewayThibault Charbonnier
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...NGINX, Inc.
 
20160307 apex connects_jira
20160307 apex connects_jira20160307 apex connects_jira
20160307 apex connects_jiraMT AG
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack APIKrunal Jain
 
OSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga TeamOSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga TeamNETWAYS
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTKai Zhao
 
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessYour API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessQAware GmbH
 
2018 10-31 modern-http_routing-lisa18
2018 10-31 modern-http_routing-lisa182018 10-31 modern-http_routing-lisa18
2018 10-31 modern-http_routing-lisa18Sandor Szuecs
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek PROIDEA
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackJakub Hajek
 
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.Cisco DevNet
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversTatsuhiko Miyagawa
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and CaliforniumJulien Vermillard
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
 
Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Ying Xu
 
Writing REST APIs with OpenAPI and Swagger Ada
Writing REST APIs with OpenAPI and Swagger AdaWriting REST APIs with OpenAPI and Swagger Ada
Writing REST APIs with OpenAPI and Swagger AdaStephane Carrez
 

Similar to Introduction to the Archivematica API (September 2018) (20)

Manage your APIs and Microservices with an API Gateway
Manage your APIs and Microservices with an API GatewayManage your APIs and Microservices with an API Gateway
Manage your APIs and Microservices with an API Gateway
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
 
20160307 apex connects_jira
20160307 apex connects_jira20160307 apex connects_jira
20160307 apex connects_jira
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 
API gateway setup
API gateway setupAPI gateway setup
API gateway setup
 
Sprint 17
Sprint 17Sprint 17
Sprint 17
 
OSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga TeamOSMC 2009 | Icinga by Icinga Team
OSMC 2009 | Icinga by Icinga Team
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoT
 
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessYour API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
 
2018 10-31 modern-http_routing-lisa18
2018 10-31 modern-http_routing-lisa182018 10-31 modern-http_routing-lisa18
2018 10-31 modern-http_routing-lisa18
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
MesosCon - Be a microservices hero
MesosCon - Be a microservices heroMesosCon - Be a microservices hero
MesosCon - Be a microservices hero
 
Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018Kafka elastic search meetup 09242018
Kafka elastic search meetup 09242018
 
Writing REST APIs with OpenAPI and Swagger Ada
Writing REST APIs with OpenAPI and Swagger AdaWriting REST APIs with OpenAPI and Swagger Ada
Writing REST APIs with OpenAPI and Swagger Ada
 

More from Artefactual Systems - Archivematica

Archivematica Community Profile: University of Texas, San Antonio by Julianna...
Archivematica Community Profile: University of Texas, San Antonio by Julianna...Archivematica Community Profile: University of Texas, San Antonio by Julianna...
Archivematica Community Profile: University of Texas, San Antonio by Julianna...Artefactual Systems - Archivematica
 
Archivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArchivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArtefactual Systems - Archivematica
 
Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Artefactual Systems - Archivematica
 
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...Artefactual Systems - Archivematica
 
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...Artefactual Systems - Archivematica
 
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...Artefactual Systems - Archivematica
 
Getting Started with AtoM and Archivematica for Digital Preservation and Access
Getting Started with AtoM and Archivematica for Digital Preservation and AccessGetting Started with AtoM and Archivematica for Digital Preservation and Access
Getting Started with AtoM and Archivematica for Digital Preservation and AccessArtefactual Systems - Archivematica
 

More from Artefactual Systems - Archivematica (20)

Automation tools: making things go... (March 2019)
Automation tools: making things go... (March 2019)Automation tools: making things go... (March 2019)
Automation tools: making things go... (March 2019)
 
Acts of maintenance
Acts of maintenanceActs of maintenance
Acts of maintenance
 
Archivematica Community Profile: University of Texas, San Antonio by Julianna...
Archivematica Community Profile: University of Texas, San Antonio by Julianna...Archivematica Community Profile: University of Texas, San Antonio by Julianna...
Archivematica Community Profile: University of Texas, San Antonio by Julianna...
 
Archivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArchivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany Scott
 
Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)
 
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
 
Archives canada digital preservation service (acdps)
Archives canada digital preservation service (acdps)Archives canada digital preservation service (acdps)
Archives canada digital preservation service (acdps)
 
Digital Preservation with Archivematica: An Introduction
Digital Preservation with Archivematica: An IntroductionDigital Preservation with Archivematica: An Introduction
Digital Preservation with Archivematica: An Introduction
 
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...
Do Something Now: Why Perfect is the Enemy of Good (Enough) in Digital Preser...
 
Workshop slides - Introduction to AtoM and Archivematica
Workshop slides - Introduction to AtoM and ArchivematicaWorkshop slides - Introduction to AtoM and Archivematica
Workshop slides - Introduction to AtoM and Archivematica
 
Archivematica and the digital archival chain of custody
Archivematica and the digital archival chain of custodyArchivematica and the digital archival chain of custody
Archivematica and the digital archival chain of custody
 
Adding MediaConch to Archivematica for mkv/ffv1 checking
Adding MediaConch to Archivematica for mkv/ffv1 checkingAdding MediaConch to Archivematica for mkv/ffv1 checking
Adding MediaConch to Archivematica for mkv/ffv1 checking
 
Digital Preservation with Archivematica
Digital Preservation with ArchivematicaDigital Preservation with Archivematica
Digital Preservation with Archivematica
 
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...
Avoiding the 927 Problem: Standards, Digital Preservation, and Communities of...
 
Introduction to Archivematica
Introduction to ArchivematicaIntroduction to Archivematica
Introduction to Archivematica
 
PREMIS in METS in Archivematica
PREMIS in METS in ArchivematicaPREMIS in METS in Archivematica
PREMIS in METS in Archivematica
 
Archivematica Community Update - SAA 2016
Archivematica Community Update - SAA 2016Archivematica Community Update - SAA 2016
Archivematica Community Update - SAA 2016
 
Your Digital Preservation Cookbook
Your Digital Preservation CookbookYour Digital Preservation Cookbook
Your Digital Preservation Cookbook
 
Archivematica presentation to SJSU iSchool Colloquia series
Archivematica presentation to SJSU iSchool Colloquia seriesArchivematica presentation to SJSU iSchool Colloquia series
Archivematica presentation to SJSU iSchool Colloquia series
 
Getting Started with AtoM and Archivematica for Digital Preservation and Access
Getting Started with AtoM and Archivematica for Digital Preservation and AccessGetting Started with AtoM and Archivematica for Digital Preservation and Access
Getting Started with AtoM and Archivematica for Digital Preservation and Access
 

Recently uploaded

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Recently uploaded (20)

The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Introduction to the Archivematica API (September 2018)

  • 1. Archivematica API and AMClient Scripts Ross Spencer @ Artefactual Systems, Inc. rspencer@artefactual.com
  • 2. Introduction ● Developer at Artefactual, November 2017 ● One of a handful working on the Archivematica Project ● Background in digital preservation: ○ The National Archives UK ○ Archives New Zealand ● Current work interests: ○ Dataverse Integration for Scholars Portal ○ Technical training (next camp, Houston in November!) ○ And of course, improving our API and Docs!
  • 3. What is an API API stands for Application Programming Interface A description of a software library or web service and how users and software agents are expected to interact with it. Common uses of an API might be to contribute, or retrieve data from a web service. “
  • 4. There are APIs for Everything! https://github.com/toddmotto/public-apis
  • 5. Archivematica’s APIs Two Primary APIs: Storage Service: https://wiki.archivematica.org/Storage_Service_API Archivematica: https://wiki.archivematica.org/Archivematica_API Additionally: SWORD: https://wiki.archivematica.org/Sword_API Plus AtoM: https://www.accesstomemory.org/en/docs/2.4/#api
  • 6. Jargon Endpoints: The API address (URL) that performs a particular action according to its specification. SFTP: Secure (encrypted) file transfer protocol cURL: Command line tool for transferring and retrieving data. HTTPie: A simpler more user friendly cURL like tool! Verbs: Actions associated with an API command, GET (retrieve), POST (submit).
  • 7. Jargon Processing configuration: Archivematica’s configuration file which determines the defaults associated with microservices, e.g. ‘Normalize for Access’. Decision Points: Microservices which halt by default unless configured otherwise. RPC: Remote procedure call. A method of interacting with the Archivematica job server where decision points need to be manually moved along. Devtools: Repository of tools capturing some miscellaneous Archivematica functionality.
  • 8. Jargon AMClient.py: A set of procedures that group API calls together, or make it easier to make an individual call. CLI: Command-line interface, or terminal. Text-based interaction with the operating system using special commands.
  • 9. Regular Workflow > Location configured in Storage Service, (e.g. UUID: 6b82c1f5-2b87-49ba-8e5f-947759201518) > SFTP data to a location (e.g. /home/transfer-data/) > Transfer is started via /api/transfer/start_transfer endpoint > With processingMCP.xml configured to be as automated as possible; transfer should run to completion...
  • 11. API Calls Starting a transfer using cURL: curl -v -X POST -H "Authorization: ApiKey test:test" --data "name=api-demo-1&type=standard" --data "paths[]= [$(echo -n '6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' | base64 -w 0)]" "http://127.0.0.1:62080/api/transfer/start_transfer/"
  • 12. API Calls Starting a transfer using HTTPie: http --pretty=format -f POST "http://127.0.0.1:62080/api/transfer/start_transfer/" Authorization:"ApiKey test:test" name="api-demo-1" type="standard" paths[]=" [$(echo -n '6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' | base64 -w 0)]"
  • 14.
  • 15. --data Submit as URL Encoded Form -f (Verb) Submit data to the server: POST API Endpoint: “http://127.0.0.1:62080/api/transfer/start_transfer/” API User and Key as a HTTP Header Authorization:"ApiKey test:test" Transfer Name name="api-demo-1" Transfer Type type="standard" Transfer source UUID and paths to the data in the Transfer Source encoded as Base64 paths[]=" [$(echo -n '6b82c1f5-2b87-49ba-8e5f-947759201518:/home/.../udenver' | base64 -w 0)]"
  • 16. How do I find the location? Via the Storage Service UI, or Storage Service API: http --pretty=format GET "http://127.0.0.1:62081/api/v2/location/" Authorization:"ApiKey test:test"
  • 17. Location :: Response { "description": "Archivematica Transfer Source", "enabled": true, "path": "/home", "pipeline": [ "/api/v2/pipeline/1df71c34-7372-45f8-a7b5-455d7fc16d56/" ], "purpose": "TS", "quota": null, "relative_path": "home", "resource_uri": "/api/v2/location/ef938612-846e-4585-b665-c5596305547b/", "space": "/api/v2/space/021f8842-39be-42f5-93ee-b9b9014ec34a/", "used": "0", "uuid": "ef938612-846e-4585-b665-c5596305547b" },
  • 18. Location :: Response We can access the structure (JSON) and find the pieces we require to construct a path: ● "relative_path": "home", ● "uuid": "ef938612-846e-4585-b665-c5596305547b", Becomes: ● 'ef938612-846e-4585-b665-c5596305547b: /home/archivematica/archivematica-sampledata/api-demo/udenver'
  • 19. API Calls If something went wrong starting the transfer: HTTP/1.1 403 FORBIDDEN Connection: keep-alive Content-Language: en Content-Type: application/json Date: Thu, 20 Sep 2018 22:56:29 GMT Server: nginx Transfer-Encoding: chunked Vary: Accept-Language, Cookie { "error": true, "message": "API key not valid." }
  • 20. API Calls Or something else went wrong: HTTP/1.1 500 INTERNAL SERVER ERROR Server: nginx Date: Thu, 20 Sep 2018 23:04:22 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Language, Cookie Content-Language: en
  • 21. API Calls Response if it went well: { "message": "Copy successful.", "path": "/var/archivematica/.../api-demo-1/" } HTTP/1.1 200 OK Connection: keep-alive Content-Language: en Content-Type: application/json Date: Thu, 20 Sep 2018 22:51:57 GMT Server: nginx/1.14.0 Transfer-Encoding: chunked Vary: Accept-Language, Cookie
  • 22. Next Steps Approve Transfer: http --pretty=format -f POST "http://127.0.0.1:62080/api/transfer/approve" Authorization:"ApiKey test:test" type="standard" directory="api-demo-1"
  • 23. And what’s going on there? Submit as URL Encoded Form -f (Verb) Submit data to the server: POST API Endpoint: “http://127.0.0.1:62080/api/transfer/approve” API User and Key as a HTTP Header Authorization:"ApiKey test:test" Transfer type type=”standard” Directory to approve (consider that this directory has become ‘api-demo-1’ in the watched transfers folder) directory=”api-demo-1”
  • 24. Response HTTP/1.1 200 OK Connection: keep-alive Content-Language: en Content-Type: application/json Date: Fri, 21 Sep 2018 16:30:22 GMT Server: nginx/1.14.0 Transfer-Encoding: chunked Vary: Accept-Language, Cookie { "message": "Approval successful.", "uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b" }
  • 25. Lets’ try it out...
  • 26. Outputs become inputs... Our transfer UUID can be used for a status update: ● "uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b" http --pretty=format -f GET "http://127.0.0.1:62080/api/transfer/status/1a06315f-0962-4f73-9f89-65d26c087a2b/" Authorization:"ApiKey test:test"
  • 27. Which provides a SIP UUID { "directory": "api-demo-1-1a06315f-0962-4f73-9f89-65d26c087a2b", "message": "Fetched status for 1a06315f-0962-4f73-9f89-65d26c087a2b successfully.", "microservice": "Check transfer directory for objects", "name": "api-demo-1", "path": "/var/archivematica/.../api-demo-1-1a06315f-0962-4f73-9f89-65d26c087a2b/", "sip_uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534", "status": "COMPLETE", "type": "transfer", "uuid": "1a06315f-0962-4f73-9f89-65d26c087a2b" }
  • 28. Outputs become inputs... Our SIP UUID can be used for a status update as well: ● "uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534" http --pretty=format -f GET "http://127.0.0.1:62080/api/ingest/status/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" Authorization:"ApiKey test:test"
  • 29. Which tells us where our AIP is... { "directory": "api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534", "message": "Fetched status for d29d91ff-1dff-4a4b-a855-2556d2ed3534 successfully.", "microservice": "Remove the processing directory", "name": "api-demo-1", "path": "/var/archivematica/.../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534/", "status": "COMPLETE", "type": "SIP", "uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534" }
  • 30. Let’s see for ourselves...
  • 31. Reingest.py ● Script created for Canadian Center of Architects (CCA) ● Link: https://bit.ly/2zlJzqB ● Relies on being run and re-run, e.g. via CRON ● Once a status of COMPLETE for a SIP is returned, a new job is started ● Automation-tools transfer.py was the basis for that work
  • 32. Point of Note The Storage Service is the better place to retrieve an update on a package’s status. COMPLETE in Archivematica is simply a status from the microservice processing, so… http --pretty=format GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" Authorization:"ApiKey test:test"
  • 33. Point of Note { "current_full_path": "/var/.../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534.7z", "current_location": "/api/v2/location/a21bb3cb-b573-44aa-8ac6-3244ae1efdfa/", "current_path": ".../api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534.7z", "encrypted": false, "misc_attributes": {}, "origin_pipeline": "/api/v2/pipeline/46d06310-ecba-4632-a6c4-ffcd9c2a7088/", "package_type": "AIP", "related_packages": [], "replicas": [], "replicated_package": null, "resource_uri": "/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/", "size": 6796913, "status": "UPLOADED", "uuid": "d29d91ff-1dff-4a4b-a855-2556d2ed3534" }
  • 34. Working with Packages Download a package: http GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/download/" Authorization:"ApiKey test:test" +-----------------------------------------+ | NOTE: binary data not shown in terminal | +-----------------------------------------+
  • 35. Working with Packages Download an individual file: http GET "http://127.0.0.1:62081/api/v2/file/{sip-uuid}/ extract_file/?relative_path_to_file=api-demo-1-{sip-uuid} /data/METS.{sip-uuid}.xml" Authorization:"ApiKey test:test" Archivematica AIP Structure: https://www.archivematica.org/en/docs/archivematica-1.7/user-manual/archival-storage/aip-structure/
  • 37. AMClient.py ● Wraps API functionalities as a CLI tool. ● Used inside the Automation Tools, and Automated Testing. It is also a very convenient script for developers to use… ● Examples: python -m transfers.amclient get-pipelines --ss-user-name test --ss-url http://127.0.0.1:62081 test | python -m json.tool python -m transfers.amclient aips --ss-user-name test --ss-url http://127.0.0.1:62081 test | python -m json.tool
  • 38. Devtools - mcp-rpc-cli If the processing configuration accidentally contains decision points but you still want to move a transfer forward automatically, use mcp-rpc-cli: ● Demo: https://asciinema.org/a/195109 ● Archivematica Documentation: https://bit.ly/2OIUzUu Support for this tool is unlikely after Archivematica 1.8
  • 39. Looking to the future Just slightly beyond Archivematica 1.8, and a little bit in 1.8 too… (Resource oriented; masking of complexity (e.g. no-longer two-steps to approve); more considered API design practice) http --pretty=format POST 127.0.0.1:62080/api/v2beta/package "Authorization: ApiKey test:test" processing_config=automated path=$(echo -n '/home/archivematica/archivematica-sampledata/api-demo/udenver' | base64 -w 0) name=v2_beta_endpoint_example