Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen

Function

This object is used to make a REST call to a web service.

Info
titleProgramming Experience Required

Note: you will require programming experience to use this object. jtel does not provide developer support as part of the standard support contract.

The object can perform the following type of REST calls:

  • GET
  • POST
  • PUT
  • DELETE

It is possible to specify parameters, which are coded in the URL. Also it is possible to specify additional headers which will be sent with the http headers when the REST call is made.

When POST or PUT operations are performed, data can be specified which is sent in the content of the http request.

When the call returns, the headers from the response are provided as variables which can be used in the application at a later step. The response body is parsed if valid XML or JSON, and is also provided as variables. It is possible to specify a prefix for the result (which includes the headers), and a separate prefix for the content variables provided.

Parameters

ParameterPurpose

Object Name

The name of this object instance

Request Method

Choose the http request method to be used. GET, POST, PUT and DELETE are supported.

Headers

Any number of headers can be specified and will be sent with the http request.

Headers must be specified separated by \n, if more than one header will be used.

For example:

my-header-1: value1\n
my-header-2: value2
Parameters

Parameters are passed at the end the URL, in the form:

http(s)://url?param1=value1&param2=value2

The parameters will automatically be URL encoded as required.

DataData is only required for POST or PUT operations. The data is passed as defined by the Content-Type parameter.
Content-Type

This parameter is passed as the http header "Content-Type", and defines how the data included in the POST or PUT request will be encoded.

Currently supported are:

application/json
application/x-www-form-urlencoded
text/plain
text/xml
Variable Prefix Content

If the web service returns content with the http response, then this will be provided as follows:

  • In the variable:

    $<VariablePrefixContent>.responseData
  • If valid XML, then as variables of the form:

    $<VariablePrefixContent>.xmlStructure.xmlFieldName

  • If valid JSON, then as variables of the form:

    $<VariablePrefixContent>.jsonStructure.jsonFieldName

The exact format provided will depend on the exact structure returned. You should use the Variable Dump Object to examine the exact variables which are parsed.


Example:

ItemValue
Variable Prefix Content
myContent
Returned Content
{ "token": "QpwL5tke4Pnpja7X" }
Provided Variables
$myContent.responseData = { "token": "QpwL5tke4Pnpja7X" }
$myContent.token = QpwL5tke4Pnpja7X

Variable Prefix Result

The headers and the http status line and status code are stored in variables prefixed with the value provided here.

The following variables are provided automatically (assuming a valid http response):

  • $<VariablePrefixResult>.httpResponseCode - the http response code
  • $<VariablePrefixResult>.httpResponse - the http response line

Example:

ItemValue
Variable Prefix Result
myResult
http Status Line
HTTP/2 200 OK
Headers
content-type: application/json; charset=utf-8
set-cookie: __cfduid=d071fc20b4ada453375f3189252f1559d1556981085; expires=Sun, 03-May-20 14:44:45 GMT; path=/; domain=.test.com; HttpOnly
Provided Variables
$myResult.httpResponseCode = 200
$myResult.httpResponse = HTTP/2 200 OK
$myResult.content-type = application/json; charset=utf-8
$myResult.set-cookie = __cfduid=d071fc20b4ada453375f3189252f1559d1556981085; expires=Sun, 03-May-20 14:44:45 GMT; path=/; domain=.test.com; HttpOnly


Outputs

Output

Used when ...

Continue

A record is found

Not FoundNo record for the specified caller was found using the criteria specified (ACD groups and time period)
ErrorAn error occurred. This is most likely due to the incorrect specification of the ACD groups - either missing commas at the relevant positions, or specifying variables which could not be evaluated.

Variables Provided

Prefix is replaced with the prefix specified in the object definition.

Variable

Contains

resultPrefix.httpResponseCode

The http response code.

resultPrefix.httpResponse

The http response.

resultPrefix.responseDataThe http content.
resultPrefix.*

Other http headers provided by the web service.

contentPrefix.*Parsed variables from a valid JSON or XML response.

Release

Status
colourGreen
title3.14 FROM 04.05.2019

Sv translation
languagede

Funktion

Dieses Objekt wird verwendet, um einen REST-Anruf an einen Webdienst durchzuführen.

Info
titleProgrammiererfahrung erforderlich

Hinweis: Für die Verwendung dieses Objekts benötigen Sie Programmiererfahrung. jtel bietet im Rahmen des Standard-Supportvertrags keinen Entwickler-Support.

Das Objekt kann folgende Arten von REST-Anrufen durchführen:

  • GET
  • POST
  • PUT
  • DELETE

Es ist möglich, Parameter anzugeben, die in der URL kodiert sind. Es ist auch möglich, zusätzliche Header anzugeben, die mit den http-Headern gesendet werden, wenn der REST-Anruf erfolgt.

Wenn POST- oder PUT-Operationen durchgeführt werden, können Daten angegeben werden, die im Inhalt der http-Anforderung gesendet werden.

