Retrieve a GeoLocator Data Package from a Zenodo record identifier:
Resolve and fetch Zenodo record metadata from the REST API.
Validate record files and download them to a temporary directory.
Read
datapackage.jsonwithread_gldp().Attach Zenodo metadata and recompute derived package properties with
update_gldp().
Arguments
- id
Zenodo identifier. Can be a record id, DOI, DOI URL, or Zenodo record URL. Supported examples include
"18467383","10.5281/zenodo.18467383","https://doi.org/10.5281/zenodo.18467383", and"https://zenodo.org/records/18467383". For Zenodo Sandbox records, setsandbox = TRUE.- token
Optional Zenodo access token for authenticated requests. Supply it explicitly, or leave
NULLto resolve it from environment variables or the system keyring. Draft access usually requires a token.- draft
Logical. If
TRUE, read the draft version of the record instead of the public record. This queries the draft endpoint (/api/records/{id}/draft), which requires a token and permission to access the deposition. Use this for unpublished records or when draft files or metadata differ from the published record.- sandbox
Logical. If
TRUE, query Zenodo Sandbox instead of the main Zenodo service. This also switches token lookup to sandbox-first sources.- quiet
Logical. If
TRUE, suppress progress messages fromread_zenodo().
Details
If files are not visible/downloadable (for example restricted record access), the function returns a metadata-only package created with
create_gldp()and emits a warning.If the record does not contain
datapackage.json, the function aborts.If one or more file downloads fail, the function aborts with download details.
Downloaded files are written under tempdir() in a run-specific folder. This
directory is temporary and may be removed by the operating system after the
R session.
To read a draft:
Create or identify the Zenodo deposition and note its record id.
Obtain a Zenodo access token with permission to view that draft.
Provide the token directly with
token =, or make it available asZENODO_TOKEN(main Zenodo) orZENODO_TOKEN_SANDBOX(Zenodo Sandbox). The same names are also checked in the system keyring.Call
read_zenodo(id, draft = TRUE), and setsandbox = TRUEwhen the draft is hosted on Zenodo Sandbox.
If token = NULL, token lookup is attempted in this order:
for main Zenodo:
ZENODO_TOKEN, then keyring serviceZENODO_TOKEN;for Zenodo Sandbox:
ZENODO_TOKEN_SANDBOX,ZENODO_TOKEN, then keyring servicesZENODO_TOKEN_SANDBOXandZENODO_TOKEN.
See also
read_gldp() to read a local or remote datapackage.json, and
create_gldp() for the empty package shell used when record files are not
accessible.
Examples
if (FALSE) { # \dontrun{
pkg <- read_zenodo("18467383", quiet = TRUE)
# Resolve from DOI URL
pkg <- read_zenodo("https://doi.org/10.5281/zenodo.18467383", quiet = TRUE)
# Access a draft in Zenodo Sandbox using a token from the environment/keyring
pkg <- read_zenodo("470406", sandbox = TRUE, draft = TRUE, quiet = TRUE)
# Or provide the token explicitly
pkg <- read_zenodo(
"470406",
sandbox = TRUE,
draft = TRUE,
token = "<TOKEN>",
quiet = TRUE
)
} # }
