Scenario 2: Sending a POST request from a local JSON file - 6.1

Talend Components Reference Guide

Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
Data Governance
Data Quality and Preparation
Design and Development
Talend Studio

In this scenario, a four-component Job is used to read parameters from a given JSON file and send it in a POST request to a web site.

The JSON file to be used reads as follows:


From that file, tFileInputJSON reads the e parameter and its value hello and tHttpRequest sends the pair to, an URL provided for demonstration by an online programming community,

Note that the e parameter is required by

Linking the components

  1. In the Integration perspective of the Studio, create an empty Job, named httpRequestPostDemo for example, from the Job Designs node in the Repository tree view.

    For further information about how to create a Job, see the Talend Studio User Guide.

  2. Drop tFileInputJSON, tFileOutputDelimited, tHttpRequest and tLogRow onto the workspace.

  3. Connect tFileInputJSON to tHttpRequest using the Trigger > On Subjob Ok link.

  4. Connect the other components using the Row > Main link.

Reading the JSON file

  1. Double-click tFileInputJSON to open its Component view.

  2. Click the [...] button next to Edit schema to open the schema editor.

  3. Click the [+] button to add one row and name it, for example, to data.

  4. Click OK to validate these changes and accept the propagation prompted by the pop-up dialog box.

  5. In the File name field, browse, or enter the path to the source JSON file in which the parameter to be sent is stored.

  6. In the Mapping table, the data column you defined in the previous step in the component schema has been automatically added. In the JSONPath query column of this table, enter the JSON path, in double quotation marks, to extract the parameter to be sent. In this scenario, the path is echo[0].data.

Writing the parameter to a flat file

  1. Double-click tFileOutputDelimited to open its Component view.

  2. In the File name field, browse, or enter the path to the flat file in which you want to write the extracted parameter. This file will be created if it does not exist. In this example, it is C:/tmp/postParamsFile.txt.

Posting the parameter

  1. Double-click tHttpRequest to open its Component view.

  2. In the URI field, enter the server address to which the parameter is to be sent. In this scenario, it is

  3. From the Method list, select POST.

  4. In the Post parameters from file field, browse, or enter the path to the flat file that contains the parameter to be used. As defined earlier with the tFileOutputDelimited component, this path is C:/tmp/postParamsFile.txt.

Executing the Job

Press F6 to run this Job.

The tLogRow component is used to present the execution result of the Job.

Once done, the Run view is opened automatically, where you can check the execution result.

You can read that the site receiving the parameter returns answers.