Wenn der Aufruf zurückkehrt, werden die Header aus der Antwort als Variablen bereitgestellt, die dann in einem späteren Schritt in der Anwendung verwendet werden können. Der Antwortkörper wird geparst, wenn XML oder JSON gültig ist, und wird ebenfalls als Variablen bereitgestellt. Es ist möglich, ein Präfix für das Ergebnis (das die Kopfzeilen enthält) und ein separates Präfix für die bereitgestellten Inhaltsvariablen anzugeben.

Parameter

ParameterZweck

Objekt Name

Der Name dieser Objektinstanz

Anfragemethode

Wählen Sie die zu verwendende http-Anforderungsmethode. GET, POST, PUT und DELETE werden unterstützt.

Header

Eine beliebige Anzahl von Headern kann angegeben werden und wird mit der http-Anfrage mitgeschickt.

Header müssen durch \n getrennt angegeben werden, wenn mehr als ein Header verwendet werden soll.

Zum Beispiel:

my-header-1: value1\n
my-header-2: value2
Parameter

Parameter werden am Ende der URL in dieser Form übergeben:

http(s)://url?param1=value1&param2=value2

Die Parameter werden je nach Bedarf automatisch URL-kodiert.

DatenDaten sind nur für POST- oder PUT-Operationen erforderlich. Die Daten werden, wie durch den "Content-Type" Parameter definiert, übergeben.
Content-Type

Dieser Parameter wird als http-Header "Content-Type" übergeben und definiert, wie die in der POST- oder PUT-Anforderung enthaltenen Daten kodiert werden.

Derzeit unterstützt werden:

application/json
application/x-www-form-urlencoded
text/plain
text/xml
Variablenpräfix Inhalt

Wenn der Webdienst Inhalte mit der http-Antwort zurückgibt, dann werden diese wie folgt bereitgestellt:

  • In der Variable:

    $<VariablePrefixContent>.responseData
  • Wenn gültiges XML, dann als Variablen in der Form:

    $<VariablePrefixContent>.xmlStructure.xmlFieldName

  • Wenn gültig JSON, dann als Variablen in der Form

    $<VariablePrefixContent>.jsonStructure.jsonFieldName

Das genaue Format hängt von der genauen zurückgegebenen Struktur ab. Sie sollten das Variablen-Dump-Objekt verwenden, um die genauen Variablen zu untersuchen, die geparst werden.


Beispiel:

ItemValue
Variablenpräfix Inhalt
myContent
Zurückgegebener Inhalt
{ "token": "QpwL5tke4Pnpja7X" }
Gegebene Variablen
$myContent.responseData = { "token": "QpwL5tke4Pnpja7X" }
$myContent.token = QpwL5tke4Pnpja7X

Variablenpräfix Ergebnis

Die Kopfzeilen sowie die http-Statuszeile und der Statuscode sind in Variablen gespeichert, denen der hier angegebene Wert vorangestellt wird.

Die folgenden Variablen werden automatisch bereitgestellt (unter der Annahme einer gültigen http-Antwort):

  • $<VariablePrefixResult>.httpResponseCode - der http Antwort Code
  • $<VariablePrefixResult>.httpResponse - die http Antwort Zeile

Beispiel:

ItemValue
Variablenpräfix Ergebnis
myResult
http Status Zeile
HTTP/2 200 OK
Header
content-type: application/json; charset=utf-8
set-cookie: __cfduid=d071fc20b4ada453375f3189252f1559d1556981085; expires=Sun, 03-May-20 14:44:45 GMT; path=/; domain=.test.com; HttpOnly
Gegebene Variablen
$myResult.httpResponseCode = 200
$myResult.httpResponse = HTTP/2 200 OK
$myResult.content-type = application/json; charset=utf-8
$myResult.set-cookie = __cfduid=d071fc20b4ada453375f3189252f1559d1556981085; expires=Sun, 03-May-20 14:44:45 GMT; path=/; domain=.test.com; HttpOnly


Outputs

Output

Used when ...

200 OK

Ein Datensatz wird gefunden

SonstigesEs wurde kein Datensatz für den angegebenen Anrufer unter Verwendung der angegebenen Kriterien (ACD-Gruppen und Zeitraum) gefunden
FehlerEs ist ein Fehler aufgetreten. Dies ist höchstwahrscheinlich auf die falsche Angabe der ACD-Gruppen zurückzuführen - entweder fehlende Kommas an den entsprechenden Stellen oder die Angabe von Variablen, die nicht ausgewertet werden konnten.

Gegebene Variablen

Präfix wird durch das in der Objektdefinition angegebene Präfix ersetzt.

Variable

Contains

resultPrefix.httpResponseCode

Der http-Antwort-Code.

resultPrefix.httpResponse

Die http-Antwort.

resultPrefix.responseDataDer http-Inhalt.
resultPrefix.*

Andere http-Header, die vom Webdienst zur Verfügung gestellt werden.

contentPrefix.*Gepartete Variablen aus einer gültigen JSON- oder XML-Antwort.

Release

Status
colourGreen
title3.14 ab 04.05.2019