Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Created March 27, 2019 00:43
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-mapper/b758cf0fe6d353846ef9ce7d03fdca0c to your computer and use it in GitHub Desktop.
Save max-mapper/b758cf0fe6d353846ef9ce7d03fdca0c to your computer and use it in GitHub Desktop.
upload large file to zenodo from command line (curl)
# in zenodo ui create a deposition. get the id
curl -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" "https://www.zenodo.org/api/deposit/depositions/$DEPOSITION"
# get the bucket id from above
curl --progress-bar -o /dev/null --upload-file ./$FILE https://www.zenodo.org/api/files/$BUCKET/$FILE?access_token=$TOKEN
@jhpoelen
Copy link

nice! super helpful.

I added:

# in zenodo ui create a deposition. get the id
set -xe

DEPOSITION=$1
FILEPATH=$2
FILENAME=$(echo $FILEPATH | sed 's+.*/++g')

BUCKET=$(curl -H "Accept: application/json" -H "Authorization: Bearer $ZENODO_TOKEN" "https://www.zenodo.org/api/deposit/depositions/$DEPOSITION" | jq --raw-output .links.bucket)


curl --progress-bar -o /dev/null --upload-file $FILEPATH $BUCKET/$FILENAME?access_token=$ZENODO_TOKEN

@max-mapper
Copy link
Author

greetings @jhpoelen !

@jhpoelen
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment