ropenscilabs / deposits

R Client for access to multiple data repository services
https://docs.ropensci.org/deposits/
Other
37 stars 3 forks source link

New Zenodo API? #92

Closed rkrug closed 9 months ago

rkrug commented 9 months ago

Does deposits support the new Zenodo API? When I try to deposit something on the sandbox I get the following error (valid API key - checked with curl):

r$> cli
<deposits client>
 deposits service : zenodo
           sandbox: TRUE
         url_base : https://sandbox.zenodo.org/api/
 Current deposits : <none>

   hostdata : <none>
   metadata : 8 terms (see 'metadata' element for details)

r$> cli$deposit_new ()
Error in `httr2::req_perform()`:
! HTTP 400 Bad Request.
Run `rlang::last_trace()` to see where the error occurred.

r$> rlang::last_trace(drop = FALSE)
<error/httr2_http_400>
Error in `httr2::req_perform()`:
! HTTP 400 Bad Request.
---
Backtrace:
    ▆
 1. └─cli$deposit_new()
 2.   └─httr2::req_perform(req)
 3.     └─httr2:::handle_resp(req, resp, error_call = error_call)
 4.       └─httr2:::resp_abort(resp, req, body, call = error_call)
 5.         └─rlang::abort(...)

r$>

If yes, I am happy to provide more details.

mpadge commented 9 months ago

Ha, yeah, right, i can also repeat that. This is not good!! Thanks for reporting, and that is one that I'll get onto straight away

mpadge commented 9 months ago

Thanks @rkrug, that was a fairly minor API change that was easy to update. A bigger issue now seems to be that the Zenodo sandbox no longer lists any deposits, neither directly on website or accessible from the API. That kind of destroys ability to play around with deposits using the sandbox. The URLs for newly-created sandbox deposits work as expected, but nothing appears on the "dashboard," or via cli$deposits_list(). Are you seeing the same?

rkrug commented 9 months ago

Thanks @mpadge. Very much appreciated.

I just made a test deposit on my sandbocx account, logged out, logged in again and saw it under my deposits as well as could find it when searching for my name (Rainer - see screenshot)

It is also on the dashboard (but I think it took a bit of time, if I remember correctly). All this on the website.

I tried it with the installed version, and updated from GitHub, and in both cases cli$deposits_list() returns nothing.

Screenshot 2023-12-05 at 16 19 10
rkrug commented 9 months ago
Screenshot 2023-12-05 at 16 24 38
rkrug commented 9 months ago

Actually - I now see the following:

r$> cli
<deposits client>
 deposits service : zenodo
           sandbox: TRUE
         url_base : https://sandbox.zenodo.org/api/
 Current deposits : 1 (see 'deposits' element for details)

   hostdata : <none>
   metadata : 8 terms (see 'metadata' element for details)

so it is working - but the curious thing is it does not seem to be showing web interface deposits via the API, nor API deposits via the web interface. Orr am I to impatient again?

mpadge commented 9 months ago

Very strange. I still see absolutely nothing at all either way. And the numbers have changed from what used to be a generally 7-digit field to only 4, suggesting they are now recycling those much quicker. That suggests to me that sandbox deposits no longer have the semi-permanence they once did, and in my case appear to have none at all.

rkrug commented 9 months ago

I can now see my deposit I made from the web interface:

r$> cli$deposits
                           created                         modified   id conceptrecid                 doi          conceptdoi                             doi_url
1 2023-12-05T15:15:42.841621+00:00 2023-12-05T15:15:43.143420+00:00 6137         6136 10.5072/zenodo.6137 10.5072/zenodo.6136 https://doi.org/10.5072/zenodo.6137
  metadata.title        metadata.doi metadata.publication_date metadata.access_right                    metadata.creators metadata.license metadata.imprint_publisher
1         Test 1 10.5072/zenodo.6137                2023-12-05                  open Krug, Rainer M, University of Zurich        cc-by-4.0                     Zenodo
  metadata.upload_type metadata.prereserve_doi.doi metadata.prereserve_doi.recid  title                                  links.self                              links.html
