Skip to content

Commit 98776d6

Browse files
committed
allow sample urls in retrieve_linked_data
1 parent 9e09ab9 commit 98776d6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

R/search-pv.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ set_sort_param <- function(sort_vec) {
6262

6363
#' @noRd
6464
get_get_url <- function(query, base_url, arg_list) {
65-
j <- paste0(
65+
j <- ifelse(is.null(arg_list), base_url, paste0(
6666
base_url,
6767
"?q=", utils::URLencode(query, reserved = TRUE),
6868
"&f=", tojson_2(arg_list$fields),
6969
"&s=", set_sort_param(arg_list$sort),
7070
"&o=", tojson_2(arg_list$opts, auto_unbox = TRUE)
71-
)
71+
))
7272

7373
utils::URLencode(j)
7474
}
@@ -366,6 +366,9 @@ retrieve_linked_data <- function(url,
366366
if (is.null(url)) {
367367
stop2("URL must be a valid URL")
368368
}
369-
res <- one_request("GET", "", url, list(), api_key, ...)
369+
370+
# The NULL arg_list supresses the ?q=&f=&o=&s= that was appended to the url
371+
# and lets example urls be passed
372+
res <- one_request("GET", "", url, NULL, api_key, ...)
370373
process_resp(res)
371374
}

0 commit comments

Comments
 (0)