Chapter 6. Connecting to Dropbox

In an integration, you can download files from Dropbox or upload files to Dropbox. The following topics provide the details:

6.1. Registering Fuse Online as a Dropbox client

You must register your Fuse Online environment as a client application that can access Dropbox. This lets you create any number of integrations that connect to Dropbox. In other words, you need to register a particular Fuse Online environment with Dropbox only once.

In each Fuse Online environment, there can be only one registration of Fuse Online as a Dropbox client application. However, while each Dropbox connection uses the same registration, it can use different user credentials.

Prerequisite

You can sign in to the Dropbox account that you want an integration to use to download or upload files.

Procedure

  1. In Fuse Online:

    1. In the left panel, click Settings.
    2. On the Settings page, near the top, to the right of the callback URL, click Copy Callback URL to copy the callback URL for your Fuse Online environment to the clipboard. You will need this URL toward the end of this procedure.
  2. In another browser tab, go to https://www.dropbox.com and do the following:

    1. Sign in to the Dropbox account that has the data that you want to access in an integration.
    2. After signing in, go to https://www.dropbox.com/developers/apps.
    3. Click Create App.
    4. Select Dropbox API.
    5. Near the top of the page, in the sentence that starts with During registration, enter this callback URL:, paste the URL that you copied to the clipboard at the beginning of this procedure. For example, the URL that you paste is something like this: https://app-proj9128.7b63.fuse-ignite.openshiftapps.com/api/v1/credentials/callback.
    6. Choose whether Fuse Online can access a single folder or all of the folders and files.
    7. Specify a name for your Dropbox app. For example, you might specify Fuse Online Access From Aslan LLC. The name you specify must be unique in the set of Dropbox app names.
    8. Check the box to indicate that you agree to Dropbox API terms and conditions.
    9. Click Create App.
    10. In the Dropbox Settings page for your new app, in the input field for OAuth2 Redirect URIs, paste your Fuse Online URL, which you copied to the clipboard at the beginning of this procedure.
    11. Click Add.

Result

Your Fuse Online environment is now registered as a Dropbox client, which means that Fuse Online can access content in the Dropbox account that you signed into.

6.2. Creating a Dropbox connection

In an integration, to download or upload Dropbox files, create a Dropbox connection, which you can add to an integration. You can add the same connection to any number of integrations.

Prerequisite

You registered your Fuse Online environment as an application that can access Dropbox.

Procedure

  1. In a new browser tab, go to https://www.dropbox.com and do the following:

    1. Sign in to the Dropbox account in which you created the app that registers access from your Fuse Online environment.
    2. Go to https://www.dropbox.com/developers/apps.
    3. Click the Fuse Online app to display its settings.
  2. In another browser tab, in Fuse Online, do the following:

    1. In the left panel, click Connections to display any available connections.
    2. In the upper right, click Create Connection to display the available connectors.
    3. Click the Dropbox connector.
  3. Go back to the Dropbox settings display for your app and do the following:

    1. Scroll down to see Generated Access Token.
    2. Click Generate.
    3. Copy the generated access token to the clipboard.
  4. Back in Fuse Online, in the Configure Connection page, in the Access Token field, paste the generated access token.
  5. In the Client Identifier field, enter the name that you specified when you created the Dropbox app.
  6. Click Validate. Fuse Online displays a message that indicates whether it can validate this connection. If validation fails, try again and be sure to enter the correct values.
  7. When validation is successful, click Next.
  8. In the Name field, enter your choice of a name that helps you distinguish this connection from any other connections. For example, enter Dropbox Connect 1.
  9. In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter Sample Dropbox connection that can access all content in our company Dropbox account.
  10. Click Save to see that the connection you created is now available. If you entered the example name, you would see that Dropbox Connect 1 appears as a connection that you can choose to add to an integration.

6.3. Obtaining files from Dropbox to trigger integration execution

To start an integration by downloading files from Dropbox, add a Dropbox connection as the start connection.

Prerequisite

You created a Dropbox connection.

Procedure

  1. In the Fuse Online panel on the left, click Integrations.
  2. Click Create Integration.
  3. On the Choose a connection page, click the Dropbox connection that you want to use to start the integration.
  4. On the Choose an action page, select the Download action to obtain one or more files from the Dropbox account that this connection accesses.
  5. To configure the action, in the Folder or file name path to download field, specify the filename path for the content that you want the integration to obtain. In this release, you can download only a single file.
  6. Click Next to specify the action’s output type.
  7. In the Select Type field, if the data type does not need to be known, accept Type specification not required and click Next. You do not need to follow the rest of these instructions.

    However, a structured data type is recommended. For example, if you want to map the connection output in a data mapper step then you must specify the data type. The data mapper cannot display fields for unstructured data.

    To specify the data type, click in the Select Type field and select one of the following as the schema type:

    • JSON schema is a document that describes the structure of JSON data. The document’s media type is application/schema+json.
    • JSON instance is a document that contains JSON data. The document’s media type is application/json.
    • XML schema is a document that describes the structure of XML data. The document’s file extension is .xsd.
    • XML instance is a document that contains XML data. The document’s file extension is .xml.
  8. In the Definition input box, paste a definition that conforms to the schema type you selected. For example, if you select JSON schema then you would paste the content of a JSON schema file, which has a media type of application/schema+json.
  9. In the Data Type Name field, enter a name that you choose for the data type. For example, if you are specifying a JSON schema for vendors then you might specify Vendor as the data type name.

    You will see this data type name when you are creating or editing an integration that uses the connection for which you are specifying this type. Fuse Online displays the type name in the integration visualization and in the data mapper.

  10. In the Data Type Description field, provide information that helps you distinguish this type. This description appears in the data mapper when you hover over the step that processes this type.
  11. Click Next.

