r-lib / httr

httr: a friendly http package for R
https://httr.r-lib.org
Other
986 stars 1.99k forks source link

modify_url() cannot handle API versioning #744

Closed cole-johanson closed 10 months ago

cole-johanson commented 1 year ago

Does modify_url() need a version argument? The use of modify_url() is considered best practice per the API Best Practices vignette. However, it does not seem to be able to handle a version in its url argument.

If I am missing something, perhaps this issue could be used for better modify_url documentation. Thanks!

# The intent: This strips the versioning
url = httr::modify_url("https://api.smartsheet.com/2.0/", path = paste0("sheets"))
url
#> [1] "https://api.smartsheet.com/sheets"

# The workaround
url = httr::modify_url("https://api.smartsheet.com/", path = paste0('2.0/',"sheets"))
url
#> [1] "https://api.smartsheet.com/2.0/sheets"

Created on 2023-08-09 with reprex v2.0.2

hadley commented 10 months ago

httr has been superseded in favour of httr2, so is no longer under active development. If this problem is still important to your in httr2, I'd suggest filing an issue offer there 😄