ropensci / rdatacite

Wrapper to DataCite metadata
https://docs.ropensci.org/rdatacite
Other
25 stars 3 forks source link

Refractor to use DataCite REST API #24

Closed kjgarza closed 4 years ago

kjgarza commented 5 years ago

The endpoint "https://search.datacite.org/api" is going to be deprecated in early 2019.

https://github.com/ropensci/rdatacite/blob/c525d6d28efb37f6c24595208815ec297643e0e5/R/dc_search.R#L9

rdatacite should be using any of the other api.datacite.org endpoints. https://support.datacite.org/v1.2/reference

sckott commented 5 years ago

thanks much @kjgarza

will do

sckott commented 5 years ago

@kjgarza what is the equivalent in the new setup to the old Solr service?

sckott commented 5 years ago

@kjgarza any thoughts?

mfenner commented 5 years ago

We will soon retire Solr, having replaced it with Elasticsearch. The way to interact with Elasticsearch is via the JSON REST API, which we have updated in January to support queries as well as DOI registrations. Documentation is at https://support.datacite.org/docs/api.

We would be happy to help refactoring rdatacite to work with the new API. One cool new functionality would be DOI registrations, but the users for this would be repository managers not researchers.

sckott commented 5 years ago

Thanks Martin.

One cool new functionality would be DOI registrations, but the users for this would be repository managers not researchers.

Would these people use R to do this? If so I can implement it, but if not, then maybe doesn't make sense here

mfenner commented 5 years ago

I would have liked to have that functionality about 6 months ago, when I registered about 60k DOIs using R. I decided to make it a two-step process with an intermediary JSON-LD file with all the metadata in schema.org format generated by R, and then a command lines script in ruby.

I guess this functionality can wait for later.

sckott commented 5 years ago

Okay, sounds good

sckott commented 5 years ago

putting off to next milestone.

@mfenner what is the base url for API v2? In the docs it just has https://api.test.datacite.org - maybe you could put what the base url is in the docs?

katrinleinweber commented 4 years ago

Omitting .test seems to work: https://api.datacite.org/dois/10.5438/0012

mfenner commented 4 years ago

The base URL is api.datacite.org, api.test.datacite.org is used for testing and you can‘t rely on specific DOIs being available. I suggest I give rOpenSci a Test account for proper testing of the package.

Best,

Martin

Katrin Leinweber notifications@github.com schrieb am Mo. 21. Okt. 2019 um 11:04:

Omitting .test seems to work: https://api.datacite.org/dois/10.5438/0012

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/rdatacite/issues/24?email_source=notifications&email_token=AAAFU32REZVNUGEWN7CTJYTQPVO7VA5CNFSM4GM7YHLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBZNV2A#issuecomment-544398056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFU3YHJOHM4MPFNNTZSULQPVO7VANCNFSM4GM7YHLA .

-- Martin Fenner DataCite Technical Director http://orcid.org/0000-0003-1419-2405

sckott commented 4 years ago

sounds good to me, thanks

sckott commented 4 years ago

to further clarify, i know Solr is going away, replaced with Elasticsearch. Is there still search capability? it looks like the /dois route has a query parameter. I don't see any docs for what that accepts. is it just simple search, or does it support Dismax like search?

mfenner commented 4 years ago

The query syntax with Elasticsearch is slightly different, but also very powerful, see https://support.datacite.org/docs/datacite-search-user-documentation and https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax.

sckott commented 4 years ago

thanks, makes sense that query string is supported and not the ES body queries

sckott commented 4 years ago

@mfenner some errors, any thoughts?

sckott commented 4 years ago

@katrinleinweber re-worked the pkg, can install at remotes::install_github("ropensci/rdatacite@refactor") - OAI fxns are gone, and works/members/data centers fxns are gone. let me know any feedback soon - i have to submit a new version early next week

katrinleinweber commented 4 years ago

Thanks for adapting this package to the new API :-) I can't promise to test-run my analysis with the new version that quickly, because I'll have to migrate away from dc_works() first.

  • /dois
    • api.datacite.org/dois/10.7966%2F9h05-8h60 returns a 404 error, no DOIs seem to work with this route

https://doi.org/10.7966%2F9h05-8h60 returns "DOI Prefix [10.7966] Not Found", so that seems to the reason for the 404.

Other DOIs work fine for me: https://api.datacite.org/dois/10.5281/zenodo.1308060, https://api.datacite.org/dois/10.13140/rg.2.2.18135.01449

sckott commented 4 years ago

thanks @katrinleinweber for the clarification on /dois

sckott commented 4 years ago

done in #29

kjgarza commented 4 years ago
  • /events - whereas I think most routes in the meta slot have totalPages, this route has total-pages

To get camelCase response one needs to call the V2 of the API. Just need to change the header to accept: application/vnd.api+json; version=2

sckott commented 4 years ago

@kjgarza thanks, ill try that

sckott commented 4 years ago

@kjgarza that does work for /events, but just noticed that it doesn't seem to influence the /reports route

curl https://api.datacite.org/reports | jq '.meta | keys'
[
  "page",
  "total",
  "total-pages"
]

curl -H 'Accept: application/vnd.api+json; version=2' https://api.datacite.org/reports | jq '.meta | keys'
[
  "page",
  "total",
  "total-pages"
]

curl -H 'Accept: application/vnd.api+json' https://api.datacite.org/reports | jq '.meta | keys'
[
  "page",
  "total",
  "total-pages"
]