Last active
February 4, 2020 13:52
-
-
Save slint/478388786b9e4866385d75911aa4bb1a to your computer and use it in GitHub Desktop.
Zenodo REST API flows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the record | |
POST /api/deposit/depositions | |
{} | |
201 | |
{ | |
"id": 123, | |
"links": { | |
"bucket": "/api/files/<bucket-id>", | |
"publish": "/api/deposit/depositions/123/actions/publish", | |
... | |
}, | |
... | |
} | |
# Add metadata | |
PUT /api/deposit/depositions/123 | |
{ | |
"metadata": { | |
"title": "XYZ", | |
"creators": [ | |
{"name": "Ioannidis, Alex", ...}, | |
], | |
"doi": "<dryad-DOI>" | |
..., | |
"" | |
} | |
} | |
200 | |
{ | |
... | |
} | |
# Add files | |
PUT /api/files/<bucket-id>/<filename> | |
201 | |
{ | |
"checksum": "md5:..." | |
} | |
# Publish | |
POST /api/deposit/depositions/123/actions/publish | |
200 | |
{ | |
"links": { | |
"record_html": "https://zenodo.org/record/123", | |
# TODO: | |
"doi_html": "https://zenodo.org/doi/10.1234/alskfjs", | |
} | |
} | |
# Updating it | |
POST /api/deposit/depositions/123/actions/edit | |
# Continue as when un-published | |
# Replace a file | |
PUT /api/files/<bucket-id>/<filename> | |
# Delete a file | |
DELETE /api/files/<bucket-id>/<filename> | |
# ============================================= | |
# Deposit software + other | |
# Create the record | |
POST /api/deposit/depositions | |
{} | |
201 | |
{ | |
"id": 123, | |
"" | |
"links": { | |
"bucket": "/api/files/<bucket-id>", | |
"publish": "/api/deposit/depositions/123/actions/publish", | |
... | |
}, | |
... | |
} | |
# Add metadata | |
PUT /api/deposit/depositions/123 | |
{ | |
"metadata": { | |
"title": "XYZ", | |
"creators": [ | |
{"name": "Ioannidis, Alex", ...}, | |
], | |
..., | |
} | |
} | |
200 | |
{ | |
... | |
} | |
# Add files | |
PUT /api/files/<bucket-id>/<filename> | |
201 | |
{ | |
"checksum": "md5:..." | |
} | |
# Publish | |
POST /api/deposit/depositions/123/actions/publish | |
200 | |
{ | |
"links": { | |
"record_html": "https://zenodo.org/record/123", | |
# TODO: | |
"doi_html": "https://zenodo.org/doi/10.1234/alskfjs", | |
}, | |
"doi": "10.5281/zenodo.123", | |
"conceptdoi": "10.5281/zenodo.000" | |
} | |
# Scenario A: metadata-only change | |
POST /api/deposit/depositions/123/actions/edit | |
PUT /api/deposit/depositions/123 | |
POST /api/deposit/depositions/123/actions/publish | |
# Scenario A: file change(s) | |
POST /api/deposit/depositions/123/actions/newversion | |
201 | |
{ | |
"links": { | |
# New deposit ID | |
"latest_draft": "/api/deposit/depositions/456" | |
} | |
} | |
# Get bucket of new version | |
GET /api/deposit/depositions/456 | |
{ | |
"links": { | |
"bucket": "/api/files/<new-bucket-id>" | |
} | |
} | |
# Add/remove files to the new version | |
PUT /api/files/<new-bucket-id>/<new-filename> | |
DELETE /api/files/<new-bucket-id>/<filename> | |
# Change metadata | |
PUT /api/deposit/depositions/456 | |
{ ... } | |
# Publish the new version | |
POST /api/deposit/depositions/456/actions/publish | |
{ | |
"links": { | |
"record_html": "https://sandbox.zenodo.org/record/456" | |
} | |
} | |
POST /api/deposit/depositions/123/actions/newversion | |
POST /api/deposit/depositions/456/actions/newversion | |
{ | |
"links": { | |
"latest_draft": "/api/deposit/depositions/789" | |
} | |
} | |
DEPOSIT IDS: | |
- 123 | |
- 456 | |
- 789 | |
RECORD IDS: | |
- 000 <-- 10.5281/zenodo.000 | |
- 123 <-- 10.5281/zenodo.123 | |
- 456 <-- 10.5281/zenodo.456 | |
- 789 <-- 10.5281/zenodo.789 (non-published) | |
GET /api/deposit/depositions/000 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment