Skip to contents

The returned payload is cleaned with ztCleanPayload() and can be placed in a create plan. The default fetcher contacts the public Crossref API; inject a compatible function for reproducible or offline work.

Usage

ztCrossref(doi, getJson = .zotCrossrefGet)

Arguments

doi

The DOI to resolve.

getJson

Injectable fetcher returning the parsed Crossref message for a DOI; the default performs the real request.

Value

An item payload for a create row, or a classed error when the DOI does not resolve.

Examples

Message <- function(doi) list(
  title = list("A reproducible record"),
  author = list(list(given = "Ada", family = "Lovelace")),
  `container-title` = list("Example Journal"),
  issued = list(`date-parts` = list(list(2026L)))
)
ztCrossref("10.1000/example", getJson = Message)
#> $itemType
#> [1] "journalArticle"
#> 
#> $title
#> [1] "A reproducible record"
#> 
#> $creators
#> $creators[[1]]
#> $creators[[1]]$creatorType
#> [1] "author"
#> 
#> $creators[[1]]$firstName
#> [1] "Ada"
#> 
#> $creators[[1]]$lastName
#> [1] "Lovelace"
#> 
#> 
#> 
#> $DOI
#> [1] "10.1000/example"
#> 
#> $publicationTitle
#> [1] "Example Journal"
#> 
#> $date
#> [1] "2026"
#>