This question is related to the my previous question reading raw data in R to be saved as .RData file using the dropbox api
I am running into problems when my path includes non-url standard characters
the db.file.name in the previous question is just the path to the relevant file in dropbox.
however the path has a space in it along with exclamation marks. I have a feeling that these need to be converted to a relevant format so that the GET request can work...but not too sure what the conversion is....
so using and continuing from my previous example...
require(httr)
require(RCurl)
db.file.name <- "!! TEST FOLDER/test.RData"
db.app <- oauth_app("db",key="xxxxx", secret="xxxxxxx")
db.sig <- sign_oauth1.0(db.app, token="xxxxxxx", token_secret="xxxxxx")
response <- GET(url=paste0("https://api-content.dropbox.com/1/files/dropbox/",curlEscape(db.file.name)),config=c(db.sig,add_headers(Accept="x-dropbox-metadata")))
The response is an error, and no file is downloaded...using the documentation page https://www.dropbox.com/developers/reference/api it suggests putting the URL into a UTF-8 encoding...which I'm not sure how to do/not sure it works.
Any help would be greatly appreciated.
I was close before...I just needed to re-insert the slashes using gsub
in order for the GET request to work... so the result was
response <- GET(url=paste0("https://api-content.dropbox.com/1/files/dropbox/",gsub("%2F","/",curlEscape(db.file.name))),config=c(db.sig,add_headers(Accept="x-dropbox-metadata")))