wikipedia_rest_apis {wikkitidy} | R Documentation |
Build a REST request to one of Wikipedia's specific REST APIs
Description
core_request_request()
builds a request for the MediaWiki Core REST API, the basic REST
API available on all MediaWiki wikis.
wikimedia_rest_request()
builds a request for the Wikimedia REST API, an additional
api just for Wikipedia and other wikis managed by the Wikimedia
Foundation
Usage
core_rest_request(..., language = "en")
wikimedia_rest_request(..., language = "en")
Arguments
... |
< |
language |
The two-letter language code for the Wikipedia edition |
Value
A core/rest
, wikimedia/rest
, object, an S3 vector that subclasses
httr2_request
(see httr2::request). The request needs to be passed to
httr2::req_perform to retrieve data from the API.
Examples
# Get the html of the 'Earth' article on English Wikipedia
response <- core_rest_request("page", "Earth", "html") %>%
httr2::req_perform()
response <- wikimedia_rest_request("page", "html", "Earth") %>%
httr2::req_perform()
# Some REST requests take query parameters. Pass these as named arguments.
# To search German Wikipedia for articles about Goethe
response <- core_rest_request("search/page", q = "Goethe", limit = 2, language = "de") %>%
httr2::req_perform() %>%
httr2::resp_body_json()
[Package wikkitidy version 0.1.12 Index]