HTTPRestHandler
Description
The HTTPRestHandler enables the user to send requests to a server and save the returned answer in a process-variable. The status (success
or error
) of the call is written into the variable SYS.<name of the event>_status
.
Class
com.dooris.bpm.actionhandler.HttpRestHandler
Parameter
Parameter name | Default value | Description | Valid examples |
---|---|---|---|
| Â | This parameter contains the URL of the requested server. |
|
|
| This parameter determines which method will be remotely invoked. |
|
| Â | This parameter contains the file path to a JSON file that contains the input for the server. |
|
| Â | This parameter contains the input for the server in JSON-Format. | Â |
| Â | This parameter contains the input for the server in JSON-Format. | Â |
| Â | This parameter contains the process variable into which the server response should be saved. | Â |
| Â | This parameter is only required if the server requires identification and contains the user name of the user. | Â |
| Â | This parameter is only needed if the server requires an identification and contains the user's password. | Â |
| Â | This parameter is only needed if the server requires identification and contains the encryption which should be applied. One possible encryption is base64, which will be applied by setting this parameter to |
|
|
| This parameter describes the OAuth grant type to be used in the request. For other options please refer to: OAuth Grant Types | Â |
|
| This parameter should come together with a value of Refresh Token and is used to obtain an Access Token. | Â |
| Â | This parameter is a public identifier for the applications, i.e public exposed string that is used by the service API to identify the application. | Â |
| Â | This parameter is a secret known only to the OAuth application and the authorization server. It is generated by the authorization server during the process of application registration. A client has to provide its client secret to authenticate itself to the authorization server. | Â |
| Â | Secifies the URL from where to retrieve the OAuth token from. | Â |
|
| If it is | Â |
| Â | This parameter is used to add additonal fields to the Rest. | Â |
 |  | This parameter is used to add additonal Headers to the Rest . |
|
|
| Here, the Json path for a specific part of the returned Json file and a variable name under which the specific part of the Json should be saved, are entered. The variable(s) are then saved in an array named 'result'. For better understanding see examples. |
|
| Â | This parameter specifies the content type of the request. | Â |
| Â | Replaces all | Â |
|
| If enabled, converts the URL to a US-ASCII string. In addition, square brackets will be ascaped with their respective ASCII values. | Â |
|
| This parameter is used to convert the query parameters to JSON string. | Â |
|
| If enabled, stores the response as a note and attaches it to the current process instance. | Â |
|
| If enabled, creates a mulitpart request containing all attached documents. | Â |
| Â | This parameter adds a local file by the given path. | Â |
| Â | If enabled, the response gets logged out in the server log. | Â |
|
| If enabled, the request gets logged out in the server log. | Â |
|
| This parameter can be specified as either 0 or 1. It only makes a difference if an exception is thrown. If an exception is thrown, the process is stopped if the parameter is set to 0 and if it is set to 1 the exception message is saved in the responseVariable and the process can continue as usual. |
|
|
| Repeat execution if there is a faulty request (if its an IOException (like 403, 401)) | Â |
|
| This parameter is used when you want to call the rest handler from a TSD button . |  |
Â
Example:
Eventtype | Node Leave |
---|---|
Actionname | com.dooris.bpm.actionhandler.HttpRestHandler |
Actionclass | com.dooris.bpm.actionhandler.HttpRestHandler |
Parameter | hostName=https://yourcompanyserver.com/rest/list/${customerList}; method=Post; postParameter={ "Company":"${customer_company}", "First Name":"${customer_firstname}", "Last Name":"${customer_lastname}", "Email":"${customer_email}",}; user=John.Doe; pass=specialPW; authMethod=basic; responseVariable=responseVar; faultTolerance=0; Â |
Â
Example inputs for searchByJsonPath:
Â
JSON Code example for what is returned with get method
[
{
"id": "0001",
"type": "donut",
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" }
]
}
]
Â
If you want to get all the types from the ‘batter' and save it as result variable 'types’, you have to use as value:
[{path: "[0]['batters']['batter'][*]['type']", resultVariable: "types"}]
(We use * in order to get all types. For a specific position, use the number instead of *)
result: {"types":["Regular","Chocolate"]}If you want to get the types of each 'batter' and save it in different result variables:
[{path: "[0]['batters']['batter'][0]['type']", resultVariable: "type1"},{path: "[0]['batters']['batter'][1]['type']", resultVariable: "type2"}]
result:{"type2":"Chocolate","type1":"Regular"}If you want to get the whole object based on a specific value e.x. 'Chocolate':
[{path: "[0]['batters']['batter'][*][?(@.type == 'Chocolate')]", resultVariable: "res"}]
result: {"res":[{"id":"1002","type":"Chocolate"}]}
© TIM Solutions GmbH | AGB | Datenschutz | Impressum