Created
February 18, 2022 14:47
-
-
Save jhnwllr/ba678dedecfbbc99d7a1be3a546939ae to your computer and use it in GitHub Desktop.
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
# 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") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fill in the form to get deposit_id from url
https://zenodo.org/deposit?page=1&size=20