To collaborate Cloud-based Workflow with Cloud Storage (Dropbox ed.)

For example, after estimate approval, an auto-generated quote PDF will be saved automatically to Dropbox.

 

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.

 

questetra-dropbox

== 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.

 

== 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.

 

file-register-process-diagram-en

Process Diagram

file-register-task

Task processing screen of “File Registration”

Data Items

Data Items

The information on APIs for accessing Dropbox is published as Core API in the following page.

https://www.dropbox.com/developers-v1/core/docs

 

API specification for saving files to Dropbox is described as follows:

Access URL
https://content.dropboxapi.com/1/files_put/auto/folderName/fileName
HTTP Method
PUT
Request Body
File

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”.

 

“File sending” Throwing Message Intermediate Event (HTTP)

# "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.

  1. Confirm Callback URL in Questetra BPM Suite
  2. Confirm App key and App secret on Dropbox App
  3. 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.

 

Confirmation screen of Callback URL

Confirmation screen of Callback URL

 

=== 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.

 

Setting screen of Dropbox

Setting screen of Dropbox

 

=== 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.

Name
(Arbitrary)
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
https://api.dropbox.com/1/oauth2/token
Scope
(Empty)
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 redirect_uri.

 

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].

 

file-regster-task-execution

file-register-on-dropbox

 

== 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

etc.

 

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!

 


Reference

About YAHAGI Hajime

幸せを生み出すITを追求するクエステトラの一味です。 国産の BPM ソフト Questetra BPM Suite で日本・世界を幸せにしたい。
View all posts by YAHAGI Hajime

Recommendations
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 System Cooperation, it’s Easy if Done by Email

Archive

 RSS