Skip to Content
Technical Articles
Author's profile photo Priyanka Chakraborti

Cloud Integration with Dropbox

Introduction:

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

Implementation Guide:

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 Authorization Code

 

Authorization URL: https://www.dropbox.com/oauth2/authorize?token_access_type=offline

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();
        def folderPath = properties.get("folderPath");
        def fileCounter= properties.get("counter");
        def filenamePrefix = properties.get("filenamePrefix");
        def 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.

TakeAway Points:

  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).

Reference Links:

  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

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vignesh Venkatramanan
      Vignesh Venkatramanan

      Hi Priyanka,

      I tried to use the above steps and hit on enter to authorize for the Authorization Code which is deployed in the security material, I am getting error as "

      <code>Internal Server Error</code>
      <message xml:lang="en">[OAuthCodeCredentialManagement][OAUTH][ProblemDuringCallingTokenEndpointWithCode]:Problem during calling the token endpoint of OAuth2 Authorization Code Credential "DropboxOauth2" with grant type authorization_code: Problem during requesting the refresh token for the OAuth2 Authorization Code Credential DropboxOauth2: Problem during writing to HttpURLConnection output stream: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</message>"

      Kindly do the needful.

      Regards,

      Vignesh V

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author

      Hi Vignesh,

      Please add the root cert of dropbox server in CPI keystore and try to authorise.

      Regards,

      Priyanka

       

      Author's profile photo Vignesh Venkatramanan
      Vignesh Venkatramanan

      Hi Priyanka,

      Thank you so much for the speedy reply. Issue is resolved now.

       

      Regards,

      Vignesh V

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author

      👍