Skip to contents

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).

Usage

query_list_pages(.req, list, ...)

list_all_list_modules()

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

Value

An HTTP response: an S3 list with class httr2_request

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.

See also

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  4640562     0 Solar core                                                   
#>  2 83885691     0 Zak phase                                                    
#>  3  1653925   100 Portal:Physics                                               
#>  4   925607    14 Category:Physics education                                   
#>  5 37358141    14 Category:Physics-related lists                               
#>  6   694942    14 Category:Physicists                                          
#>  7 70983414    14 Category:Physics by country                                  
#>  8  3450392    14 Category:Physical phenomena                                  
#>  9 81547742     0 Large Enriched Germanium Experiment for Neutrinoless BB Decay
#> 10  5103597     0 Jacchia Reference Atmosphere                                 
#> ℹ There are more results on the server. Retrieve them with `next_batch()` or `retrieve_all()`
#> ✔ Data complete for all records