See API:Lists for available
list actions. Each list action returns a list of pages, typically including
their pageid, namespace
and title. Individual lists have particular properties that can be requested,
which are usually prefaced with a two-word code based on the name of the
list (e.g. specific properties for the categorymembers
list action are
prefixed with cm
).
Arguments
- .req
A httr2_request, e.g. generated by
wiki_action_request
- list
The type of list to return
- ...
<
dynamic-dots
> Additional parameters to the query, e.g. to set configure list
Details
When the request is performed, the data is returned in the body of the
request under the query
object, labeled by the chosen list action.
If you want to study the actual pages listed, it is advisable to retrieve the pages directly using a generator, rather than listing their IDs using a list action. When using a list action, a second request is required to get further information about each page. Using a generator, you can query pages and retrieve their relevant properties in a single API call.
Examples
# Get the ten most recently added pages in Category:Physics
physics_pages <- wiki_action_request() %>%
query_list_pages("categorymembers",
cmsort = "timestamp",
cmdir = "desc", cmtitle = "Category:Physics"
) %>%
gracefully(next_batch)
physics_pages
#> <complete/query_tbl>
#> # A tibble: 10 × 3
#> pageid ns title
#> <int> <int> <chr>
#> 1 79026168 0 Wohlfarth Lectureship
#> 2 78751748 0 Missile lofting
#> 3 78554064 0 History of the LED
#> 4 168907 0 Naïve physics
#> 5 78147827 0 Electrostatic solitary wave
#> 6 78245824 0 Nottingham effect
#> 7 2137509 0 Perfect fluid
#> 8 78053369 0 Bijel
#> 9 1996857 0 Nucleation
#> 10 27481335 0 Plasmaron
#> ℹ There are more results on the server. Retrieve them with `next_batch()` or `retrieve_all()`
#> ✔ Data complete for all records