Dropbox Connection with MuleSoft

May 3, 2016
blog author


Mulesoft Developer

MuleSoft ESB has a cool way of connecting with various applications like Facebook, Twitter, Dropbox etc. Cool, but I found it difficult to configure the connector to try for a simple scenario. As the documentation is a bit less, a YouTube presentation [dropbox-integration-connector] is available that helps walk us down 75% of the path. The flow remains the same, first authorize, then flow. Couple of issues that I faced during the configuration of Dropbox:

  • Create the application in Dropbox: Probably the unknown part. This is required as this step would provide the App Key, App Secret and the callback url definition.
    • You need to have an account in Dropbox.
    • Create an app using dropbox-create
    • Use the radio button for Dropbox Api App
    • For questions below:
      • What type of data does your app need to store on Dropbox? Ans I chose
          : Files and datastores
      • Can your app be limited to its own folder? Ans I chose
          : No
          : Selecting this provides a “fullDropBox” access. If yes then the access provided is “app”. This needs to be done because api used by mule connector passes the root as fulldrop box which causes the file not to be placed or created.
      • What type of files does your app need access to? Ans I chose
          : All file types
          : Same as above.
      • Provide an app name, and you're on your way.
      • On submit, you will be taken to the app console page. The key and secret would be provided.
      • On the same page you will also have the callback url. The value should be same as the one thats configured on the dropbox connector.


  • Problems with Mule: Mule configuration follow the same steps provided by the youtube video. Just couple of changes according to me to make it actually work. Flow dropbox_flow
      • The authorization flow goes smoothly, if all is configured correctly. One catch is to enable the cookies option in the http connector.
      • All connectivity goes to same port and host.
      • The second flow where we do heavy lifting, there we need to set the accessTokenId. This id is required to be pulled from the cookies and set on the dropbox connector while using any methods other than authorize.
    • What i did was to use message property to pull from the cookies and set in invocation properties.
    • This would be used in all the methods of dropbox.
    • Converting from dropbox.link class to json or string. For this Google’s Gson is required. “mule-module-dropbox” has a class called as GsonFactory whose instance could be obtained and used its method to convert to JSON from link. Native object to json won't work here. So I had to create a custom transformer that would do this and also set the content type as application/json.

Happy Connecting!!