DropboxAPI { public DropboxLink share(String path) throws DropboxException { assertAuthenticated(); String target = "/shares/" + session.getAccessType() + path; @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>)RESTUtility.request(RequestMethod.GET, session.getAPIServer(), target, VERSION, new String[] {"locale", session.getLocale().toString()}, session); String url = (String)map.get("url"); Date expires = RESTUtility.parseDate((String)map.get("expires")); if (url == null || expires == null) { throw new DropboxParseException("Could not parse share response."); } return new DropboxLink(map); } DropboxAPI(SESS_T session); ChunkedUploader getChunkedUploader(InputStream is); ChunkedUploader getChunkedUploader(InputStream is, long length); ChunkedUploader getChunkedUploader(InputStream is, long length, int chunkSize); ChunkedUploadRequest chunkedUploadRequest(InputStream is, long length,
                                                     ProgressListener listener,
                                                     long offset, String uploadId); SESS_T getSession(); Account accountInfo(); DropboxFileInfo getFile(String path, String rev, OutputStream os,
            ProgressListener listener); DropboxInputStream getFileStream(String path, String rev); Entry putFile(String path, InputStream is, long length,
            String parentRev, ProgressListener listener); Entry putFile(String path, InputStream is, long length,
            String parentRev, boolean autoRename, ProgressListener listener); UploadRequest putFileRequest(String path, InputStream is,
            long length, String parentRev, ProgressListener listener); UploadRequest putFileRequest(String path, InputStream is,
            long length, String parentRev, boolean autoRename, ProgressListener listener); Entry putFileOverwrite(String path, InputStream is, long length,
            ProgressListener listener); UploadRequest putFileOverwriteRequest(String path, InputStream is,
            long length, ProgressListener listener); DropboxFileInfo getThumbnail(String path, OutputStream os,
            ThumbSize size, ThumbFormat format, ProgressListener listener); DropboxInputStream getThumbnailStream(String path, ThumbSize size,
            ThumbFormat format); Entry metadata(String path, int fileLimit, String hash,
            boolean list, String rev); @SuppressWarnings("unchecked") List<Entry> revisions(String path, int revLimit); List<Entry> search(String path, String query, int fileLimit,
            boolean includeDeleted); Entry move(String fromPath, String toPath); Entry copy(String fromPath, String toPath); Entry createFolder(String path); void delete(String path); Entry restore(String path, String rev); DropboxLink media(String path, boolean ssl); DropboxLink share(String path); DeltaPage<Entry> delta(String cursor); CreatedCopyRef createCopyRef(String sourcePath); Entry addFromCopyRef(String sourceCopyRef, String targetPath); static final int VERSION; static final String SDK_VERSION; static final long MAX_UPLOAD_SIZE; }
@Test public void share() throws Exception{ String path = TESTS_DIR + "/dropbox_song.mp3"; uploadFile(song, path); DropboxLink link = api.share(path); assert link.url != null : "No url for streamed file"; }