doApiQuery | R Documentation |
The function doQueryApi
is called by all the function querying the API
endpoints and return the raw data sent by the endpoint.
doApiQuery(api, endpoint, ..., params)
api |
a character name of the API (e.g.: "indicateurs_services", "prelevements"...), see example for available APIs |
endpoint |
a character name of the endpoint, see example for available endpoints in an API |
... |
parameters of the queries and their values in the format
|
params |
(deprecated) a list the list of parameters of the queries and their
values in the format |
Pagination of the queries is handled automatically and the returned list is the concatenation of all the results sent by the API.
The functions get_[api]_[endpoint]
call the function doQueryApi
and parse the response in a tibble::tibble format for the user (See convert_list_to_tibble).
By default the user agent used for the query is "https://github.com/inrae/hubeau".
You can redefined the user agent with the global option
"hubeau.user_agent": options(hubeau.user_agent = "My user agent")
.
A list with the concatenated results returned by the API.
# To get the available APIs in the package
list_apis()
# To get the available endpoints in an API
list_endpoints("prelevements")
# To get available parameters in endpoint "chroniques" of the API "prelevements"
list_params(api = "prelevements", endpoint = "chroniques")
# To query the endpoint "chroniques" of the API "prelevements"
# on all devices in the commune of Romilly-sur-Seine in 2018
## Not run:
resp <- doApiQuery(api = "prelevements",
endpoint = "chroniques",
code_commune_insee = "10323",
annee = "2018")
convert_list_to_tibble(resp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.