1              dataset         10.5281/zenodo.6137                          6137 Test 1 https://sandbox.zenodo.org/api/records/6137 https://sandbox.zenodo.org/records/6137
                            links.doi                                   links.parent_doi                                                    links.badge
1 https://doi.org/10.5072/zenodo.6137 https://sandbox.zenodo.org/doi/10.5072/zenodo.6136 https://sandbox.zenodo.org/badge/doi/10.5072%2Fzenodo.6137.svg
                                              links.conceptbadge                                       links.files                                      links.latest_draft
1 https://sandbox.zenodo.org/badge/doi/10.5072%2Fzenodo.6136.svg https://sandbox.zenodo.org/api/records/6137/files https://sandbox.zenodo.org/api/deposit/depositions/6137
                  links.latest_draft_html                                                           links.publish
1 https://sandbox.zenodo.org/deposit/6137 https://sandbox.zenodo.org/api/deposit/depositions/6137/actions/publish
                                                            links.edit                                                           links.discard
1 https://sandbox.zenodo.org/api/deposit/depositions/6137/actions/edit https://sandbox.zenodo.org/api/deposit/depositions/6137/actions/discard
                                                            links.newversion                                                           links.registerconceptdoi
1 https://sandbox.zenodo.org/api/deposit/depositions/6137/actions/newversion https://sandbox.zenodo.org/api/deposit/depositions/6137/actions/registerconceptdoi
                                 links.record                      links.record_html                                                links.latest
1 https://sandbox.zenodo.org/api/records/6137 https://sandbox.zenodo.org/record/6137 https://sandbox.zenodo.org/api/records/6137/versions/latest
                                       links.latest_html record_id owner
1 https://sandbox.zenodo.org/record/6137/versions/latest      6137   552
                                                                                                                                                                                                                                                                                                                      files
1 0777ae90-490f-4c48-babf-df880ddc9068, leef.rrd.v1.8.5_final.density.sqlite.gz, 3994770, 988865e687ae02a8bf2f688b6b6eefb0, https://sandbox.zenodo.org/api/records/6137/files/0777ae90-490f-4c48-babf-df880ddc9068, https://sandbox.zenodo.org/api/records/6137/draft/files/leef.rrd.v1.8.5_final.density.sqlite.gz/content
  state submitted
1  done      TRUE
rkrug commented 9 months ago

I am also confused - I created a cli, populated the metadata, and want to upload a file:

r$> cli$deposit_upload_file('/Users/rainerkrug/Documents_Local/git/LEEF/additionalPackages/zenDep/inst/leef.rrd.v1.8.5_fin
    al.density.sqlite.gz')
Error in cli$deposit_upload_file("/Users/rainerkrug/Documents_Local/git/LEEF/additionalPackages/zenDep/inst/leef.rrd.v1.8.5_final.density.sqlite.gz") : 
  Assertion on 'deposit_id' failed: Must be of type 'single integerish value', not 'NULL'.

I was sure it worked before...

mpadge commented 9 months ago

Yeah, this is going to be a problem. The deposit_id value should be populated from the Zenodo sandbox data, but if that's all empty, there's no value to use. I'll address your other issues first, but feel free to open a new issue regarding that if it persists. Thanks

rkrug commented 9 months ago

Hm. I get the same error again:

r$> cli
<deposits client>
 deposits service : zenodo
           sandbox: FALSE
         url_base : https://zenodo.org/api/
 Current deposits : 28 (see 'deposits' element for details)

   hostdata : <none>
   metadata : 8 terms (see 'metadata' element for details)

r$> cli$deposit_new()
Error in `httr2::req_perform()`:
! HTTP 400 Bad Request.
Run `rlang::last_trace()` to see where the error occurred.

r$> packageVersion("deposits")
[1] ‘0.2.1.52’

r$>
rkrug commented 9 months ago

Also tried on the sandbox - same error.

rkrug commented 9 months ago

I am checking - your example works. I will report back.