Examples of using HTTP requests to start a business process.

With HTTP requests you can start business processes in ELMA. ELMA supports GET and POST requests. 

To start a process with a request, the process must be set up accordingly in ELMA Designer:
  • open the "Settings" tab of the process. In the Process Start Variants section check the "From external systems" box.
  • generate a process token or enter it manually. To generate the token automatically, click "Generate". The token is needed for identification, therefore it must be unique for each process. 
  • specify the type of request that you want to use to start the process (GET or POST).

 

Examples of GET requests

Example of a GET request for process start:

Request for process start with standard values:
http://127.0.0.1:8000/Processes/ProcessHeader/RunByWebQuery/6e8e72fb-0178-4d8c-a84d-d354debe4de9, где
http://127.0.0.1:8000 - system URL
6e8e72fb-0178-4d8c-a84d-d354debe4de9 - process token 

Example of a GET request to start a process with specific parameters:

In a GET request, you can specify parameters to pass values to process variables of the primitive type (string, integer, etc). The format of a GET parameter is as follows: Variable_property_name=variable_value. The parameters are divided with the & symbol. Here is an example of a GET request with two parameters:
http://127.0.0.1:8000/Processes/ProcessHeader/RunByWebQuery/6e8e72fb-0178-4d8c-a84d-d354debe4de9?CompanyName=ELMA&PhoneNumber=936693, where

http://127.0.0.1:8000 is the system URL
6e8e72fb-0178-4d8c-a84d-d354debe4de9 is the process token
CompanyName is the property name of a process variable. You can find the property name in the Context tab.
ELMA is the value of the Company Name variable
ContactPersonPhoneNumber is the property name of the "Contact Person's Phone Number" context variable.
936693 - is the value of the "Contact Person's Phone Number" variable

To start a process with a GET request you can create an HTML form where the user will fill out the parameters before starting the process. Example of code for the form:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
            <table width="60%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td><b>Company Name:</b></td>
                <td><input type="text" name="CompanyName" size="100"></td>
            </tr>
            <tr>
                <td><b>Contact Person's phone number:</b></td>
                <td><input type="text" name="ContactPersonPhoneNumber" size="15"></td>
            </tr>
                <tr><td><input type="Submit" value="Send" name="Run_Workflow"></td></tr>
            </table>
</form>

Examples of POST requests

In a POST request, you can specify the parameters to pass values of process variables of all types. To start a process with a POST request, you can create an HTML for the user to fill in before starting the process.

Example of a POST request for starting a process with parameters:

The НTML form in a browser can look like this: 

 

Example of code for the form:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Тег FORM</title>
</head>
<body>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><b>String:</b></td>
<td><input type="text" name="String" size="15"></td>
</tr>   
<tr>
<td><input type="Submit" value="Sender" name="Run_Workflow"></td>
</tr>
</table>
</form>
</body>
</html>

where http://dev-elma3.prj.elewise.com:8090 is the system URL;   

65053273-468e-4e6e-bb9b-564af6d160c3 is the process token;

method="POST" shows that you are using a POST request;

String is the name of the property of the String context variable in the process. You can find the property name in the Context tab.

Send button

Below the send button:

1
2
3
<tr>
<td><input type="Submit" value="Send" name="Run_Workflow"></td>
</tr>

Examples of passing parameters in the code of the form

To start the process with filled in context variables:

             1. Run the HTML form in a browser.

             2. Fill out the form.

             3. Click "Send".

Here is a list of context variables used in the process:

All the primitive types are marked in HTML code similar to the String type

1
2
3
4
<tr>
<td width="15%"><b>String:</b></td>
<td><input type="text" name="String" size="15"></td> <!-- string-->
</tr>    

 Block

1
2
3
4
5
6
7
8
9
<tr> <td><b>Block:</b></td></tr>
<tr>
<td><td>First string in block with one variable:</td></td>
<td><input type="text" name="Block[0].String3" size="15"></td>  <!--first string in block with one variable-->
</tr>
<tr>
<td><td>Second string in block with one variable:</td></td>
<td><input type="text" name="Block[1].String3" size="15"></td>  <!--second string in block with one variable-->
</tr>
In name="Block[0].String3", Block is the name of the block, [0] is the number of the string in the block, String3 is the block's context variable.
 
Nested block

1
2
3
4
5
6
7
8
9
10
11
12
13
<tr>
<td><b>Nested block:</b></td> <!--nested block-->
    <td> First string, first variable:</td>
<td><input type="text" name="Bloсk3[0].Bloсk4[0].Stroka5" size="15"></td><!--first string, first variable-->
<td>First string, second variable:</td>
<td><input type="text" name="Block3[0].Block4[0].Stroka6" size="15"></td> <!--first string, second variable-->
</tr>
<tr>
<td><td>Second string, first variable:</td></td>
<td><input type="text" name="Block3[0].Block4[1].Stroka5" size="15"></td> <!--second string, first variable-->
<td>Second string, second variable:</td>
<td><input type="text" name="Block3[0].Block4[1].Stroka6" size="15"></td> <!--second string, second variable-->
</tr>

 

In name="Block3[0].Block4[0].String", Block3 is the name of the block, Block4 is the name of the nested block, [0] is the number of strings in block (nested block), String5 is the context variable of the nested block.
 
Documents are passed with their ID

1
2
3
4
<tr>
<td><b> Document ID:</b></td>
<td><input type="text" name="Document.Id" size="15"></td> <!-- Document--->
</tr>

Lists are described in HTML code in the same way as the User List

1
2
3
4
5
6
7
8
9
<tr>
<td><b>User list:</b></td>
<td> First user ID:</td>
<td><input type="text" name="User[0].Id" size="15"></td> <!--first User List variable -->
</tr>
 <tr>
<td><td> Second user ID:</td></td>
<td><input type="text" name="User[1].Id" size="15"></td> <!-- second User List variable-->
</tr>

In name="User[0].Id, User is the context variable of the User type, [0] is the user's number, Id is the user's ID.

Variable of the File type 

1
2
3
4
<tr>
<td> Select file:</td>
<td><input type="file" name="Fail"></td>
</tr>

Sending the file to the variable of Attachment type

 

1
2
3
4
<tr>
<td> Select attachment:</td>
<td><input type="file" name="Attachment.File"></td>
</tr>