This blog post shows the steps to connect with Dropbox using Dropbox adapter in Cloud Integration.
Implementation Guide:
Configuration at Dropbox:
- Create an app at https://www.dropbox.com/developers/apps.
- 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.
- Specify required permissions. For example, the required scope is files.content.write for file upload.
Configuration at CPI:
Step 1:
Go to CPI tenant -> Security Material-> Create -> OAuth2 Authorization Code as below.
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.
- Use Content modifier to set file properties.Message body is set as ‘This is a sample file’, i.e, the file content.
- 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; }
- Configure Dropbox receiver adapter to upload the file.
Step 3:
Deploy the I-flow and check the Dropbox folder.
TakeAway Points:
- To connect with Dropbox, use OAuth2 Authorization Code.
- On selection of Dropbox adapter, it will be imported and deployed automatically (supported for standard and premium edition).
Reference Links:
- SAP Help Portal
- Integration Adapters in SAP API Business Hub for SAP Integration Suite
- 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.