Skip to content

Instantly share code, notes, and snippets.

@jhnwllr
Created February 18, 2022 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhnwllr/ba678dedecfbbc99d7a1be3a546939ae to your computer and use it in GitHub Desktop.
Save jhnwllr/ba678dedecfbbc99d7a1be3a546939ae to your computer and use it in GitHub Desktop.
# zenodo large file upload
library(httr)
library(dplyr)
library(purrr)
# get your token here
# https://zenodo.org/account/settings/applications/
token = ""
deposit_id = 6137047 # fill in form
bucket = GET(paste0("https://www.zenodo.org/api/deposit/depositions/",deposit_id),
add_headers(Authorization = paste("Bearer", token)),
encode = 'json'
) %>%
content(as = "text") %>%
jsonlite::fromJSON() %>%
pluck("links") %>%
pluck("bucket") %>%
gsub("https://zenodo.org/api/files/","",.)
file = "GBIF_Fabaceae_2021_02_04.zip"
PUT(url = paste0("https://www.zenodo.org/api/files/",bucket,"/",file,"?access_token=",token),
body = upload_file(file) # path to your local file
) %>%
content(as = "text")
@jhnwllr
Copy link
Author

jhnwllr commented Feb 18, 2022

fill in the form to get deposit_id from url
https://zenodo.org/deposit?page=1&size=20

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