[resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

One Star

[resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Hello everyone,
I would like to create a job that will allow me to extract data from a table based on the value of a parameter passed as input.
For example, I have a table "T_client" with the following fields: code_cli, nom_cli, pren_cli, and I would like to display the table data based on the value of code_cli that is input.
My problem is to be able to:
  - Write the query in the tOracleInput;
  - Set the component tRESTRequest at the "REST API Mapping";
  - And test the job at the endpoint according code_cli that I have input.

I Thank You in advance for your assistance will be greatly appreciated because I'm stuck.

Accepted Solutions
Community Manager

Re: [resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Hi 
tRestResponse returns a document, so I used a tXMLMap to build the document structure. About the HTTP verb, it is just a sample here, you can use the Get method. 

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post


All Replies
Community Manager

Re: [resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Hi 
On tRestRequest, define a parameter as shown below:

Then, you are able to define a dynamic query on tOracleInput to select the data that is based on the input value of code_cli, eg;
"select code_cli, nom_cli,pren_cli from table where code_cli="+(Integer)globalMap.get("s.code_cli")

Using a tRestClient to call the rest web service in a Talend job, and pass a value as input parameter.

Hope this gives you hints to finish your job. 
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Shong, thank you for your reply

I want to know how did you set the component tXMLMAP_1 and why did you use the POST method for extraction of data? because according to what I read is the GET method is used for extractions.

Thank you to enlighten me.
Community Manager

Re: [resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Hi 
tRestResponse returns a document, so I used a tXMLMap to build the document structure. About the HTTP verb, it is just a sample here, you can use the Get method. 

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post

One Star

Re: [resolved] Retrieves data from a table with tRESTRequest and tRESTResponse

Shong, thank you for your reply,

Please, can you show me the setting of tXMLMap in a picture as you done it for the tRESTRequest in your first response. It's will greatly help me. (I'm a new user of talend esb open studio)

Best regards

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read