Skip to content

Instantly share code, notes, and snippets.

@ross-spencer
Created March 7, 2019 20:43
Show Gist options
  • Save ross-spencer/0be6ebc93bb0ffca3c2607eff63294a0 to your computer and use it in GitHub Desktop.
Save ross-spencer/0be6ebc93bb0ffca3c2607eff63294a0 to your computer and use it in GitHub Desktop.
Archivematica API demo
# Demo Commands for UDenver
----------------------------------------------------------
Version 1.0: 2018-09-21 Initial commands for UDenver Demo
Version 2.0: 2018-11-07 Added Unapproved Transfers Example
----------------------------------------------------------
# 1. Start Transfer
-------------------
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/archivematica/archivematica-sampledata/api-demo/udenver' \
| base64 -w 0)]"
-----------------------
# 2. Retrieve Locations
-----------------------
http --pretty=format \
GET "http://127.0.0.1:62081/api/v2/location/" \
Authorization:"ApiKey test:test"
------------------------------
# 3. List Unapproved Transfers
------------------------------
http --pretty=format \
-f \
GET "http://127.0.0.1:62080/api/transfer/unapproved/" \
Authorization:"ApiKey test:test"
---------------------
# 4. 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"
----------------------
5. Get Transfer Status
----------------------
http --pretty=format \
-f \
GET "http://127.0.0.1:62080/api/transfer/status/1a06315f-0962-4f73-9f89-65d26c087a2b/" \
Authorization:"ApiKey test:test"
-----------------
6. Get SIP Status
-----------------
http --pretty=format \
-f \
GET "http://127.0.0.1:62080/api/ingest/status/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" \
Authorization:"ApiKey test:test"
---------------------
7. Get Package Status
---------------------
http --pretty=format \
GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/" \
Authorization:"ApiKey test:test"
------------------
8. Download an AIP
------------------
http -v \
GET "http://127.0.0.1:62081/api/v2/file/31a50395-09e7-4b17-b673-fb48f652d622/download/" \
Authorization:"ApiKey test:test"
------------------------------
9. Download an individual file
------------------------------
http -v --pretty=format \
GET "http://127.0.0.1:62081/api/v2/file/d29d91ff-1dff-4a4b-a855-2556d2ed3534/extract_file/?relative_path_to_file=api-demo-1-d29d91ff-1dff-4a4b-a855-2556d2ed3534/data/METS.d29d91ff-1dff-4a4b-a855-2556d2ed3534.xml" \
Authorization:"ApiKey test:test" | less
-------------------------
10. AMClient Get Pipelines
-------------------------
python -m transfers.amclient get-pipelines \
--ss-user-name test \
--ss-url http://127.0.0.1:62081 \
test | python -m json.tool
--------------------------
11. AMClient Get all AIPS
--------------------------
python -m transfers.amclient aips \
--ss-user-name test \
--ss-url http://127.0.0.1:62081 \
test | python -m json.tool
-------------------------
12. Looking to the future
-------------------------
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment