Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I'm trying to get a share link using the API. I have a problem when I try to get a link to a file with a rev number. For example, myfile (5).txt
In these cases the numbers were added by your system during a PUT because I have it set up to not overwrite. Any advice about how to get these revised files?
I am saving the file to Dropbox and using the returned URL from the original post to get it again. I get a "malformed url" error.
This is likely some kind of encoding error (e.g. not encoding the space or the parentheses right).
Could you share your code? What platform are you on? Are you using an SDK?
I'm using Corona SDK. They have a function network.request. I have used this to GET a file with that name without a problem but this post is not working. In both cases I am sending the request in raw, I'm not substituting + for space or anything.
Do I need to encode a parenthesis or can I just send it?
I will post some code tomorrow. My computer is at my office. I discovered the problem shortly before going home and am sitting on the couch obsessing.
Ok, here is some code:
coFunct = coroutine.create(function()
if authString == " then
connect()
end
local url = "https://api.dropbox.com/1/shares/auto/" .. path
url = html.escapeURl(url)
url = url .. "?short_url=false"
print("url: ", url)
local params = {}
local headers = {}
headers.Authorization = "OAuth " .. string.gsub(authString, "&", ",")
params.headers = headers
network.request(url, "POST", getFileListener(listener), params)
end
The url I am sending is: https://api.dropbox.com/1/shares/auto/char_sk_shared/WODVTMTempla+%283%29.skchar?short_url=false
I also have tried: https://api.dropbox.com/1/shares/auto/char_sk_shared/WODVTMTempla+(3).skchar?short_url=false
I'm sure the file is there, as part of my share function I put the file in a sub folder of the sandbox called /shared/ and then attempt to share it. This has worked consistently when I'm not trying to access a file with " (n)" at the end.
One more thing, I don't get the malformed error if I change the space to a +. However, the response from the function above is a response.url = nil
Ok, I figured it out. For posterity, your system will not accept + in place of " " in a file name, you need to hex the space.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!