cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

Sharing link doesn't link to the recently updated version of the file

Sharing link doesn't link to the recently updated version of the file

Lak1
New member | Level 2

I have noticed this issue(The sharing links are not getting updated whenever a change is made to a file. The sharing URL still shows the initial file.) in 2 places.

1) In the dropbox in node from the node-red-node-dropbox module in Node-RED. This node should constantly watch a Dropbox folder for changes and it should emit messages when any changes occur. This doesn't work.
2) Say I'm uploading a file called image.jpg to dropbox and when I'm downloading the same file using the URL https://www.dropbox.com/s/xxxxxxx/image.jpg?raw=1 after another update to that file, the changed or updated version of the image is not being downloaded.

Any help is appreciated!

3 Replies 3

Здравко
Legendary | Level 20

Hi @Lak1,

Are you really trying access updated version of the same file or new file using the same name?! The question is rhetoric of course. What I mean... If you update existing file in the most simple way (last depends on your actions, as on software you use - sometimes editing programs are guilty) then new version of the same file (here same file means same file id) is created. If you replace existing file with new one (emphasize on replace, not just update), then the new file version isn't related to the old file (again, here old file mean old id), but to new file! Some programs replace your files whenever save gets performed, without warning behind you, so you have to be careful what you use. Shared links get stick to the file ids, not file names! That's where your problem comes from, most probably. :wink: Try to change your work in a way, that files don't gonna removed in any one moment, or new links have to be created every time.

Hope this gives an idea.

ADD: A workaround could be share a containing folder instead file, if this works for you.

Greg-DB
Dropbox Staff

@Lak1 We can't offer help with the "node-red-node-dropbox" module as that's made by a third party, but we'll be happy to help with the Dropbox functionality itself.

I just gave this a try myself and it is working correctly for me. Here's some API commands and output showing:

  • uploading a file
  • creating a shared link for the file
  • accessing the shared link with raw=1 and getting the file contents
  • updating the file with different contents
  • accessing the same shared link with raw=1 again and getting the updated file contents

 

curl -X POST https://content.dropboxapi.com/2/files/upload \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Arg: {\"path\": \"/test_396449.txt\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary "test data version 1"

# {
#   "name": "test_396449.txt",
#   "path_lower": "/test_396449.txt",
#   "path_display": "/test_396449.txt",
#   "id": "id:25N5ksooX-sAAAAAAAOQzw",
#   "client_modified": "2020-02-12T16:17:02Z",
#   "server_modified": "2020-02-12T16:17:02Z",
#   "rev": "59e634d829303021eccc7",
#   "size": 19,
#   "is_downloadable": true,
#   "content_hash": "8aff3fe845b4e724436b87f745efd608286b5bc6d7c94317dbe324cf1445824a"
# }

curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"/test_396449.txt\"}"

# {
#   ".tag": "file",
#   "url": "https://www.dropbox.com/s/wet7bqdjwwor8sl/test_396449.txt?dl=0",
#   "id": "id:25N5ksooX-sAAAAAAAOQzw",
#   "name": "test_396449.txt",
#   "path_lower": "/test_396449.txt",
# <redacted for brevity>
#   "client_modified": "2020-02-12T16:17:02Z",
#   "server_modified": "2020-02-12T16:17:02Z",
#   "rev": "59e634d829303021eccc7",
#   "size": 19
# }


curl -L "https://www.dropbox.com/s/wet7bqdjwwor8sl/test_396449.txt?raw=1"

# test data version 1

curl -X POST https://content.dropboxapi.com/2/files/upload \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Arg: {\"path\": \"/test_396449.txt\",\"mode\": \"overwrite\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary "test data version 2"

# {
#   "name": "test_396449.txt",
#   "path_lower": "/test_396449.txt",
#   "path_display": "/test_396449.txt",
#   "id": "id:25N5ksooX-sAAAAAAAOQzw",
#   "client_modified": "2020-02-12T16:17:49Z",
#   "server_modified": "2020-02-12T16:17:49Z",
#   "rev": "59e63504c98d3021eccc7",
#   "size": 19,
#   "is_downloadable": true,
#   "content_hash": "f6e2c4101df704af41746f4e31737aba964882bcac17983f1d969b56fef39fa2"
# }


curl -L "https://www.dropbox.com/s/wet7bqdjwwor8sl/test_396449.txt?raw=1"

# test data version 2

As Ð—дравко mentioned, make sure you're updating and accessing the same file each time.

If something still isn't working as expected, please share the steps to reproduce the issue and the unexpected output you're getting so we can look into it for you.

 

Lak1
New member | Level 2

Actually, the problem was in the dropbox out node in node-red. I was using it to send image files to dropbox. The node has not been updated to the latest version of Dropbox API. It was still using the overwrite method and because of that, I might have had this issue. 

Anyway, thanks a lot, Ð—дравко and Greg K. 

I really appreciate your replies. Your answers gave me new insights. Never thought there will be something called file ID which is different from the file name.

I'll use the API endpoints to send my data.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Lak1 New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?