Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Description

Der HTTPRestHandler ermöglicht es dem Benutzer, Anfragen an einen Server zu senden und die zurückgegebene Antwort in einer Prozessvariablen zu speichern. Der Status ("success" oder "error") des Aufrufs wird in die Variable "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" geschrieben. Anfragen an einen Server zu senden und die zurückgegebene Antwort in einer Prozessvariablen zu speichern. Der Status ("success" oder "error") des Aufrufs wird in die Variable

...

...

Class

Code Block
com.dooris.bpm.actionhandler.HttpRestHandler

Parameter

Ereignistyp

Knoten verlassen

ParameternameParameter name

StandardwertDefault value

BeschreibungDescription

Gültige BeispieleValid examples

hostName
Dieser Parameter enthält die URL des angeforderten Servers.

Status
colourRed
titleMANDATORY

This parameter contains the URL of the requested server.

Host name (URL)

method

postDieser

Parameter bestimmt, welche Methode remote aufgerufen wird. "Post" bedeutet, dass der Server eine Eingabe im XML-Format erwartet, die er verarbeitet und zurückgibt. "Get" hingegen bedeutet, dass der Server Daten sendet, ohne dass eine Eingabe erforderlich istThis parameter determines which method will be remotely invoked. Post means that the server expects an input in XML-Format that it will process and return. Get means that the Server will send data without requiring input.

delete
get
head
options
patch
post
put

templatePath

Dieser Parameter enthält den Dateipfad zu einer JSON-Datei, die die Eingabe für den Server enthält.

postParameter

Dieser Parameter enthält die Eingabe für den Server im

Status
colourRed
titleMANDATORY
(if httpBody is not set)

This parameter contains the file path to a JSON file that contains the input for the server.

Path to template

getParameter

This parameter contains the input for the server in JSON-Format.

httpBody

Status
colourRed
titleMANDATORY
(if templatePath is not set)

This parameter contains the input for the server in JSON-Format.

responseVariable

Dieser Parameter enthält die Prozessvariable, in der die Serverantwort gespeichert werden soll.

user

Dieser Parameter ist nur erforderlich, wenn der Server eine Identifizierung erfordert und den Benutzernamen des Benutzers enthält.

pass

Dieser Parameter wird nur benötigt, wenn der Server eine Identifikation benötigt und das Kennwort des Benutzers enthält.

authMethod

Dieser Parameter wird nur benötigt, wenn der Server eine Identifizierung erfordert und die Verschlüsselung enthält, die angewendet werden soll. Eine mögliche Verschlüsselung ist base64, die angewendet wird, indem dieser Parameter auf "basic" gesetzt wird.

oauth

basic

oAuthTokenUrl

Nur erforderlich, wenn authMethod = "oauth"

URL, von der das oauth-Token abgerufen werden soll.

additionalHeaders

Hinzufügen zusätzlicher Header zum Rest This parameter contains the process variable into which the server response should be saved.

user

This parameter is only required if the server requires identification and contains the user name of the user.

pass

This parameter is only needed if the server requires an identification and contains the user's password.

authMethod

Status
colourRed
titleMandatory

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

oauth

basic

oAuthGrantTypeAccess

password

This parameter describes the OAuth grant type to be used in the request. Other options: https://oauth.net/2/grant-types/

oAuthGrantTypeRefresh

refresh_token

This parameter should come together with a value of Refresh Token and is used to obtain an Access Token.

oAuthClientId

Status
colourRed
titleMANDATORY
(if authMethod == "oauth")

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.

oAuthClientSecret

Status
colourRed
titleMANDATORY
(if authMethod == "oauth")

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.

oAuthTokenUrl

Status
colourRed
titleMANDATORY
(if authMethod == "oauth")

Required only if authMethod = "oauth"

Secifies the URL from where to retrieve the OAuth token from.

oAuthTokenBasicAuth

false

This parameter is used to set the basic authentication token.

additionalFields

This parameter is used to add additonal fields to the Rest.

additionalHeaders

This parameter is used to add additonal Headers to the Rest .

call"&method=GET&additionalHeaders=[NAME_OF_VARIABLE=" + variable + ";" + "NAME_OF_VARIABLE2=" + variable2 + "]"

searchByJsonPath

nullHier

werden der Json-Pfad für einen bestimmten Teil der zurückgegebenen Json-Datei und ein Variablenname eingegeben, unter dem der spezifische Teil des Json gespeichert werden soll. Die Variable(n) werden dann in einem Array mit dem Namen 'result' gespeichert. Zum besseren Verständnis siehe BeispieleHere, 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.

[{path: "[*]", resultVariable: "variable_name"}]

contentType

This parameter specifies the content type of the request.

newLineReplacement

Replaces all \n with the given value, unless false is provided as a value.

urlEncoding

true

If enabled, converts the URL to a US-ASCII string. In addition, square brackets will be ascaped with their respective ASCII values.

convertBodyToJson

false

This parameter is used to convert the query parameters to JSON string.

addNote

false

If enabled, stores the response as a note and attaches it to the current process instance.

addAllDocuments

false

If enabled, creates a mulitpart request containing all attached documents.
Only relevant for PUT requests.

addLocalDocument

This parameter adds a local file by the given path.

logResponse

If enabled, the response gets logged out in the server log.

logRequest

true

If enabled, the request gets logged out in the server log.

faultTolerance

1

Dieser Parameter kann entweder als 0 oder 1 angegeben werden. Es macht nur einen Unterschied, wenn eine Ausnahme ausgelöst wird. Wenn eine Ausnahme ausgelöst wird, wird der Prozess beendet, wenn der Parameter auf 0 gesetzt ist, und wenn er auf 1 gesetzt ist, wird die Ausnahmemeldung in der responseVariable gespeichert, und der Prozess kann wie gewohnt fortgesetzt werden.

0

1

Beispiel

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.

0

1

onErrorRepetition

0

Repeat execution if there is a faulty request (if its an IOException (like 403, 401))

isRestCallButton

false

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
Code Block
languagejs
[
  {
		"id": "0001",
		"type": "donut",
		"batters":
			{
				"batter":
					[
						{ "id": "1001", "type": "Regular" },
						{ "id": "1002", "type": "Chocolate" }
					]
			},
		"topping":
			[
				{ "id": "5001", "type": "None" },
				{ "id": "5002", "type": "Glazed" }
			]
  }
]

  1. Wenn Sie alle Typen aus dem 'batter' erhalten und als Ergebnisvariable 'types' speichern möchten, müssen Sie als Wert verwendenIf 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"}]
    (Wir verwenden *, um alle Typen zu erhalten. Verwenden Sie für eine bestimmte Position die Nummer anstelle von *)
    ErgebnisWe use * in order to get all types. For a specific position, use the number instead of *)
    result: {"types":["Regular","Chocolate"]}

  2. Wenn Sie die Typen jedes "Batters" abrufen und in verschiedenen Ergebnisvariablen speichern möchtenIf 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"}

  3. Wenn Sie das gesamte Objekt basierend auf einem bestimmten Wert erhalten möchten, z. B. 'SchokoladeIf you want to get the whole object based on a specific value e.x. 'Chocolate':
    [{path: "[0]['batters']['batter'][*][?(@.type == 'Chocolate')]", resultVariable: "res"}]
    Ergebnisresult: {"res":[{"id":"1002","type":"Chocolate"}]}