Result

The connection starts the simple integration and Fuse Online prompts you to choose the finish connection.

6.4. Adding files to Dropbox to finish an integration

To finish an integration by uploading files to Dropbox, add a Dropbox connection as the integration’s finish connection.

Prerequisites

  • You created a Dropbox connection.
  • You are creating or editing an integration and Fuse Online is prompting you to choose the finish connection.

Procedure

  1. On the Choose a connection page, click the Dropbox connection that you want to use to finish the integration.
  2. On the Choose an action page, select the Upload action to add the current integration data to the Dropbox account that this connection accesses.
  3. In the Remote Path field, enter the local filename path for file that you want to upload. Dropbox stores the file with the same path and name. In this release, you can upload only a single file.
  4. For the Upload mode:

    • Select Add to upload a file only when a file with the same name is not already in the same Dropbox folder. If a file with the same name is already in the same Dropbox folder, then the file is not uploaded and the integration continues. This is the behavior regardless of whether the content in the file you are trying to upload has been updated.
    • Select Force to ensure that the file is uploaded even if a file with the same name is present in the same Dropbox folder. Dropbox overwrites the file that it already has with the file that you are uploading.
  5. Click Next to specify the action’s input type.
  6. In the Select Type field, if the data type does not need to be known, accept Type specification not required and click Next. You do not need to follow the rest of these instructions.

    However, a structured data type is recommended. For example, if you want to map the connection input in a data mapper step then you must specify the data type. The data mapper cannot display fields for unstructured data.

    To specify the data type, click in the Select Type field and select one of the following as the schema type:

    • JSON schema is a document that describes the structure of JSON data. The document’s media type is application/schema+json.
    • JSON instance is a document that contains JSON data. The document’s media type is application/json.
    • XML schema is a document that describes the structure of XML data. The document’s file extension is .xsd.
    • XML instance is a document that contains XML data. The document’s file extension is .xml.
  7. In the Definition input box, paste a definition that conforms to the schema type you selected. For example, if you select JSON schema then you would paste the content of a JSON schema file, which has a media type of application/schema+json.
  8. In the Data Type Name field, enter a name that you choose for the data type. For example, if you are specifying a JSON schema for vendors you might specify Vendor as the data type name.

    You will see this data type name when you are creating or editing an integration that uses the connection for which you are specifying this type. Fuse Online displays the type name in the integration visualization and in the data mapper.

  9. In the Data Type Description field, provide information that helps you distinguish this type. This description appears in the data mapper when you hover over the step that processes this type.
  10. Click Next.

Result

The connection appears at the end of the integration visualization.

6.5. Accessing Dropbox in the middle of an integration

To upload a file to Dropbox in the middle of a flow, add a Dropbox connection to the middle of the flow.

Prerequisites

  • You created a Dropbox connection.
  • You are creating or editing a flow and Fuse Online is prompting you to add to the integration.

Procedure

  1. On the Add to Integration page, click the plus sign where you want to add the connection. Skip this step if Fuse Online is prompting you to choose the finish connection.
  2. Click the Dropbox connection that you want the integration to use.
  3. On the Choose an action page, select Upload to add the current integration data to the Dropbox account that this connection accesses.
  4. Configure this action:

    1. In the Remote Path field, specify the local path and file name of the file that you want to upload. Dropbox stores the file with the same path and name. In this release, you can upload only a single file.
    2. For the Upload mode:

      • Select Add to upload a file only when a file with the same name is not already in the same Dropbox folder. If a file with the same name is already in the same Dropbox folder, then the file is not uploaded and the integration continues. This is the behavior regardless of whether the content in the file you are trying to upload has been updated.
      • Select Force to ensure that the file is uploaded even if a file with the same name is present in the same Dropbox folder. Dropbox overwrites the file that it already has with the file that you are uploading.
  5. Click Next to specify the action’s input and output type.
  6. In the Select Type field, if the data type does not need to be known, accept Type specification not required and click Next. You do not need to follow the rest of these instructions.

    However, a structured data type is recommended. For example, if you want to map the connection input/output in a data mapper step then you must specify the data type. The data mapper cannot display fields for unstructured data.

    To specify the data type, click in the Select Type field and select one of the following as the schema type:

    • JSON schema is a document that describes the structure of JSON data. The document’s media type is application/schema+json.
    • JSON instance is a document that contains JSON data. The document’s media type is application/json.
    • XML schema is a document that describes the structure of XML data. The document’s file extension is .xsd.
    • XML instance is a document that contains XML data. The document’s file extension is .xml.
  7. In the Definition input box, paste a definition that conforms to the schema type you selected. For example, if you select JSON schema then you would paste the content of a JSON schema file, which has a media type of application/schema+json.
  8. In the Data Type Name field, enter a name that you choose for the data type. For example, if you are specifying a JSON schema for vendors then you might specify Vendor as the data type name.

    You will see this data type name when you are creating or editing an integration that uses the connection for which you are specifying this type. Fuse Online displays the type name in the integration visualization and in the data mapper.

  9. In the Data Type Description field, provide information that helps you distinguish this type. This description appears in the data mapper when you hover over the step that processes this type.
  10. Click Next.

Result

The connection appears in the integration flow where you added it.