# tRESTClient

Interacts with RESTful Web service providers by sending HTTP and HTTPS requests using CXF (JAX-RS) getting the corresponding responses.

This component integrates well with *Talend Runtime* to get HTTPS support, with more QoS features to be supported in time.

This component is not shipped with your Talend Studio by default. You need to install it using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

## tRESTClient Standard properties

These properties are used to configure tRESTClient running in the Standard Job framework.

The Standard tRESTClient component belongs to the ESB family.

The component in this framework is available in all Talend products.

## Basic settings

| Properties | Description |
| --- | --- |
| URL | Type in the URL address of the REST server to be invoked. When<br>the Use Service Locator<br>check box is selected, this field will not show and the URL<br>of the REST server will be obtained from the Service Locatorserver automatically. |
| Relative Path | Enter the relative path of the REST server to be invoked.<br><br>For example, if you want to access<br>http://localhost:8888/services/Customers/list:<br><br>If Use Service Locator<br>is disabled: You can enter any of the first part of the<br>address in the URL field, and the second<br>part in the Relative Path field. For<br>example, you can enter http://localhost:8888 in<br>URL and /services/Customers/list in Relative<br>Path. You can also enter the full path of the REST server in<br>URL and leave Relative Path blank.<br><br>If Use Service Locator<br>is enabled: The URL<br>part will be given by the Service Locator. In this case, you need to know the URL part, and specify the rest part in Relative Path. This depends on the service you<br>request. For example, on tRESTRequest,<br>you specify REST Endpoint as http://localhost:8888/services and enable<br>Use Service Locator. Then, if you<br>want to use this service, on tRESTClient<br>side, you should specify /customers/list<br>in Relative Path.<br><br>Information noteWarning: When using relative path, you should specify at least one sub-directory in<br>the URL field instead of only<br>host:port to avoid compiling issues. For example, use<br>http://localhost:8888/services instead of<br>http://localhost:8888. |
| HTTP Method | From this list, select an HTTP method that describes the desired<br>action. The specific meanings of the HTTP methods are subject to<br>definitions of your Web service provider. Listed below are the generally<br>accepted HTTP method definitions:<br><br><br>- GET: retrieves data from the server<br>end based on the given parameters.<br><br><br>- POST: uploads data to the server end<br>based on the given parameters.<br><br><br>- PUT: updates data based on the given<br>parameters, or if the data does not exist, creates it.<br><br><br>- PATCH: modifies data partially based<br>on the given parameters.<br><br><br>- DELETE: removes data based on the<br>given parameters. |
| Content Type | Select XML, JSON, or FORM according<br>to the media type of the content to be uploaded to the server end.<br><br>This list appears only when you select the POST, PUT, or PATCH HTTP method. |
| Accept Type | Select the media type the client end is prepared to accept for the<br>response from the server end.<br><br>Available options are XML, JSON, and ANY. When ANY is<br>selected, the response message can be of any type and will be<br>transformed into a string. |
| Query parameters | Specify the URI query parameters in the form of name-value pairs.<br><br>This option is mostly used with the GET method. |
| Schema and Edit<br>Schema | A schema is a row description, it defines the number of fields that<br>will be processed and passed on to the next component.<br><br>This component uses three built-in, read-only schemas.<br><br>Click Edit Schema to view the schema<br>structure.<br><br>Information noteWarning:<br><br><br>*Changing the schema type may result in loss of the schema<br>structure and therefore failure of the component.* |
| Input Schema | Schema for the input data. This schema contains two columns:<br><br>- body: stores the content of<br>structured input data<br><br>- string: stores the input content<br>when it is, or is handled as, a string. |
| Response Schema | Schema for server response. This schema is passed onto the next<br>component via a Row &gt; Response link, and it contains three<br>columns:<br><br>- statusCode: stores the HTTP status<br>code from the server end.<br><br>- body: stores the content of a<br>structured response from the server end.<br><br>- string: stores the response content<br>from the server end when it is, or is handled as, a string. |
| Error Schema | Schema for error information. This schema is passed onto the next<br>component via a Row &gt; Error link, and it contains two<br>columns:<br><br>- errorCode: stores the HTTP status<br>code from the server end when an error occurs during the invocation<br>process. The specific meanings of the errors codes are subject to<br>definitions of your Web service provider. For reference information,<br>visit http://en.wikipedia.org/wiki/List\_of\_HTTP\_status\_codes.<br><br>- errorMessage: stores the error<br>message corresponding the error code. |
| Use Service Locator | Select this check box to enable the Service Locator. It maintains the availability of the service to help meet demands and service<br>level agreements (SLAs). Specify the Service namespace and the Service name in the<br>corresponding fields. |
| Use Service Activity Monitor | Select this check box to enable the Service Activity<br>Monitor. It captures events and stores this information to facilitate<br>in-depth analysis of service activity and track-and-trace of messages<br>throughout a business transaction. This can be used to analyze service<br>response times, identify traffic patterns, perform root cause analysis and<br>more. |
| Use Authentication | Select this check box if authentication is required on<br>the REST server end. Select the authentication type from:<br><br><ul> <li> <span>Basic HTTP</span>: Fill the									<span>Username</span> and									<span>Password</span> fields with your								credentials.</li> <li> <span>HTTP Digest</span>: Fill the									<span>Username</span> and									<span>Password</span> fields with your								credentials.</li> <li> <span>SAML Token (ESB runtime only)</span>: Fill the									<span>Username</span> and									<span>Password</span> fields with your								credentials.</li> <li> <span>OAuth2 Bearer</span>: Fill the <span>Bearer									Token</span> field with a base64-encoded credential								string.</li> <li> <span>Open ID Connect</span>: Fill the                           <span>Username</span> and <span>Password</span>                        fields with your credentials. For more information, see <a href="https://help.qlik.com/talend/r/en-US/8.0/esb-infra-services-configuration-guide/talend-identity-and-access-management" target="_blank">Talend Identity and Access Management</a> and <a href="https://help.qlik.com/talend/r/en-US/8.0/administration-center-user-guide/managing-esb-resources-and-authorizations" target="_blank">Managing ESB Resources and authorizations</a>.</li> </ul><br><br>To enter the password, click the [...] button<br>next to the password field, enter the password in double quotes in the pop-up dialog box,<br>and click OK to save the settings. |
| Use Authorization | Select this check box to enable authorized call. Specify the client's<br>role in the Role field. This option<br>appears when SAML Token (ESB runtime<br>only) is selected in the Use<br>Authentication list.<br><br>For more information about the management of user roles and rights,<br>see [Managing ESB Resources and authorizations](https://help.qlik.com/talend/r/en-US/8.0/administration-center-user-guide/managing-esb-resources-and-authorizations) and [Talend Identity and Access Management](https://help.qlik.com/talend/r/en-US/8.0/esb-infra-services-configuration-guide/talend-identity-and-access-management). |
| Use Business Correlation | Select this check box to create a correlation ID in this<br>component.<br><br>You can specify a correlation ID in the Correlation Value field. In this case the correlation ID<br>will be passed on to the service it calls so that chained service calls<br>will be grouped under this correlation ID. If you leave this field<br>empty, this value will be generated automatically at runtime.<br><br>When this option is enabled, tRESTClient will also extract the correlation ID from<br>the response header and store it in the component variable for further<br>use in the flow. |
| Check Server Identity | Select this check box to verify the match between the hostname of the URL and<br>the Common Name (CN) on the server certificate. If they mismatch, an error<br>java.io.IOException: HTTPS hostname wrong will be<br>returned. |
| Re-use SSL connection | This option is disabled by default. When enabled, if the same server is called<br>multiple times in a Job, SSL configuration will be created once and reused for<br>every other calls.<br><br>Note that this option does not support having query parameters set in the<br>URL or Relative Path fields.<br>To have this option working correctly, all query parameters must be added to<br>the Query parameters table. |
| Die on error | This check box is selected to kill the Job when an error<br>occurs. Clear the check box to skip the row on error and complete the<br>process for error-free rows. |

