From our customers who are managing Business Process by Questetra BPM Suite, we often receive consultations about a way of auto-saving files into cloud storage.In this article, I’ll show how to collaborate with Dropbox, one of popular cloud storage.
This time, to make the collaboration procedure more understandable, I focus on a simple Business Process for registering files.
In the process, we first register a file on Questetra BPM Suite, and then the file will be saved into Dropbox automatically.
== Description flow ==
I will describe a way of setting for realizing collaboration of Questetra BPM Suite with Dropbox according to the following steps.
1. Define Process Model on Questetra BPM Suite
2. Setting OAuth 2.0
3. Confirm operation
After accessing API of Dropbox from Questetra BPM Suite, transfer a registered file on Questetra BPM Suite to Dropbox and save it. To access the API, it is required to use the authentification system OAuth 2.0. First, you must set up it.
Incidentally, this article is written for people who have the following skills.
- Those who understand how to develop App by Dropbox (If you want to develop App, check this page)
- Those who understand how to use [Throwing Message Intermediate Event (HTTP)] / [Script Task] in Questetra BPM Suite
== Define Process Model on Questetra BPM Suite ==
Here we configure Questetra BPM Suite setting. The process model we define here can be download from here.
In the process model diagram, the human task includes “File Registration” only. Files that have been registered in this task will be sent to Dropbox by the “File Sending” of [Throwing Message Intermediate Event (HTTP)] which is placed one step before the end.
The information on APIs for accessing Dropbox is published as Core API in the following page.
API specification for saving files to Dropbox is described as follows:
- Access URL
- HTTP Method
- Request Body
Based on this rule, configure the setting of “File Sending” Throwing Message Intermediate Event (HTTP). Since an access URL will change dynamically according to foldername or filename, we generate the URL by Script Task “API URL”.
# "API URL" Script Task var base_url = "https://content.dropboxapi.com/1/files_put/auto/"; var file_name = data.get("3"); var folder_name = data.get("5"); var exec_url = base_url + encodeURI(folder_name) + "/" + encodeURI(file_name); retVal.put("4",exec_url);
== OAuth 2.0 Setting ==
To access a URL for API of Dropbox from Throwing Message Intermediate Event of Questetra BPM Suite, OAuth 2.0 authentication is needed.
This setting includes the following steps.
- Confirm Callback URL in Questetra BPM Suite
- Confirm App key and App secret on Dropbox App
- Set OAuth 2.0 and acquire token in Questetra BPM Suite
=== Confirm Callback URL in Questetra BPM Suite ===
It is an operation in the Questetra BPM Suite side.
Confirm Callback URL in the property screen of Throwing Message Intermediate Event. In the screen of [Security] tab, select [Connect with the OAuth 2.0] and click [Set up OAuth 2.0 from here]. Then the screen of OAuth 2.0 setting is displayed in another window. Take note of Callback URL written in this page.
=== Confirm App key and App secret on Dropbox App ===
It is an operation in the Dropbox side.
Take notes of App key and App secret that are displayed in the setting screen of an App created in Dropbox. At the same time, in the setting screen of Dropbox App, register the Callback URL of Questetra BPM Suite that has been noted at the previous step.
Need to create App in Dropbox before setting.
=== Set OAuth 2.0 and acquire token in Questetra BPM Suite ===
It is an operation in the Questetra BPM Suite side.
Open the property of “File Sending” Throwing Message Intermediate Event (HTTP) of a created process model.
In the screen of [Security] tab, select [Connect with the OAuth 2.0] and click [Set up OAuth 2.0 from here]. Then the screen of OAuth 2.0 setting is displayed in another window. Clicking [Add] on the top of the displayed screen, the details setting screen on OAuth 2.0 will be displayed. Set up each item as follows.
- Authorization Code Request URL
- https://www.dropbox.com/1/oauth2/authorize?response_type=token&client_id=(App key of Dropbox App)&redirect_uri=(Callback URL)
- Access Token Request URL
- Consumer Key
- App key of Dropbox App
- Consumer Secret
- App secret of Dropbox App
In the Authorization Code Request URL, you specify Callback URL which is URL-encoded into
When finished inputting, then save and acquire token.
== Operation Confirmation ==
When finished setting as described in the previous sections, then release the defined Process Model. After that, start the process from New Start and process an only Human Task [File Registration].
== Many kinds of Dropbox APIs ==
Now, the description of how to configure a system for saving files which have been registered in Questetra BPM Suite to Dropbox automatically has finished.
Dropbox provides many APIs, and their specifications are published.
- API for saving file to Dropbox (We used this time)
- API for referring to or operating files saved in Dropbox
- API for referring to information of folders created in Dropbox
By using Dropbox API from Questetra BPM Suite, you can perform operations such as saving and changing to Dropbox, or can get the information in the Dropbox.
That’s it for today!
- Dropbox API v1 (Core API)
- How to use Questetra BPM Suite Throwing Message Intermediate Event (HTTP)
- How to use Questetra BPM Suite Script Task
- [File Registration] Process Model (Japanese)
|Prev article - 50. Questetra Tips||System Administrators, Please Check Your Web Forms which have been Published, Occasionally|
|Next article - 50. Questetra Tips||Measures for "Cannot Delete Issues!"|
|Another article - YAHAGI Hajime||Creating ‘Inquiry-handling system’ for Free ; Advanced series – Summary|