cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

get shared Link of Uploaded Folder

get shared Link of Uploaded Folder

jimb0p
New member | Level 2
Go to solution

Hi,

 

I can upload my files with:

 

	public void uploadFileToDropbox(File inputFile, String path, String fileName) throws Exception{
		InputStream inputStream = new FileInputStream(inputFile);
		try {
		    FileMetadata uploadedFile = client.files().uploadBuilder("/"+path+"/"+fileName).uploadAndFinish(inputStream);
		    System.out.println("Uploaded to Dropbox: " + uploadedFile.getName());
		} finally {
		    inputStream.close();
		}
	}

How can I get the URL of the folder? I tried this:

 

	public String getShareLink(String path) throws DbxException{
		SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings(path);
		return(slm.getUrl());
	}

But I always get:

 

java.lang.IllegalArgumentException: String 'path' does not match pattern
1 Accepted Solution

Accepted Solutions

jimb0p
New member | Level 2
Go to solution

Changed the URL Line like that:

 

SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path);

View solution in original post

2 Replies 2

jimb0p
New member | Level 2
Go to solution

Changed the URL Line like that:

 

SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path);

Greg-DB
Dropbox Staff
Go to solution
I'm glad to hear you already sorted this out. That's correct, non-root file paths need a leading '/'.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    jimb0p New member | Level 2
What do Dropbox user levels mean?