With the ‘webservice’ block a connection to an external webservice can be created.
In the global settings you can define webservices.
Via the ‘Add new webservice’ button a new webservice can be added. Webservices previously added are displayed on this tab. The webservice can be edited and removed by clicking the gear icon.
N.B.: the webservice block is only available after a webservice is configured in the global settings.
Add Webservice
Settings
Provide the settings to add a new webservice.
Name | Unique name for the webservice. |
URL | The URL of the webservice. |
Method | Select the webservice method (GET, POST, PUT, DELETE, PATCH or HEAD). |
Authentication type | Specify the authentication type for the webservice (none, basic authentication, Oauth2 or HMAC (Hash based Message Authentication Code)). |
Allow test (optional) | Enable ‘test’ button in webservice block. N.B.: When using a post method, clicking the test button executes the webservice call. |
Additional settings for Body, Headers , Output and Advanced of the webservice block can be provided via the other tabs.
Body
Headers
Output
With the settings in the output tab, you choose which fields are retrieved for selection and output in campaign.
The mapping of the webservice block can be provided via the ‘Output’ tab.
In the first field, you can enter 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 expressie | The value of the column in the API response |
Key type | Define key type for 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.Eg: {{ select_json “$.name” }}.
Values with spaces can be retrieved with the following syntax: $.[‘value with space’].
Define multiple keys
Multiple keys can be defined in one webservice. By clicking on the key field you can mark a primary key.
N.B.: It is not necessary to define a primary key.
Advanced
With the ‘Advanced’ tab you choose between data enrichment or retrieve an entire dataset.
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 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}}.
Good to know
Generate a unique value
Generate on the fly a guid value in your output. Ideal when your response contains multiple rows with no unique value.
Use syntax {{ math.uuid }} to get the following as a result:
019b3dad-be25-4ce9-bfc5-6c3a956cbc61
027ec66e-8317-45b9-9ddc-89083b89a8df