API Docs for RESTful Ingest
TODO: Add in examples of Response when using pages (soon to be the default response)
Authorization
The REST server uses HTTP basic auth as a means of authorization. Each node has a username and password which are used when making a REST call.
ex:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
General Operations
Create Bag
- Purpose: Notifies the Ingest Server that a bag is ready to be created
- Request:
POST https://host:port/api/bags
Request Body: JSON in format:
{ "depositor": "dartmouth", "name": "8e55f5c4-a65c-4eb1-9aa4-a9c3742af8b3", "location": "dartmouth/8e55f5c4-a65c-4eb1-9aa4-a9c3742af8b3", }
- Response Code: 200 (on success)
Response Body: JSON:
{ "id": 1, "name": "bag-0", "depositor": "test-depositor", "location": "bags/test-bag-0", "tokenLocation": "tokens/test-bag-0-tokens", "fixityAlgorithm": "SHA-256", "size": 14821 }
Get All Bags
- Purpose: Provides the current version of the Bridge App
- Request:
GET https://host:port/api/bags/
- Query Parameters
- page: The page number to return, starting at 1. For use with page_size
- page_size: Maximum number of results per page
- status: The status of the bag to filter by (can be one of STAGED, TOKENIZED, REPLICATED, REPLICATING, ERROR)
- Response Code: 200 (on success)
Response Body: JSON:
{[{ "id": 1, "name": "bag-0", "depositor": "test-depositor", "location": "bags/test-bag-0", "tokenLocation": "tokens/test-bag-0-tokens", "fixityAlgorithm": "SHA-256", "size": 14821 },... ]}
Get A Single Bag
- Purpose: Get information about a single bag
- Request:
GET https://host:port/api/bags/
{bagID} - Response Code: 200 (on success)
Response Body: JSON:
{ "id": 1, "name": "bag-0", "depositor": "test-depositor", "location": "bags/test-bag-0", "tokenLocation": "tokens/test-bag-0-tokens", "fixityAlgorithm": "SHA-256", "size": 14821 }
Get Replication Requests
- Purpose: Get all replication requests for your node
- Request:
GET https://host:port/api/replications
- Query Parameters
- page: The page number to return, starting at 1. For use with page_size
- page_size: Maximum number of results per page
- status: The status of the bag to filter by (can be one of PENDING, STARTED, TRANSFERRED, SUCCESS, FAILURE_TOKEN_STORE, FAILURE_TAG_MANIFEST, FAILURE)
- Response Code: 200 (on success)
Response Body: JSON:
{[{ "id": 1, "status": "STARTED", "bagID": 4, "bagLink": "chrono@chronopolis-stage:/export/bags/test-bag-0", "tokenLink": "chrono@chronopolis-stage:/export/tokens/test-bag-0-tokens", "protocol": "rsync", "receivedTagFixity": "", "receivedTokenFixity": "" },... ]}
Get A Single Replication Request
- Purpose: Get information about a single replication request
- Request:
GET https://host:port/api/replications/{replicationID}
- Response Code: 200 (on success)
Response Body: JSON:
{ "id": 1, "status": "STARTED", "bagID": 4, "bagLink": "chrono@chronopolis-stage:/export/bags/test-bag-0", "tokenLink": "chrono@chronopolis-stage:/export/tokens/test-bag-0-tokens", "protocol": "rsync", "receivedTagFixity": "", "receivedTokenFixity": "" }
Update Replication Request
- Purpose: Update information about a replication request
- Request:
POST
https://host:port/api/replications/{replicationId} Request Body: JSON:
{ "id": 1, "status": "STARTED", "bagID": 4, "bagLink": "chrono@chronopolis-stage:/export/bags/test-bag-0", "tokenLink": "chrono@chronopolis-stage:/export/tokens/test-bag-0-tokens", "protocol": "rsync", "receivedTagFixity": "0a0c1cab94bbae183b694853dc144abe61b911f71a6c0d52af308be9b2f0959f", "receivedTokenFixity": "f1eaf7f041826579bff4090d1ae0d544dfb70d5c83ae9f6c9d2a268df02396d6" }
- Response Code: 200 (on success)
Response Body: JSON:
{ "id": 1, "status": "SUCCESS", "bagID": 4, "bagLink": "chrono@chronopolis-stage:/export/bags/test-bag-0", "tokenLink": "chrono@chronopolis-stage:/export/tokens/test-bag-0-tokens", "protocol": "rsync", "receivedTagFixity": "0a0c1cab94bbae183b694853dc144abe61b911f71a6c0d52af308be9b2f0959f", "receivedTokenFixity": "f1eaf7f041826579bff4090d1ae0d544dfb70d5c83ae9f6c9d2a268df02396d6" }