ropensci / ckanr

R client for the CKAN API
https://docs.ropensci.org/ckanr
Other
99 stars 38 forks source link

Removal of revisions endpoints in CKAN 2.9 #189

Closed fjuniorr closed 1 year ago

fjuniorr commented 2 years ago

It looks like the endpoints revision_list and package_revision_list were removed in CKAN 2.9 (see the Changelog):

library(ckanr)

ckan2.8_url <- "https://data.ontario.ca/"
revision2.8 <- revision_list(url = ckan2.8_url)
package_revision2.8 <- package_revision_list("crown-timber-charges-for-forestry-companies", url = ckan2.8_url)

ckan2.9_url <- "https://dados.mg.gov.br/"
revision2.9 <- revision_list(url = ckan2.9_url)
#> Error: 400 - Bad Request
#>   "Requisi\u00e7\u00e3o incorreta - Action name not known: revision_list"
package_revision2.9 <- package_revision_list("diarias", url = ckan2.9_url)
#> Error: 400 - Bad Request
#>   "Requisi\u00e7\u00e3o incorreta - Action name not known: package_revision_list"

Created on 2022-10-31 with reprex v2.0.2

The activity_diff endpoint appears to be the new relevant endpoint, but I still couldn't understand it's usage.

Session Info and Traceback ```r R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 11.2.3 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ckanr_0.6.0.92 DBI_1.1.3 loaded via a namespace (and not attached): [1] Rcpp_1.0.9 urlchecker_1.0.1 pillar_1.8.1 compiler_4.2.1 later_1.3.0 dbplyr_2.2.1 [7] remotes_2.4.2 profvis_0.3.7 prettyunits_1.1.1 tools_4.2.1 pkgload_1.3.0 pkgbuild_1.3.1 [13] digest_0.6.29 jsonlite_1.8.1 memoise_2.0.1 lifecycle_1.0.2 tibble_3.1.8 pkgconfig_2.0.3 [19] rlang_1.0.6 shiny_1.7.2 cli_3.4.1 rstudioapi_0.14 crul_1.3 curl_4.3.2 [25] fastmap_1.1.0 stringr_1.4.1 dplyr_1.0.10 htmlwidgets_1.5.4 generics_0.1.3 vctrs_0.4.2 [31] fs_1.5.2 devtools_2.4.5 triebeard_0.3.0 tidyselect_1.1.2 glue_1.6.2 httpcode_0.3.0 [37] R6_2.5.1 processx_3.7.0 fansi_1.0.3 sessioninfo_1.2.2 callr_3.7.2 purrr_0.3.4 [43] magrittr_2.0.3 usethis_2.1.6 ps_1.7.1 promises_1.2.0.1 urltools_1.7.3 ellipsis_0.3.2 [49] htmltools_0.5.3 assertthat_0.2.1 xtable_1.8-4 mime_0.12 httpuv_1.6.6 utf8_1.2.2 [55] stringi_1.7.8 miniUI_0.1.1.1 cachem_1.0.6 crayon_1.5.2 ``` ```r traceback() 5: stop(sprintf("%s - %s\n %s", x$status_code, obj$err, obj$errmsg), call. = FALSE) 4: err_handler(res) 3: ckan_VERB("get", url, method, body = NULL, key, query, headers, opts, ...) 2: ckan_GET(url, "revision_list", key = key, opts = list(...)) 1: revision_list(url = ckan2.9_url) ``` ```r traceback() 5: stop(sprintf("%s - %s\n %s", x$status_code, obj$err, obj$errmsg), call. = FALSE) 4: err_handler(res) 3: ckan_VERB("get", url, method, body = NULL, key, query, headers, opts, ...) 2: ckan_GET(url, "package_revision_list", list(id = id), key = key, opts = list(...)) 1: package_revision_list("diarias", url = ckan2.9_url) ```
fjuniorr commented 1 year ago

Currently package_search is the only function which changes it's behaviour based on the CKAN version (I discovered this through https://github.com/ropensci/ckanr/issues/120).

Before fixing this issue, it's a good idea to use the strategy suggested in https://github.com/ropensci/ckanr/issues/72 of caching the CKAN version so that we don't need to make a request on multiple function calls to check the version.