Title: | Client for the 'DataCite' API |
---|---|
Description: | Client for the web service methods provided by 'DataCite' (<https://www.datacite.org/>), including functions to interface with their 'RESTful' search API. The API is backed by 'Elasticsearch', allowing expressive queries, including faceting. |
Authors: | Scott Chamberlain [aut] , Bianca Kramer [cre] |
Maintainer: | Bianca Kramer <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.4 |
Built: | 2024-11-27 03:39:05 UTC |
Source: | https://github.com/ropensci/rdatacite |
DataCite R client
All HTTP requests are GET requests, and are sent with the following headers:
Accept: application/vnd.api+json; version=2
User-Agent: r-curl/4.3 crul/0.9.0 rOpenSci(rdatacite/0.5.0)
X-USER-AGENT: r-curl/4.3 crul/0.9.0 rOpenSci(rdatacite/0.5.0)
The user-agent strings change as the versions of each package change.
dc_data_center
dc_data_centers
dc_facet
dc_member
dc_members
dc_mlt
dc_oai_getrecord
dc_oai_identify
dc_oai_listidentifiers
dc_oai_listmetadataformats
dc_oai_listrecords
dc_oai_listsets
dc_search
dc_stats
dc_work
dc_works
For content negotation see rcrossref::cr_cn()
, which can be used for
Crossref, DataCite and Medra DOIs
rdatacite does not support the GraphGL API
https://support.datacite.org/docs/datacite-graphql-api-guide - we suggest
trying the ghql
package (https://github.com/ropensci/ghql/)
Scott Chamberlain [email protected]
DataCite REST API: activities
dc_activities( ids = NULL, query = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_activities( ids = NULL, query = NULL, limit = 25, page = 1, cursor = NULL, ... )
ids |
(character) one or more activity IDs |
query |
(character) Query string |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) the page to get results for. default: 1 |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::verb-GET |
for more info on the /activities
route see
https://support.datacite.org/docs/tracking-provenance
## Not run: if (dc_check()) { x <- dc_activities() x # dc_activities(x$data$id[1]) # FIXME: doesn't work, returns no data # dc_activities(query = "ecology") # FIXME: this thlimit a 500 error } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_activities() x # dc_activities(x$data$id[1]) # FIXME: doesn't work, returns no data # dc_activities(query = "ecology") # FIXME: this thlimit a 500 error } ## End(Not run)
DataCite REST API: client prefixes
dc_client_prefixes( query = NULL, year = NULL, client_id = NULL, prefix_id = NULL, sort = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_client_prefixes( query = NULL, year = NULL, client_id = NULL, prefix_id = NULL, sort = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
query |
(character) Query string |
year |
(integer/numeric/character) a year |
client_id |
a client ID |
prefix_id |
a prefix ID |
sort |
(character) variable to sort by |
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) the page to get results for. default: 1 |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::verb-GET |
## Not run: if (dc_check()) { x <- dc_client_prefixes() x } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_client_prefixes() x } ## End(Not run)
DataCite REST API: clients
dc_clients( ids = NULL, query = NULL, year = NULL, provider_id = NULL, software = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_clients( ids = NULL, query = NULL, year = NULL, provider_id = NULL, software = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
ids |
(character) one or more client IDs |
query |
(character) Query string |
year |
(integer/numeric/character) a year |
provider_id |
a provider ID |
software |
no idea what should go here, anyone? |
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) the page to get results for. default: 1 |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::verb-GET |
## Not run: if (dc_check()) { x <- dc_clients() x dc_clients(x$data$id[1]) dc_clients(x$data$id[1:2], verbose = TRUE) } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_clients() x dc_clients(x$data$id[1]) dc_clients(x$data$id[1:2], verbose = TRUE) } ## End(Not run)
DataCite content negotation
dc_cn(dois, format = "bibtex", style = "apa", locale = "en-US", ...)
dc_cn(dois, format = "bibtex", style = "apa", locale = "en-US", ...)
dois |
(character) one or more DOIs |
format |
Name of the format. One of "rdf-xml", "turtle", "citeproc-json", "schemaorg", "codemeta", "text", "ris", "bibtex" (default), "datacite-xml", "datacite-json", "bibentry", or "jats". |
style |
a CSL style (for text format only). See ‘rcrossref::get_styles()’ for options. Default: 'apa'. If there's a style that DataCite doesn't support you'll get a (500) Internal Server Error |
locale |
Language locale. See ‘?Sys.getlocale’ |
... |
curl options passed on to crul::verb-GET |
https://support.datacite.org/docs/datacite-content-resolver
see also rcrossref::cr_cn
for a more general purpose
content negotation interface
## Not run: dc_cn("10.5281/zenodo.50213") dc_cn(c("10.5281/zenodo.50213", "10.5281/zenodo.57081"), "text") dc_cn(c("a-bad-doi", "10.5281/zenodo.50213", "10.5281/zenodo.57081"), "text") ## End(Not run)
## Not run: dc_cn("10.5281/zenodo.50213") dc_cn(c("10.5281/zenodo.50213", "10.5281/zenodo.57081"), "text") dc_cn(c("a-bad-doi", "10.5281/zenodo.50213", "10.5281/zenodo.57081"), "text") ## End(Not run)
DataCite REST API: dois
dc_dois( ids = NULL, query = NULL, created = NULL, registered = NULL, provider_id = NULL, client_id = NULL, person_id = NULL, resource_type_id = NULL, subject = NULL, schema_version = NULL, random = NULL, sample_size = NULL, sample_group = NULL, include = NULL, sort = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_dois( ids = NULL, query = NULL, created = NULL, registered = NULL, provider_id = NULL, client_id = NULL, person_id = NULL, resource_type_id = NULL, subject = NULL, schema_version = NULL, random = NULL, sample_size = NULL, sample_group = NULL, include = NULL, sort = NULL, limit = 25, page = 1, cursor = NULL, ... )
ids |
(character) one or more DOIs |
query |
(character) Query string. See Querying below. |
created |
(character) metadata where year of DOI creation is |
registered |
(character) metadata where year of DOI registration
is |
provider_id |
(character) metadata associated with a specific DataCite provider. See Filtering Responses below. |
client_id |
(character) metadata associated with a specific DataCite client. See Filtering Responses below. |
person_id |
(character) metadata associated with a specific person's ORCID iD. See Filtering Responses below. |
resource_type_id |
(character) metadata for a specific resourceTypeGeneral. See Filtering Responses below. |
subject |
(character) |
schema_version |
(character) metadata where schema version of the
deposited metadata is |
random |
(logical) return random set of results, can be combined
with any kind of query. default: |
sample_size |
(character) |
sample_group |
(character) |
include |
(character) vector of fields to return |
sort |
(character) variable to sort by |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) the page to get results for. default: 1 |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::verb-GET |
See https://support.datacite.org/docs/api-queries for details
See https://support.datacite.org/docs/api-queries#section-filtering-list-responses for details
## Not run: if (dc_check()) { x <- dc_dois() x dc_dois(query = "birds") dc_dois(query = "climate change") dc_dois(query = "publicationYear:2016") x <- dc_dois(query = "creators.familyName:mil*", verbose = TRUE) lapply(x$data$attributes$creators, "[[", "familyName") x <- dc_dois(query = "titles.title:climate +change") lapply(x$data$attributes$titles, "[[", "title") dc_dois(client_id = "dryad.dryad") dc_dois(x$data$id[1]) dc_dois(x$data$id[1:3]) dc_dois("10.5281/zenodo.1308060") # pagination dc_dois(limit = 1) x <- dc_dois(cursor = 1) x$links$`next` } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_dois() x dc_dois(query = "birds") dc_dois(query = "climate change") dc_dois(query = "publicationYear:2016") x <- dc_dois(query = "creators.familyName:mil*", verbose = TRUE) lapply(x$data$attributes$creators, "[[", "familyName") x <- dc_dois(query = "titles.title:climate +change") lapply(x$data$attributes$titles, "[[", "title") dc_dois(client_id = "dryad.dryad") dc_dois(x$data$id[1]) dc_dois(x$data$id[1:3]) dc_dois("10.5281/zenodo.1308060") # pagination dc_dois(limit = 1) x <- dc_dois(cursor = 1) x$links$`next` } ## End(Not run)
DataCite REST API: events
dc_events( ids = NULL, query = NULL, subj_id = NULL, obj_id = NULL, doi = NULL, orcid = NULL, prefix = NULL, subtype = NULL, subject = NULL, source_id = NULL, registrant_id = NULL, relation_type_id = NULL, issn = NULL, publication_year = NULL, year_month = NULL, include = NULL, sort = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_events( ids = NULL, query = NULL, subj_id = NULL, obj_id = NULL, doi = NULL, orcid = NULL, prefix = NULL, subtype = NULL, subject = NULL, source_id = NULL, registrant_id = NULL, relation_type_id = NULL, issn = NULL, publication_year = NULL, year_month = NULL, include = NULL, sort = NULL, limit = 25, page = 1, cursor = NULL, ... )
ids |
(character) one or more event IDs |
query |
(character) Query for any event information |
subj_id |
(character) The identifier for the event subject, expressed
as a URL. For example: |
obj_id |
(character) The identifier for the event object, expressed
as a URL. For example: |
doi |
(character) The subj-id or obj-id of the event, expressed as
a DOI. For example: |
orcid |
(character) an ORCID, presumably |
prefix |
(character) The DOI prefix of the subj-id or obj-id of the
event. For example: |
subtype |
(character) xxx |
subject |
(character) xxx |
source_id |
(character) a source ID. See Details |
registrant_id |
(character) |
relation_type_id |
(character) a relation-type ID. See Details |
issn |
(character) an ISSN, presumably |
publication_year |
(character) the publication year |
year_month |
(character) The year and month in which the event
occurred, in the format |
include |
(character) vector of fields to return |
sort |
(character) variable to sort by |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) the page to get results for. default: 1 |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::verb-GET |
See https://support.datacite.org/docs/eventdata-guide for details on possible values for parameters
## Not run: if (dc_check()) { # dc_events(query = "birds") } ## End(Not run)
## Not run: if (dc_check()) { # dc_events(query = "birds") } ## End(Not run)
DataCite REST API: prefixes
dc_prefixes(include = NULL, limit = 25, page = 1, cursor = NULL, ...)
dc_prefixes(include = NULL, limit = 25, page = 1, cursor = NULL, ...)
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) result page, the record to start at |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::HttpClient |
## Not run: if (dc_check()) { x <- dc_prefixes() x dc_prefixes(limit = 3) } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_prefixes() x dc_prefixes(limit = 3) } ## End(Not run)
DataCite REST API: provider prefixes
dc_provider_prefixes(include = NULL, limit = 25, page = 1, cursor = NULL, ...)
dc_provider_prefixes(include = NULL, limit = 25, page = 1, cursor = NULL, ...)
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) result page, the record to start at |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::HttpClient |
## Not run: if (dc_check()) { x <- dc_provider_prefixes() x dc_provider_prefixes(limit = 3) } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_provider_prefixes() x dc_provider_prefixes(limit = 3) } ## End(Not run)
DataCite REST API: providers
dc_providers( ids = NULL, query = NULL, year = NULL, region = NULL, organization_type = NULL, focus_area = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
dc_providers( ids = NULL, query = NULL, year = NULL, region = NULL, organization_type = NULL, focus_area = NULL, include = NULL, limit = 25, page = 1, cursor = NULL, ... )
ids |
(character) one or more provider IDs |
query |
(character) query string |
year |
(character) year |
region |
(character) region name |
organization_type |
(character) organization type |
focus_area |
(character) focus area |
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) result page, the record to start at |
cursor |
(character) page cursor (used instead of |
... |
curl options passed on to crul::HttpClient |
## Not run: if (dc_check()) { x <- dc_providers() x dc_providers(limit = 3) dc_providers(ids = x$data$id[1:5]) } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_providers() x dc_providers(limit = 3) dc_providers(ids = x$data$id[1:5]) } ## End(Not run)
DataCite REST API: reports
dc_reports( ids = NULL, platform = NULL, report_name = NULL, report_id = NULL, release = NULL, created = NULL, created_by = NULL, include = NULL, limit = 25, page = 1, ... )
dc_reports( ids = NULL, platform = NULL, report_name = NULL, report_id = NULL, release = NULL, created = NULL, created_by = NULL, include = NULL, limit = 25, page = 1, ... )
ids |
(character) one or more report IDs |
platform |
(character) Name of the Platform the usage is being requested for. This can be omitted if the service provides usage for only one platform. |
report_name |
(character) The long name of the report |
report_id |
(character) The report ID or code or shortname. Typically this will be the same code provided in the Report parameter of the request |
release |
(character) The release or version of the report |
created |
(character) Time the report was prepared. Format as defined by date-time - RFC3339 |
created_by |
(character) Name of the organization producing the report |
include |
(character) vector of fields to return |
limit |
(numeric/integer) results per page |
page |
(numeric/integer) result page, the record to start at |
... |
curl options passed on to crul::HttpClient |
## Not run: if (dc_check()) { x <- dc_reports() x dc_reports(created = "2019-08-01T07:00:00.000Z") dc_reports(created_by = "urn:node:GOA") dc_reports(limit = 3) # dc_reports(ids = x$reports$id[1:3]) # FIXME: doesn't work } ## End(Not run)
## Not run: if (dc_check()) { x <- dc_reports() x dc_reports(created = "2019-08-01T07:00:00.000Z") dc_reports(created_by = "urn:node:GOA") dc_reports(limit = 3) # dc_reports(ids = x$reports$id[1:3]) # FIXME: doesn't work } ## End(Not run)
DataCite REST API: status of the API
dc_status(...)
dc_status(...)
... |
curl options passed on to crul::HttpClient |
## Not run: if (dc_check()) { dc_status() } ## End(Not run)
## Not run: if (dc_check()) { dc_status() } ## End(Not run)