cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Problem with API share link

Problem with API share link

Mark S.115
New member | Level 1

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.

5 Replies 5

Steve M.
Dropbox Staff

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?

Mark S.115
New member | Level 1

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.

Mark S.115
New member | Level 1

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.

Mark S.115
New member | Level 1

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

Mark S.115
New member | Level 1

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.

Need more support?