crossref_mailto()finds the contact address that Crossref asks for;crossref_request()prepares a request (not sent), to be performed sequentially or withhttr2::req_perform_parallel();crossref_client_limits()adapts the pace to the limits announced in the headers of a response;crossref_doi_path()gives the route of a DOI;crossref_search()fetches all the pages of a query.
Usage
crossref_request(
path,
query = list(),
mailto = "",
rate = 4,
user_agent = getOption("politecollect.user_agent", "politecollect (R httr2)")
)
crossref_mailto(
anonymous = getOption("politecollect.crossref_anonymous", FALSE)
)
crossref_client_limits(resp, rate, max_active = 1L)
crossref_doi_path(doi)
crossref_search(
path,
query = list(),
mailto = crossref_mailto(),
rows = 1000L,
rate = 4,
max_pages = Inf,
on_page = NULL
)Arguments
- path
Character. Route relative to
https://api.crossref.org, e.g."journals/0002-8282/works".- query
Named list of query parameters.
- mailto
Character. Contact address, also put in the user agent.
- rate
Numeric. Maximum requests per second.
- user_agent
Character. By default the option
politecollect.user_agent, or the name of the package.- anonymous
Logical. Accept the absence of an address? For small tests: anonymous traffic is throttled harder. By default the option
politecollect.crossref_anonymous, orFALSE.- resp
An
httr2_responsefrom Crossref.- max_active
Integer. Parallel requests wanted.
- doi
Character vector of DOIs.
- rows
Integer. Results per page (at most 1000).
- max_pages
Numeric. Maximum number of pages.
- on_page
Function called with each list of results and its page number, or
NULL. Seeapi_paginate().
Value
crossref_mailto(): a string. crossref_request(): an
httr2_request. crossref_client_limits(): a list with rate and
max_active. crossref_doi_path(): a character vector.
crossref_search(): the list returned by api_paginate().
Details
The address is read from the environment variable CROSSREF_MAILTO (in
~/.Renviron). crossref_mailto() was crossref_mailto_or_abort() in
building_jstor_database, where anonymous tests were switched on by the
option jstor.crossref_anonymous. Its default user agent named that project;
it is now the project's own politecollect.user_agent.
See also
Other APIs:
api_paginate(),
api_request(),
ia_search(),
openalex_api_key(),
scopus_api_key(),
sparql_query()
Examples
crossref_doi_path("10.1080/10584609.2018.1477506")
#> [1] "works/10.1080%2F10584609.2018.1477506"
if (FALSE) { # \dontrun{
res <- crossref_search(
"journals/0002-8282/works",
query = list(filter = "from-pub-date:2020-01"),
mailto = crossref_mailto(), max_pages = 1
)
} # }