Cloud Integration with Dropbox

This blog post shows the steps to connect with Dropbox using Dropbox adapter in Cloud Integration.

Configuration at Dropbox:

  1. Create an app at https://www.dropbox.com/developers/apps.
  2. In redirect URL, provide the CPI tenant redirect URL.The App will auto-generate App key and App secret. App key will be used as client key and App secret will be used as client secret at the CPI side.App%20Settings
  3. Specify required permissions. For example, the required scope is files.content.write for file upload.Permission%20Settings

Configuration at CPI:

Step 1:

Go to CPI tenant -> Security Material-> Create -> OAuth2 Authorization Code as below.

OAuth2%20Authorization%20Code

OAuth2 Authorization Code

Authorization URL: https://www.dropbox.com/oauth2/authorize?client_id=<API Key>&token_access_type=offline&response_type=code&state=123

As no scope is specified, the authorization page will request all scopes selected on the Permissions tab of the Dropbox App.

Click on ‘Authorize’. After successful authorization, a message will appear like below.

Authorization was successful: Refresh Token was added to the OAuth2 Authorization Code Credential ‘DropboxOAuth2’.

Step 2:

Design I-Flow as below.

IFLow

IFlow

  1. Use Content modifier to set file properties.Content%20ModifierMessage body is set as ‘This is a sample file’, i.e, the file content.
  2. Use groovy script to set the property for the file path.
    import com.sap.gateway.ip.core.customdev.util.Message;
    def Message processData(Message message) { //Properties def properties = message.getProperties(); folderPath = properties.get("folderPath"); fileCounter= properties.get("counter"); filenamePrefix = properties.get("filenamePrefix"); fileExtension = properties.get("fileExtension"); def filePath = folderPath + filenamePrefix + '_'+ fileCounter+ fileExtension; message.setProperty("filePath",filePath); return message;
    }​
  3. Configure Dropbox receiver adapter to upload the file.

Step 3:

Deploy the I-flow and check the Dropbox folder.

  1. To connect with Dropbox, use OAuth2 Authorization Code.
  2. On selection of Dropbox adapter, it will be imported and deployed automatically (supported for standard and premium edition).
  1. SAP Help Portal
  2. Integration Adapters in SAP API Business Hub for SAP Integration Suite
  3. Dropbox for HTTP Developers

  4. SAP API Business Hub

Thank you for reading this blog post. Please feel free to share your feedback or thoughts or ask any questions in the Q&A tag below.

QA link

Regards,

Priyanka Chakraborti