osm_get_user_blocks: Read user block

View source: R/osm_get_user_blocks.R

osm_get_user_blocksR Documentation

Read user block

Description

Read user block

Usage

osm_get_user_blocks(user_block_id, format = c("R", "xml", "json"))

Arguments

user_block_id

The id of the user block to retrieve represented by a numeric or a character value.

format

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

Value

If format = "R", returns a data frame with one row with the details of the block.

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>

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"},
      "revoker":{"uid":115,"user":"fakemod2"},
      "reason":"reason text\r\n\r\nmore reason text"
    },
    {
      "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"},
      "revoker":{"uid":115,"user":"fakemod2"},
      "reason":"reason text\r\n\r\nmore reason text"
    },
    ...
  ]
}

See Also

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

Examples

osm_get_user_blocks(1:2)

osmapiR documentation built on April 15, 2025, 9:06 a.m.