Last active
November 14, 2018 01:07
-
-
Save jhpoelen/53d9c148723f6716dfded93ebf1ce73a to your computer and use it in GitHub Desktop.
bash script for uploading to Zenodo
This file contains 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
{ | |
"conceptrecid": "1486278", | |
"created": "2018-11-14T00:29:34.856766+00:00", | |
"files": [], | |
"id": 1486279, | |
"links": { | |
"bucket": "https://zenodo.org/api/files/35cfca90-d31f-4b36-b91a-8def579ca410", | |
"discard": "https://zenodo.org/api/deposit/depositions/1486279/actions/discard", | |
"edit": "https://zenodo.org/api/deposit/depositions/1486279/actions/edit", | |
"files": "https://zenodo.org/api/deposit/depositions/1486279/files", | |
"html": "https://zenodo.org/deposit/1486279", | |
"latest_draft": "https://zenodo.org/api/deposit/depositions/1486279", | |
"latest_draft_html": "https://zenodo.org/deposit/depositions/1486279", | |
"publish": "https://zenodo.org/api/deposit/depositions/1486279/actions/publish", | |
"self": "https://zenodo.org/api/deposit/depositions/1486279" | |
}, | |
"metadata": { | |
"prereserve_doi": { | |
"doi": "10.5281/zenodo.1486279", | |
"recid": 1486279 | |
} | |
}, | |
"modified": "2018-11-14T00:29:34.856774+00:00", | |
"owner": 7292, | |
"record_id": 1486279, | |
"state": "unsubmitted", | |
"submitted": false, | |
"title": "" | |
} |
This file contains 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 deposition | |
curl -X POST --data "{}" \ | |
--header "Content-Type: application/json"\ | |
"https://zenodo.org/api/deposit/depositions?access_token=$ZENODO_ACCESS_TOKEN"\ | |
> resp.json | |
pub_id=$(resp.json | jq .id) | |
remote_filename="prov.nq.sha256" | |
local_filename="prov.nq.sha256" | |
curl --progress-bar -X PUT -H "Accept: application/json" -H "Content-Type: application/octet-stream" -H "Authorization: Bearer $ZENODO_ACCESS_TOKEN" -d @$local_filename https://www.zenodo.org/api/files/$pub_id/$remote_filename | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment