Skip to content

Instantly share code, notes, and snippets.

@djuang1
Created January 31, 2017 20:47
Show Gist options
  • Save djuang1/c27903428b28445b5124868576f788dc to your computer and use it in GitHub Desktop.
Save djuang1/c27903428b28445b5124868576f788dc to your computer and use it in GitHub Desktop.
Dropbox Mule Example
<file:connector name="File_First" autoDelete="true" streaming="true" validateConnections="true" doc:name="File" />
<http:request-config name="Dropbox_HTTPS_Request_Configuration" protocol="HTTPS" host="content.dropboxapi.com" port="443" basePath="/" doc:name="HTTP Request Configuration">
<tls:context>
<tls:key-store type="jks" path="keystore.jks" keyPassword="<password>" password="<password>"/>
</tls:context>
</http:request-config>
<flow name="upload-first-floor">
<file:inbound-endpoint path="${file.first}" responseTimeout="30000" doc:name="Retrieve File" connector-ref="File_First" pollingFrequency="30000" fileAge="20000">
<file:filename-regex-filter pattern="(.*).avi" caseSensitive="true"/>
</file:inbound-endpoint>
<logger message="Moving #[flowVars.originalFilename] to Box" level="INFO" doc:name="Logger"/>
<set-variable variableName="streamPayload" value="#[payload]" doc:name="Store Payload"/>
<http:request config-ref="Dropbox_HTTPS_Request_Configuration" path="1/files_put/auto/#[flowVars.originalFilename]" method="PUT" doc:name="DropBox API - File Upload">
<http:request-builder>
<http:header headerName="Authorization" value="Bearer <YOUR ACCESS TOKEN>"/>
</http:request-builder>
</http:request>
<expression-component doc:name="Close Payload InputStream">streamPayload.close()</expression-component>
</flow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment