FME Version
Files
-
- 300 KB
- Download
Introduction
Using the power of FME in conjunction with existing web services, you can easily incorporate their functionality into your workflows. This article will cover how to upload a folder to Box.com and then get the content information for that folder using the BoxConnector transformer.
Requirements
A free Box.com account
Step-By-Step Instructions
1. Create New Workspace
Before you begin, please ensure you have Box.com account. Open FME Workbench and create a blank workspace.
2. Add a Creator and a BoxConnector Transformer
To upload the folder to Box.com, we will be using the BoxConnector transformer. Add a Creator and a BoxConnector transformer to the canvas, then connect them. The Creator is required to initiate the workflow into the BoxConnector. Open the Creator parameters and delete the value for Creation Instance Attribute.
3. Set BoxConnector Action and Account Parameters
Open the BoxConnector transformer parameters, and set the Box Action to Upload. Next, click the drop-down for Box Account and select Add Web Connection.
In the Box Connection dialog, set the Connection Name to something descriptive, in this example, we are using Training Box Connection as the name, then click Authenticate.
In the Web Service Authentication dialog, log in to Box.com with your username and password and click Authorize. If you have 2 Factor Authentication set up on your account, the next page will ask you for your verification code that will be sent to your phone.
The last step of authentication is to grant access to FME to access your box account. If you accept the permissions, click on the Grant Access to Box button. Now you will have a saved Box Web Connection that can be used in each of the workspaces in this series.
4. Finish Setting BoxConnector Parameters
Still in the BoxConnector parameters, in the Source section, change Upload to Folder, and then for Folder to Upload, click on the ellipsis to browse to the Parks folder that is included in the downloads for this article.
If you have other folders in your Box account, you can change the destination where to save the uploaded folder in the Folder ID section. Click the ellipsis to browse to the new folder location. If you want to save the upload to the root/home folder, leave the Folder ID set to /
5. Add Another BoxConnector Transformer
The folder will be uploaded with the BoxConnector we just set up, but we also want to read back the folder parameters. Add a second BoxConnector transformer and connect it to the Output port on the first BoxConnector.
Open the BoxConnector_2 parameters, set the Box Action to List and select the Training Box Connection as the Box Account. Finally, set the Folder ID to _id, which was automatically set in the first BoxConnector under the Output Attribute section.
6. Add a Microsoft Excel Writer
Finally, we need a place to store the attributes that will be returned about the folder once we run the workspace. Add a Microsoft Excel writer, browse to a location to save your file, and name it BoxFolder_Attributes.xlsx. Leave the Sheet Definition set to Automatic and click OK.
In the Feature Type dialog that appears, set the Sheet Name to ParkAttributes and click OK.
Connect the ParkAttributes Excel writer feature type to the Output port on the second BoxConnector.
7. Save and Run the Workspace
Now we can run the workspace, first save it and then click on the Run button. The folder will be uploaded with the first BoxConnector, and the second BoxConnector will list all of the attribute details for each of the files included in that folder.
To view these attributes, click on the ParkAttributes feature type to open the popup menu and click on View Written Data to open the data in Visual Preview.
In Visual Preview, there will be a row for each file listed in the folder.
Data Attribution
The data used here originates from open data made available by the City of Vancouver , British Columbia. It contains information licensed under the Open Government License - Vancouver.
Additional Articles
Leveraging the Box.com Web Service with FMEDownload a File, Folder or Attributes from Box.com Using the BoxConnector
Comments
0 comments
Please sign in to leave a comment.