Learn R Programming

orcidtr (version 0.1.0)

orcid_fetch_many: Retrieve records for multiple ORCID identifiers

Description

Fetches data for multiple ORCID identifiers. This is a convenience function that loops over a vector of ORCID iDs and fetches the specified section(s) for each. Results are combined into a single data.table.

Usage

orcid_fetch_many(
  orcid_ids,
  section = "works",
  token = NULL,
  stop_on_error = FALSE
)

Value

A data.table combining results from all successful requests. The orcid column identifies which ORCID each row belongs to.

Arguments

orcid_ids

Character vector. Valid ORCID identifiers in the format XXXX-XXXX-XXXX-XXXX. Can also handle URLs like https://orcid.org/XXXX-XXXX-XXXX-XXXX.

section

Character string. Section to fetch. One of: "employments", "educations", "distinctions", "invited-positions", "memberships", "qualifications", "services", "research-resources", "works", "funding", or "peer-reviews".

token

Character string or NULL. Optional API token for authenticated requests. If NULL (default), checks the ORCID_TOKEN environment variable.

stop_on_error

Logical. If TRUE, stops on the first error. If FALSE (default), continues processing and returns results for successful requests, issuing warnings for failures.

Details

This function makes one API request per ORCID identifier. Be mindful of rate limits when fetching data for many ORCIDs.

The function validates each ORCID identifier and normalizes formats before making requests.

For rate limit compliance, consider adding delays between large batches or using authenticated requests which typically have higher rate limits.

References

ORCID API Documentation: https://info.orcid.org/documentation/api-tutorials/

See Also

orcid_fetch_record, orcid_works, orcid_employments

Examples

Run this code
if (FALSE) {
# Fetch works for multiple ORCIDs
orcids <- c("0000-0002-1825-0097", "0000-0003-1419-2405")
works <- orcid_fetch_many(orcids, section = "works")
print(works)

# Fetch employments for multiple ORCIDs
employments <- orcid_fetch_many(orcids, section = "employments")

# Stop on first error
works <- orcid_fetch_many(orcids, section = "works", stop_on_error = TRUE)
}

Run the code above in your browser using DataLab