Skip to content

Commit 37e2e2e

Browse files
committed
allow sample urls in retrieve_linked_data
1 parent 07e175b commit 37e2e2e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/search-pv.R

+6-4
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ set_sort_param <- function(before) {
3838

3939
#' @noRd
4040
get_get_url <- function(query, base_url, arg_list) {
41-
j <- paste0(
41+
42+
j <- ifelse(is.null(arg_list), base_url, paste0(
4243
base_url,
4344
"?q=", utils::URLencode(query, reserved = TRUE),
4445
"&f=", tojson_2(arg_list$fields),
4546
"&s=", set_sort_param(arg_list$sort),
4647
"&o=", tojson_2(arg_list$opts, auto_unbox = TRUE)
47-
)
48+
))
4849

4950
utils::URLencode(j)
5051
}
@@ -403,7 +404,8 @@ retrieve_linked_data <- function(url,
403404
}
404405

405406
# Go through one_request, which handles resend on throttle errors
406-
# The API doesn't seem to mind ?q=&f=&o=&s= appended to HATEOAS URLs
407-
res <- one_request("GET", "", url, list(), api_key, ...)
407+
# The NULL arg_list supresses the ?q=&f=&o=&s= that was appended to the url
408+
# and lets example urls be passed
409+
res <- one_request("GET", "", url, NULL, api_key, ...)
408410
process_resp(res)
409411
}

0 commit comments

Comments
 (0)