Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
somersst
Contributor III
Contributor III

How to include input in response from tRestClient

I have a delimited file of following format

Id, Location

x,y

This is used as input for a tRestClient-call where location is used as parameter

How can I achieve that in the response, I also can get the value of the id-column? Now I can only parse the xml-file but I cannot relate it to the correct id, which I need to be able to update the record.

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable

You need to iterate the input so that you are able to access the value of id-column later, eg:

tFileInputDelimited--main--tFlowToIterate--iterate--tRestClient--tMap-->bababa

on tMap, add a new column called Id, set its value as below to get the current Id value.

(String)globalMap.get("row1.Id")

//for string type.

(Integer)globalMap.get("row1.Id")

//for int type.

 

Regards

Shong

View solution in original post

5 Replies
Anonymous
Not applicable

You need to iterate the input so that you are able to access the value of id-column later, eg:

tFileInputDelimited--main--tFlowToIterate--iterate--tRestClient--tMap-->bababa

on tMap, add a new column called Id, set its value as below to get the current Id value.

(String)globalMap.get("row1.Id")

//for string type.

(Integer)globalMap.get("row1.Id")

//for int type.

 

Regards

Shong

Cherichoc-
Creator
Creator

But tFlowIterate cant interate to tRestClient

ShZ
Contributor II
Contributor II

Hi,

 

Sorry to dig this topic up but I need to do the same as somersst who opened that topic.

I got a list of ids in my input file and I want to get a value from an API call response. My goal is to have the matching between my source id and the value the API provides me.

 

To do so, I did :

 

tFileInputDelimited - Main - tFlowToIterate - Iterate - tJavaFlex - Main - tRESTClient - tExtractJSON - tMap - tLogRow

 

In my tMap, I created a field and set its value like this : (String)globalMap.get("row12.fieldName") 

 

As far as I can see in my tLogRow component, the field I created is empty but the data coming from my REST API call is correctly set.

 

Any idea ?

 

Thanks.

Anonymous
Not applicable

@Sébastien HEITZ​ , double check your expression

(String)globalMap.get("row12.fieldName")

 

here row12 is the row number before tFlowToIterate in your case, fieldName is the column name defined on tFileInputDelimited's schema.

 

ShZ
Contributor II
Contributor II

Hi,

 

Thank you, my field name was correct I just replaced it when I posted but I was using the wrong row (the one after the tFlowToIterate component).