Four Stars

tDropboxConnection is failing because Dropbox discontinued support for API v1

We are getting this error: com.dropbox.core.DbxClient$IODbxException: com.dropbox.core.DbxException$BadRequest: {"error": "v1_retired"} now that they retired the old API.  The terminated support for the old API last Thursday (link).

 

Anybody else run into this issue?  How are you resolving it?  

 

We aren't sure if the existing tDropboxConnection component will work with a new token or if this fix is going to be more involved.  Curious if anybody else already worked through this and can point us in the right direction.

 

Thank you!


Marc

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Four Stars

Re: tDropboxConnection is failing because Dropbox discontinued support for API v1

I've been facing the same issue this week. At the end I got my job working, but I had to stop using the tdropbox family components (I didn't found any two-minutes solution).

So, my job had this structure:

tdropboxconnection -> tdropboxlist -> tdropboxget -> do stuff

 

That's what I did:

- I went to my dropbox app console and generated and auth_token. I hoped that would be enough to make the dropbox connection work again. It didn't. So:

 

- I removed the tdropbox connection

- The tdropboxlist turned into:

   · trest component. Url: "https://api.dropboxapi.com/2/files/list_folder", Method: post. Headers: Authorization "Bearer base64(appkey:appsecret)", Content-Type: "application/json" (I got this info from the dropbox migration guide site)

   · The response has a schema with a 'Body' string field. I had to parse this 'Body' string to get and iterate all the "path_display" properties from the entries array (these were the files I actually wanted)

 

- The tdropboxget turned into the following routine (I took the code from http://www.codejava.net/java-se/networking/use-httpurlconnection-to-download-file-from-an-http-url):

  

 

public static void downloadFromUrl(String dropboxFilePath, String destinationFilepath) throws IOException{
    URL url = new URL("https://content.dropboxapi.com/2/files/download");
        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
        httpConn.setRequestProperty ("Authorization", "Bearer xxxxxx");
        httpConn.setRequestMethod("POST");
        httpConn.setRequestProperty("Dropbox-API-Arg", "{\"path\": \""+ dropboxFilePath +"\"}");
        int responseCode = httpConn.getResponseCode();
 
        // always check HTTP response code first
        if (responseCode == HttpURLConnection.HTTP_OK) {

            // opens input stream from the HTTP connection
            InputStream inputStream = httpConn.getInputStream();
             
            // opens an output stream to save into file
            FileOutputStream outputStream = new FileOutputStream(destinationFilepath);
 
            int bytesRead = -1;
            byte[] buffer = new byte[4096];
            while ((bytesRead = inputStream.read(buffer)) != -1) {
                outputStream.write(buffer, 0, bytesRead);
            }
 
            outputStream.close();
            inputStream.close();
 
            System.out.println("File downloaded");
        } else {
            System.out.println("No file to download. Server replied HTTP code: " + responseCode);
        }
        httpConn.disconnect();
  
    }

 

Hope that helps someone.

Four Stars

Re: tDropboxConnection is failing because Dropbox discontinued support for API v1

Thank you for the response...Actually determined that the jobs needed to be built in Talend 6.2 or above.  Once we moved to the newer version the component was compliant with the v2 API.

We can consider this issue closed.

3 REPLIES
Four Stars

Re: tDropboxConnection is failing because Dropbox discontinued support for API v1

I've been facing the same issue this week. At the end I got my job working, but I had to stop using the tdropbox family components (I didn't found any two-minutes solution).

So, my job had this structure:

tdropboxconnection -> tdropboxlist -> tdropboxget -> do stuff

 

That's what I did:

- I went to my dropbox app console and generated and auth_token. I hoped that would be enough to make the dropbox connection work again. It didn't. So:

 

- I removed the tdropbox connection

- The tdropboxlist turned into:

   · trest component. Url: "https://api.dropboxapi.com/2/files/list_folder", Method: post. Headers: Authorization "Bearer base64(appkey:appsecret)", Content-Type: "application/json" (I got this info from the dropbox migration guide site)

   · The response has a schema with a 'Body' string field. I had to parse this 'Body' string to get and iterate all the "path_display" properties from the entries array (these were the files I actually wanted)

 

- The tdropboxget turned into the following routine (I took the code from http://www.codejava.net/java-se/networking/use-httpurlconnection-to-download-file-from-an-http-url):

  

 

public static void downloadFromUrl(String dropboxFilePath, String destinationFilepath) throws IOException{
    URL url = new URL("https://content.dropboxapi.com/2/files/download");
        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
        httpConn.setRequestProperty ("Authorization", "Bearer xxxxxx");
        httpConn.setRequestMethod("POST");
        httpConn.setRequestProperty("Dropbox-API-Arg", "{\"path\": \""+ dropboxFilePath +"\"}");
        int responseCode = httpConn.getResponseCode();
 
        // always check HTTP response code first
        if (responseCode == HttpURLConnection.HTTP_OK) {

            // opens input stream from the HTTP connection
            InputStream inputStream = httpConn.getInputStream();
             
            // opens an output stream to save into file
            FileOutputStream outputStream = new FileOutputStream(destinationFilepath);
 
            int bytesRead = -1;
            byte[] buffer = new byte[4096];
            while ((bytesRead = inputStream.read(buffer)) != -1) {
                outputStream.write(buffer, 0, bytesRead);
            }
 
            outputStream.close();
            inputStream.close();
 
            System.out.println("File downloaded");
        } else {
            System.out.println("No file to download. Server replied HTTP code: " + responseCode);
        }
        httpConn.disconnect();
  
    }

 

Hope that helps someone.

Moderator

Re: tDropboxConnection is failing because Dropbox discontinued support for API v1

Hello,

Could you please post some screenshots of your job setting on forum which will be helpful for us to address your issue?

Thanks for your time.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: tDropboxConnection is failing because Dropbox discontinued support for API v1

Thank you for the response...Actually determined that the jobs needed to be built in Talend 6.2 or above.  Once we moved to the newer version the component was compliant with the v2 API.

We can consider this issue closed.