gesistsa / rtoot

:mammoth: R package to interact with the mastodon API
https://gesistsa.github.io/rtoot/
Other
104 stars 14 forks source link

request: get_instance_restrictions() #117

Closed playmobilmeister closed 1 year ago

playmobilmeister commented 1 year ago

it would be great to have a function that gets information out the list of restricted servers (which ones are limited/suspended, public reason etc.).

schochastics commented 1 year ago

@playmobilmeister do you refer to this endpoint: https://docs.joinmastodon.org/methods/instance/#domain_blocks Havent found any other so far. I will add a wrapper for this endpoint

chainsawriot commented 1 year ago

34

schochastics commented 1 year ago

Appears to not work for most instances. I get a 404 which means that admins have blocked this endpoint, which I understand. I will still make a PR for completeness sake

chainsawriot commented 1 year ago

@schochastics I've tested it. Actually, the API doc is wrong. The correct path is "/api/v1/instance/domain_blocks" (the extra s).

Ref mastodon/documentation#1070

chainsawriot commented 1 year ago
path <- "/api/v1/instance/domain_blocks"
rtoot:::make_get_request(token = NULL, path = path, instance = "emacs.ch", params = list())
#> [[1]]
#> [[1]]$domain
#> [1] "<CENSORED>"
#> 
#> [[1]]$digest
#> [1] "8a6c5f9ea165f8d3d2f73f35bd420f09454829f8cd7f8c250a348c175badc817"
#> 
#> [[1]]$severity
#> [1] "silence"
#> 
#> [[1]]$comment
#> NULL
#> 
#> 
#> [[2]]
#> [[2]]$domain
#> [1] "<CENSORED>"
#> 
#> [[2]]$digest
#> [1] "89c94761ec464308651a26c6a0f1af920c9047ba316470ee8f9888a7e332dc8c"
#> 
#> [[2]]$severity
#> [1] "silence"
#> 
#> [[2]]$comment
#> NULL
#> 
#> 
#> attr(,"headers")
#> # A tibble: 1 × 3
#>   rate_limit rate_remaining rate_reset         
#>   <chr>      <chr>          <dttm>             
#> 1 300        299            2022-11-29 12:25:00

Created on 2022-11-29 by the reprex package (v2.0.1)

schochastics commented 1 year ago

ah thanks!

playmobilmeister commented 1 year ago

wow thanks. so fast !