ropenscilabs / deposits

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

accessRights = "embargoed" causes 400 error #98

Open rkrug opened 9 months ago

rkrug commented 9 months ago

The following fails with HTTP error 400 - although "embargoed" is accepted.

When I change it to "open", which I do not want, it works.

library(deposits)

sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: x86_64-apple-darwin20 (64-bit)
#> Running under: macOS Sonoma 14.1.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Zurich
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] deposits_0.2.1.052
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.33     styler_1.10.2     R6_2.5.1          fastmap_1.1.1    
#>  [5] xfun_0.41         magrittr_2.0.3    glue_1.6.2        R.utils_2.12.2   
#>  [9] knitr_1.45        htmltools_0.5.7   rmarkdown_2.25    lifecycle_1.0.4  
#> [13] cli_3.6.2         R.methodsS3_1.8.2 vctrs_0.6.5       reprex_2.0.2     
#> [17] withr_2.5.2       compiler_4.3.2    rprojroot_2.0.4   here_1.0.1       
#> [21] R.oo_1.25.0       R.cache_0.16.0    purrr_1.0.2       tools_4.3.2      
#> [25] evaluate_0.23     yaml_2.3.7        rlang_1.1.2       fs_1.6.3

metadata <- list(
    title = "Some Ttest title",
    description = "Data sampled during the experiment",
    abstract = "The data from the experiment.",
    language = "eng",
    accessRights = "embargoed", 
    creator = list(
        list(
            name = "Rainer M. Krug",
            affiliation = "University of Zurich", orcid = "0000-0002-7490-0066"
        )
    ),
    contributor = list(
        list(
            name = "Rainer M. Krug",
            affiliation = "University of Zurich", orcid = "0000-0002-7490-0066",
            type = "DataManager"
        )
    )
)

metadata <- metadata[grep("^_", names(metadata), invert = TRUE)]

cli <- depositsClient$new(service = "zenodo", sandbox = TRUE)

cli$deposit_fill_metadata(metadata)

cli$deposit_new()
#> 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(...)

Created on 2023-12-12 with reprex v2.0.2