Web service

The 'web service' block can be used to create a connection to an external web service.

In the general settings, web services can be defined.

Click the 'Add New Web Service' button to add a new web service. Web services that have been previously added are visible on this tab. The web service can be modified and deleted by clicking the gear icon.

Please note: that the web service block is only available after a web service has been configured in the general settings.


Add Web Service

Settings

Fill in the settings to add a new web service.


Name

Unique name of the web service.

URL

The URL for the web service.

Method

Select the web service method (GET, POST, PUT, DELETE, PATCH or HEAD).

Authentication type

Specify the type of authentication for the Web service (none, basic authentication, Oauth2 or HMAC (Hash based Message Authentication Code)).

Allowing testing (optional)

Switch 'test' button into a web service block.
Please note that when a POST method is used, the web service method is executed when the test button is clicked.

Additional settings of the web service block for Body, Headers, Output and Advanced can be set via the other tabs.

Body

Determine the content type.


Headers

Voeg headers toe.


Output

The settings in the output tab allow you to choose which fields will be retrieved for selection and output in campaign.
The mapping for the Web service block can be set through the 'Output' tab.


In the first field, you can give a name.
In the second field, depending on your output format, you can enter an XPath or JSON selector.

Add output

Column name

Name of column in campaign.

JSON/ XML path expression

The value of the column in the API response

Key type

Define key type for campaign

Please note: rows from the API response with a column length of more than 999 characters will not be processed in Ternair Campaign.

In case of a JSON selector, you can also use the following syntax: {{ select_json "JSON Path Expression" }}. This syntax supports the Scriban template language, for example: {{ select_json "$.name" }}.

Values with spaces can be retrieved with the following syntax: $.['value with space'].


Defining multiple keys

Multiple keys can be defined in one Web service. Clicking on the key field allows you to designate a master key.
Please note: Designating a master key is not necessary.


Advanced

The "Advanced" tab allows you to choose between data enrichment or retrieval of an entire data set.


Should the Web service response receive multiple records in a response body, you can break them down with an array expression. You can enter the path of the highest element containing a record here. If you want to retrieve the root, in the case of Json you can use $ , for xml you use "/".

If the web service needs to return multiple "pages", you can use the "Has pagination" option. With page number you can specify which range of pages should be retrieved. By default, this is 25 pages. Contact your consultant if this number is not sufficient. Page numbers start from 0. Page numbers can be used in the url or the supplied body by mapping them {{pagenumber}}. If you check the 'Stop at first blank page' option, pagination is stopped at the first blank page.

Good to know

Generate a unique value

Generate on the fly a guid value in your output. Ideal when your response contains multiple rows that do not contain a unique value.


Use syntax {{ math.uuid }} to get the following as the result:
019b3dad-be25-4ce9-bfc5-6c3a956cbc61
027ec66e-8317-45b9-9ddc-89083b89a8df




Copyright © 2025 Ternair.