Four Stars

Ouptut to Web-API

Hello,

 

I have aJob in the Open Studio for Big Data, which reads content from a sourve, convert it, and finally i got the rows and put it in an mysql-Database with tMysqlOutput-component. Instead of this tMysqlOutput-compoment I want to put the content of the row as xml or json-String  to an Web-Url. I have tried the components tHttpRequest and tRest, but that is not the soulution: Post-Parameters for tHttpRequest has to come from a file, and the tRest-component cannot use the row data. 

 

Are there any output components which I can use?

 

Thanks for help and regards

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars

Re: Ouptut to Web-API

Use a tFlowToIterate and iterate from that. The your values for that iteration will be stored in the globalMap HashMap with the key "{rowname}.{columnname}" of the row going into the tFlowToIterate. So, as an example, if you have a row called row1 connecting to the tFlowToIterate and the row has 3 columns (col1 as a String, col2 as an Integer, and col3 as a Long), then you can access the values using the code below...

 

((String)globalMap.get("row1.col1"))
((Integer)globalMap.get("row1.col2"))
((Long)globalMap.get("row1.col3"))
Rilhia Solutions
4 REPLIES
Employee

Re: Ouptut to Web-API

We have tRestClient (for Rest) and tESBConsumer (for Soap) where you can pass an XML or JSON payload as a document to the component.  Check out their documentation on https://help.talend.com

Four Stars

Re: Ouptut to Web-API

Thanks for the tip. But with this component I have no Chance to connect from e.g. tFileInputExcel. My Idea was, send some data directly to a rest-URL And If i choose "iterate", i have no row- Variables, which i can use as parameter for the rest-url.

Possible some code in tjavarow may help, or is there a possible solution with tRest ?

 

Thanks for help and kind regards

Thomas

Twelve Stars

Re: Ouptut to Web-API

Use a tFlowToIterate and iterate from that. The your values for that iteration will be stored in the globalMap HashMap with the key "{rowname}.{columnname}" of the row going into the tFlowToIterate. So, as an example, if you have a row called row1 connecting to the tFlowToIterate and the row has 3 columns (col1 as a String, col2 as an Integer, and col3 as a Long), then you can access the values using the code below...

 

((String)globalMap.get("row1.col1"))
((Integer)globalMap.get("row1.col2"))
((Long)globalMap.get("row1.col3"))
Rilhia Solutions
Four Stars

Re: Ouptut to Web-API

Thats it! With this I can post the contents to the URL - Good solutions, which saves a lot of time. Thanks!

 

Regards

Thomas