Learn R Programming

osmapiR (version 0.2.3)

osm_list_active_user_blocks: List active blocks

Description

Allows to check if the currently authorized user is blocked.

Usage

osm_list_active_user_blocks(format = c("R", "xml", "json"))

Value

If format = "R", returns a data frame with one row per block. No rows, no blocks.

format = "xml"

Returns a xml2::xml_document with the following format:

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap server" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
  <user_block id="101" created_at="2025-02-22T02:11:55Z" updated_at="2025-02-22T02:11:55Z" ends_at="2025-02-22T03:11:55Z" needs_view="true">
    <user uid="5" user="fakemod1"/>
    <creator uid="115" user="fakemod2"/>
  </user_block>
  <user_block id="100" created_at="2025-02-22T02:11:10Z" updated_at="2025-02-22T02:11:10Z" ends_at="2025-02-22T02:11:10Z" needs_view="true">
    <user uid="5" user="fakemod1"/>
    <creator uid="115" user="fakemod2"/>
  </user_block>
  ...
</osm>

Empty <osm> element indicates no active blocks.

format = "json"

Returns a list with the following json structure:

{
  "version":"0.6","generator":"OpenStreetMap server","copyright":"OpenStreetMap and contributors","attribution":"http://www.openstreetmap.org/copyright","license":"http://opendatacommons.org/licenses/odbl/1-0/",
  "user_blocks":[
    {
      "id":101,
      "created_at":"2025-02-22T02:11:55Z",
      "updated_at":"2025-02-22T02:11:55Z",
      "ends_at":"2025-02-22T03:11:55Z",
      "needs_view":true,
      "user":{"uid":5,"user":"fakemod1"},
      "creator":{"uid":115,"user":"fakemod2"}
    },
    {
      "id":100,
      "created_at":"2025-02-22T02:11:10Z",
      "updated_at":"2025-02-22T02:11:10Z",
      "ends_at":"2025-02-22T02:11:10Z",
      "needs_view":true,
      "user":{"uid":5,"user":"fakemod1"},
      "creator":{"uid":115,"user":"fakemod2"}
    },
    ...
  ]
}

Arguments

format

Format of the output. Can be "R" (default), "xml", or "json".

Details

This endpoint is accessible even with an active block, unlike some other endpoints requiring authorization.

See Also

Other user blocks' functions: osm_create_user_block(), osm_get_user_blocks()

Examples

Run this code
if (FALSE) {
osm_list_active_user_blocks()
}

Run the code above in your browser using DataLab