[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.
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.
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
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.
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.
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)