title: get the sharedlink of an existing file in Dropbox using the dropBox-sdk-java
body: <p>I want to retrieve the shared file url of an existing file on Dropbox. I am using the dropbox-java-sdk, and I have managed to create a shared link for a file I just uploaded. The only way I managed to get the shared link of an existing file is by listing all links and get the one I want depending on the path, like so</p>
  <pre><code>public void getShareLink(String path) throws DbxApiException, DbxException{
          DbxRequestConfig config = new DbxRequestConfig(&quot;test/DbApi-sdk&quot;);
          DbxClientV2 client = new DbxClientV2(config, getToken(AuthorizationFile));
          
          try {
              ListSharedLinksResult sharedLinkMetadata = client.sharing().listSharedLinks();
              for (SharedLinkMetadata slm:    sharedLinkMetadata.getLinks()){
                  if(slm.getPathLower().equalsIgnoreCase(path)){
                       System.out.println(slm.getUrl());
                       return;
                  }
              }
          } catch (CreateSharedLinkWithSettingsErrorException ex) {
              System.out.println(ex);
          } catch (DbxException ex) {
              System.out.println(ex);
          }
          
      }
  </code></pre>
  <p>Isn’t there a way to directly get the url for the file I want? I just think it is a waste to iterate all items just to get one of them.</p>