code: public int uploadFile(String name, java.io.File file) {
  		FileDataBodyPart filePart = new FileDataBodyPart("source", file);
  		// Work around for bug in cherrypy
  		FormDataContentDisposition.FormDataContentDispositionBuilder builder = FormDataContentDisposition
  				.name(filePart.getName());
  		builder.fileName(file.getName());
  		builder.size(file.length());
  		filePart.setFormDataContentDisposition(builder.build());
  
  		FormDataMultiPart multiPart = new FormDataMultiPart();
  		multiPart.bodyPart(filePart);
  		multiPart.field("filename", name);
  
  		Builder resource = getResourceFactory().getApiResource("/file/v2/")
  				.entity(multiPart,
  						new MediaType("multipart", "form-data", Collections
  								.singletonMap("boundary", "AaB03x")));
  		return resource.post(File.class).getId();
  	}
docs: Uploads the file to the API