Skip to content

This function appends a list of query parameters to a base URL. It is a thin re-export of apifetch::parse_queries(). Names and values are URL-encoded; parameters whose value is NULL, NA or the empty string are dropped; a parameter with several values is repeated (a=1&a=2); and if url already has a query string, the new parameters are appended to it.

Usage

parse_queries(url, query_list)

Arguments

url

The base URL to which query parameters will be added.

query_list

A named list of query parameters to be added to the URL.

Value

The complete URL with the query parameters appended.

Examples

parse_queries("https://www.example.com", list(param1 = "value1", param2 = "value2"))
#> [1] "https://www.example.com?param1=value1&param2=value2"