Skip to Content

Connector tutorial scenario 1: Fetch file

Introduction

This scenario demonstrates a use of a Dropbox Fetch File activity where a file is fetched from Dropbox and then written to an FTP server.

In this scenario, the resulting file will be a JSON file that includes both the content of the original file and metadata about the file received from Dropbox.

Note

For an example where the content of the file is returned without the Dropbox metadata, see Scenario 2: Fetch file.

Here is the completed operation:

image

Important

To complete this operation and scenario, complete the prerequisite setup required in the Dropbox connector tutorial.

You should have the following:

  • Access to a Dropbox account and FTP server.
  • Configured Dropbox and FTP connectors.
  • Access to assets/sample-data directory of the Dropbox connector repository.

1. Copy sample file to Dropbox

Copy the sample file (customers.csv) from the assets/sample-data directory of the Dropbox connector to your Dropbox account.

2. Add a Dropbox Fetch File activity to an operation

Drag a Dropbox Fetch File activity from the design component palette to the component drop zone on the design canvas to create an instance of a Dropbox Fetch File activity in a new operation. Double-click the activity to open it.

Enter a name, a folder path (such as /), and the name of the file to be downloaded (such as customer.csv):

image

Clicking the Next button will take you to a screen where you can review the data schema:

image

This shows what is returned from Dropbox as a response. It will be in an XML format, and shows that the metadata about the file is returned in addition to the content field, which contains the actual content.

Click Finished to return to the workflow.

3. Add an FTP Write activity to the operation

Drag a FTP Write activity from the design component palette to the component drop zone on the design canvas to create an instance of a FTP Write activity in a new operation. Double-click the activity to open it.

Enter a name, provide a JSON schema, and a file name (such as dropbox_result_[date]_[time].json). This file name will create a new timestamped file name every time the operation is run.

For the schema you can copy and paste the following JSON and set the schema file name to customers.json:

{
  "name": "customers.csv",
  "clientModified": "2018-03-16T14:40:39-07:00",
  "serverModified": "2018-04-10T14:10:52-07:00",
  "rev": "49a708770",
  "size": 2231,
  "sharingInfo": {
    "readOnly": null,
    "parentSharedFolderId": null,
    "modifiedBy": null
  },
  "content": "Y29tcGFueSxhZGRy...I2NzcsKDc4MikgMzQzLTAyNjA=",
  "link": null
}

The FTP Write activity will look like this:

image

Click Next and then Finished to close the FTP Write activity configuration.

image

4. Add a transformation to the operation

Hover over the area between the two activities in the operation and click the component drop zone to open a menu where you can select New Transformation.

Configure the transformation with a name. If you have created the schema in the FTP Write activity as described above, you can use the Automap Exact Matches link to automatically map all fields of the Dropbox Fetch File source to the FTP Write target.

Click the Close icon to save the transformation configuration and return to the workflow:

image

5. Run the operation

Assuming that you have placed a customers.csv file in an accessible folder in your Dropbox account, you can now deploy and run the operation.

In the operation log, you should see the operation being received and then successfully completed:

image

6. Confirm success

To confirm success, open your FTP server and check that the file has been added.

Note

If you are using the Jitterbit training FTP server, a web viewer for it is located at https://training2.jitterbit.com/WebInterface/login.html.

The new file should be in the root directory with a name similar to dropbox_result_[date]_[time].json. If you download and view the file, it will look similar to this:

{
  "name": "customers.csv",
  "clientModified": "2018-03-16T14:40:39-07:00",
  "serverModified": "2018-04-10T14:10:52-07:00",
  "rev": "49a708770",
  "size": 2231,
  "sharingInfo": {
    "readOnly": null,
    "parentSharedFolderId": null,
    "modifiedBy": null
  },
  "content": "Y29tcGFueSxhZGRy...I2NzcsKDc4MikgMzQzLTAyNjA=",
  "link": null
}

The file is a JSON file, with the metadata from Dropbox being the first fields. The content field shows as a Base64-encoded string.