Leveraging the Box.com Web Service with FME

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2019.x

Introduction

Using the power of FME in conjunction with existing web services, you can easily incorporate their functionality into your own workflows. This series connects to the popular cloud-based file storage system, Box.com. There are two different methods of connecting to Box.com using FME. This first article will show you how to create an app in the Box.com web interface and then connect to the app using the HTTPCaller transformer. Additionally, an easier solution for uploading, downloading, and retrieving attributes from Box.com would be to use the BoxConnector transformer.

 

For instructions on how to use the BoxConnector, please see either of the following articles:

 

For instructions on how to create an app on Box.com and connect to it via the Box API and the HTTPCaller transformer, continue to the step-by-step instructions in this article and download the workspaces.

 

Requirements

A free Box.com account

 

Step-By-Step Instructions

Part 1: Configuring a Box.com App

In order to use the Box.com API within FME, we first need to set up a Box application that will permit us to access our account.

 

1. Log into Box.com or Create an Account

To start configuration, log in to your Box.com account in a separate tab or window. If you do not have a Box.com account, create a free account now as it is required to continue.

 

2. Navigate to the Developers Console

Once you are logged in, navigate to the Developers Console for Box.com either through the link or by clicking on Dev Console in the side menu bar.

accessdevconsole.png

 

3. Create New App

Inside the Developers Console, click on the Create New App button. If you have any existing apps, they will also show up on this page.

createnew.png

 

Now we will work through the Create New App wizard. Click on the Custom App box; we will be using the Custom App because it doesn’t require the enterprise to authorize our app. Click Next to move to the next screen in the wizard.

createcustomapp.png

 

Now we will choose our authentication method. For our app, we want to have the user log in, select Standard OAuth 2.0 (User Authentication), and then click Next.

authenticationmethod.png

 

Finally, we need to give our app a name. You can name it whatever you like. In this example, we named it LeveragingBoxWithHTTPCaller. Once you are satisfied with your name, click Create App.

appname.png

 

4. View App and Set Redirect URI

After you click Create App, if the app creation was successful, a congratulations message will appear and a button to View Your App. Click on the View Your App button, or navigate to the Box Developers Console homepage and select your app.

When you open your new app, ensure you are on the Configurations page, this can be accessed from the side menu bar.

In the Configurations, we will set up our Redirect URI. Scroll down to find the OAuth 2.0 Redirect URI section, and then in the text box, change the URI to http://localhost . Using localhost is acceptable for our new application as we will consider it to be in development. Once your Redirect URI is set, click Save Changes.

redirecturi.png

 

5. Copy Token

After the Redirect URI has been set, we can copy our Developer Token for use in the next articles. Still on the Configurations page, scroll back up to the Developer Token section and then click Copy.

devtoken.png

 

The developer token string will grant anyone who uses it, access to your Box.com account through the API and is required for the next articles. Keep it private and safe! Note that the developer token will only be valid for 1 hour but can be manually refreshed through the console.


Limitations using developer tokens in addition to the expiration time are that tokens are only valid for your own account, and there is no paired refresh token.

 

Part 2: Connect to Box.com Using the HTTPCaller in FME

Now that you have completed the initial configuration, you can open and run the following workspaces:

 

1. Upload a File to a Directory

The UploadFileToFolder.fmw workspace uploads a file to a directory in Box. Requires a Developer Token to run the workspace as well as a file or folder to upload. A file to upload can be found in the download folder attached at the beginning of this article.

uploadfileworkspace.png

 

2. Get Content Information for a Folder

The GetFolderInfo.fmw workspace gets the content information for a folder or file. Requires a Developer Token to run the workspace as well as at least one file or folder uploaded to Box.com

getfolderinfoworkspace.png

 

If these two workspaces do not cover what you would like to do with your Box.com app, please refer to the Box.com API documentation.

 

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.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.