## Advanced settings

| Properties | Description |
| --- | --- |
| Log messages | Select this check box to log the message exchange between the service<br>provider and the consumer. |
| Follow redirects | Select this check box to follow auto-redirects. |
| Allow non-same host redirects | This option appears when Follow redirects is enabled.<br>Select this check box to allow redirects on different host. |
| Maintain session | This option appears when Follow redirects is enabled.<br>Select this check box to enable sharing session cookies in case of multiple<br>redirects. Session cookies will be collected and available for further<br>processing in the same way as other cookies after message exchange is<br>finished.<br><br>Information noteNote: This option is available only if you have installed the<br>R2022-12 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator. |
| Enable WebClient Operation Reporting | If this check box is selected, a CXF endpoint property will be set on<br>the client side which may be used by some outgoing CXF metrics<br>interceptors, to track requests to services using their URL's.<br><br>The property set is<br>org.apache.cxf.resource.operation.name and it contains<br>service URL together with the HTTP method name, for example<br>GET:http: //example.com:8080/service/.<br><br>If this check box is not selected, the property will not be set and<br>some metrics will not be counted, which may increase the<br>performance. |
| Convert Response To DOM Document | Select this check box to convert the response from the server to<br>document type.<br><br>Clear this check box if you want the response to be handled as a<br>string. |
| Convert Types To Strings | This option appears when Content Type<br>is JSON, or Accept Type is JSON or<br>any. Select this check box to<br>convert all values in JSON to string<br>between quotation marks. For example, with this option enabled, the JSON<br>data:<br><br>```<br>"root": {<br>"test": 111<br>}<br>```<br><br>will be changed to:<br><br>```<br>"root": {<br>"test": "111"<br>}<br>``` |
| Drop JSON Request Root | This option appears when HTTP Method<br>is POST, PUT or PATCH and<br>Content Type is JSON. Select this check box to drop root JSON<br>elements. |
| Wrap JSON Response | This option appears and is enabled by default when JSON is selected from the Accept Type list in the Basic settings view.<br><br>With this check box selected, the response is wrapped with a *root* element. Clear this check box to<br>remove the *root* element from the<br>response. |
| Force HTTP version to 1.1 | tRESTClient uses HTTP version 1.2 by default. Select<br>this check box to enable version 1.1 if the target HTTP server only supports<br>HTTP 1.1.<br><br>Information noteNote: This option is available only if you have installed<br>the R2025-06 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator. |
| HTTP Headers | Type in the name-value pair(s) for HTTP headers to define the<br>parameters of the requested HTTP operation.<br><br>For the specific definitions of HTTP headers, consult your REST Web<br>service provider. For reference information, visit http://en.wikipedia.org/wiki/List\_of\_HTTP\_headers. |
| Disable chunked encoding | This option appears when HTTP Method<br>is POST, PUT or PATCH. Select<br>this check box to disable encoding the payload as chunks. |
| Service Locator Customer Properties | This option appears when Use Service Locator<br>is enabled in the Basic<br>settings tab. Click [+] to<br>add as many properties as needed to the table. Enter the name and the value of<br>each property in the Property Name field<br>and the Property Value field respectively<br>to identify the service. |
| Service Activity Customer Properties | This option appears when Use Service<br>Activity Monitor is enabled in the Basic settings tab. Click [+] to add as many properties as needed to the table. Enter<br>the name and the value of each property in the Property Name field and the Property<br>Value field respectively to identify the service. |
| Connection timeout | Set the amount of time, in seconds, that the client will<br>attempt to establish a connection before it times out. If set to *0*, the client will continue to attempt to open a<br>connection indefinitely. (default: 30)<br><br>This option does not work in Talend Runtime. For ESB Deployments to Talend Runtime, this parameter will have no effect. In the configuration file &lt;TalendRuntimePath&gt;/container/etc/org.apache.cxf.http.conduits-common.cfg,<br>you need a URL which covers you service, for example, url = http://.\* to handle both HTTP and HTTPS requests, and<br>specify the client.ConnectionTimeout parameter<br>in milliseconds in this HTTP Conduit file. If you need to use the Receive timeout option, specify the client.ReceiveTimeout in milliseconds too. |
| Receive timeout | Set the amount of time, in seconds, that the client will wait for a response<br>before it times out. If set to *0*, the client will wait<br>indefinitely. (default: 60)<br><br>This option works similarly to the Connection timeout<br>option. For how to use it after the component is deployed in Talend Runtime, see the Connection timeout<br>option. |
| Use HTTP proxy | Select this check box if you are using a proxy server. Once<br>selected, you need to provide the connection details: host, port, username<br>and password. |
| tStatCatcher Statistics | Select this check box to gather the Job processing metadata<br>at the Job level as well as at each component level. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | NB\_LINE:<br>the number of rows processed. This is an After variable and it returns an integer.<br><br><br>HEADERS: the HTTP response<br>headers. This is a Flow variable and it returns a list of HTTP response header<br>values.<br><br><br>CORRELATION\_ID:<br>the correlation ID by which chained service calls will be grouped. This is a Flow<br>variable and it returns a string.<br><br><br>ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as a RESTful Web service client to communicate<br>with a RESTful service provider, with the ability to input a request to<br>a service into a Job and return the Job result as a service response.<br>Depending on the actions to perform, it usually works as a start or<br>middle component in a Job or subJob. |
| Dynamic settings | Click the [+] button to add a row in the<br>table and fill the Code field with a context<br>variable to turn on or off the Log messages, Use Authentication or Use<br>HTTP proxy option dynamically at runtime. You can add three rows<br>in the table to set all options.<br><br>Once a dynamic parameter is defined, the corresponding option becomes<br>highlighted and unusable in the Basic settings view<br>or Advanced settings view.<br><br>For examples on using dynamic parameters, see [Reading data from databases through<br>context-based dynamic connections](https://help.qlik.com/talend/r/en-US/8.0/components/defining-context-groups/reading-data-from-databases-through-context-based-dynamic-connections) and [Reading data from different MySQL databases<br>using dynamically loaded connection parameters](https://help.qlik.com/talend/r/en-US/8.0/components/context/reading-data-from-different-mysql-databases-using-dynamically-loaded-connection-parameters). For more information on<br>Dynamic settings and context variables, see<br>[Dynamic schema](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/dynamic-schema) and [Creating a context group and define context<br>variables in it](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/creating-context-group-and-define-context-variables-in-it). |
| Connections | Outgoing links:<br><br><br>Row: Response; Error.<br><br><br>Trigger: On Subjob Ok; On Subjob<br>Error; Run if; On Component Ok; On Component Error.<br><br>Incoming links:<br><br><br>Row: Main; Reject.<br><br><br>Trigger: Run if; On Subjob Ok; On<br>Subjob Error; On component Ok; On Component Error.<br><br>For further information regarding connections, see [Using connections in a Job](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/using-connections-in-job). |
| Limitation | Using context variables for dynamic endpoint or Service Locator namespace works in Talend Studio only. It is not supported in Talend Runtime. |

**Related concepts**

* [Building a JSON document with tXMLMap to call a REST service](https://help.qlik.com/talend/en-US/components/8.0/esb-rest/trestclient-txmlmap-tfileinputdelimited-tfileinputdelimited-building-json-document-with-txmlmap-to-call-rest-service-standard-component "This scenario describes how to build a JSON document with the tXMLMap component as input request for a REST call.")
* [Getting user information by interacting with a RESTful service](https://help.qlik.com/talend/en-US/components/8.0/esb-rest/trestclient-txmlmap-tlogrow-tlogrow-getting-user-information-by-interacting-with-restful-service-standard-component-this)
* [Using a REST service to accept HTTP POST requests and send responses](https://help.qlik.com/talend/en-US/components/8.0/esb-rest/trestrequest-trestclient-tlogrow-using-rest-service-to-accept-http-post-requests-and-send-responses-standard-component-esb-this)
* [Updating user information by interacting with a RESTful service](https://help.qlik.com/talend/en-US/components/8.0/esb-rest/trestclient-txmlmap-tfileinputdelimited-tfileinputdelimited-updating-user-information-by-interacting-with-restful-service-standard-component-this)
* [Using context variables in REST endpoint URLs in Data Services](https://help.qlik.com/talend/en-US/components/8.0/esb-rest/trestclient-using-context-variables-in-rest-endpoint-urls-in-data-services-context)