Forum Discussion

Walter Whitman Moore's avatar
Walter Whitman Moore
Explorer | Level 4
4 years ago

Filemaker Pro web viewer access to Dropbox via API and "insert from URL" command

I'm a trial lawyer rather than a programmer, so please forgive in advance my ignorance about programming; I don't know my Java from my Python from my cURL, but I generally figure out how to get things done.

I have made an app using FileMaker Pro, and I would like it to work with DropBox.

In particular, when a user highlights a record in FileMaker Pro, I would like FileMaker Pro's web viewer to display the document via a URL to DropBox.

I am able to do this if I get individual shareable links, file by file, but that is too slow.

So I've spent hours reading about and trying to implement the feature called /create_shared_link_with_settings.

I set up a DropBox app, and got the token, etc.

I get really, really close, but not quite success. The closest I've come is to get an error re "shared link already exists." (The exact message was, "{"error_summary": "shared_link_already_exists/..", "error": {".tag": "shared_link_already_exists"}}.")

I found an article on how to fix it, but it was over my head. (https://stackoverflow.com/questions/46514268/shared-link-already-exists-dropbox-api-v2)

Can someone out there please layout exactly what my Filemaker Pro "insert from URL" script should say for a given FILE NAME and a given FILE PATH? I'm so close, it's driving me crazy, and I figure it's super simple for someone out there.

Thanks in advance.

Cordially,

Walter Whitman Moore

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    I can't help with FileMaker Pro itself as that's not made by Dropbox, but I'll try to offer whatever guidance I can on the Dropbox side of things.

     

    If you want to create a shared link for any particular file or folder, calling /2/sharing/create_shared_link_with_settings is the correct way to do so. Note though that this only allows you to create a new shared link when one does not already exist. If there's already a shared link for the specified item, you will get that 'shared_link_already_exists' error. If/when you get that error, if you wish to just retrieve the existing shared link, you should then have your code call /2/sharing/list_shared_links. That would return any existing shared links.

     

    I can't write your code for FileMaker Pro for you, but the Dropbox API v2 Explorer may be helpful. That's an easy way to prototype and test calls against the Dropbox API, such as for /2/sharing/create_shared_link_with_settings and for /2/sharing/list_shared_links.

    • Walter Whitman Moore's avatar
      Walter Whitman Moore
      Explorer | Level 4

      Thanks for your reply. Could you at least tell me how, in Dropbox API language, to tell Dropbox that IF the link already exists, THEN apply this other command? For example, is it something like, "If tag = already 'exists' then /2/sharing/list_shared_links?

      If you could just give that one bit of DropBox API lingo, I think I could solve it from there.

      Thanks in advance. I really want to make this work. : )

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        There isn't a way to have the API itself automatically perform logic and additional calls for you like this. The /2/sharing/create_shared_link_with_settings and /2/sharing/list_shared_links routes are distinct endpoints on the Dropbox API, and each require their own request from the API client (i.e., the code calling the API, such as your FileMaker Pro code in this case). You'll need to write your code with whatever logic, calls, and processing are needed for your use case.

         

        It is worth noting that in some cases, the Dropbox API will return the information for the existing shared link in the 'shared_link_already_exists' error itself from the /2/sharing/create_shared_link_with_settings endpoint to begin with, but this isn't guaranteed to always be included, so you would still need to implement the code to call /2/sharing/list_shared_links anyway, for when it isn't.