Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRestClient - GET - using parameters

Hello All,

I am stuck with a scenario where I use Talend rest API [ POST ] to run a different job and in response it gets 2 attributes in json  run_id and number_in_job.

 

Now, I need to take the run_id number and invoke a API GET call to see the job result [ Success or Failure ] .

 

I know the URL for POST and GET.

 

How can I integrate API request [POST} and API [GET] to see the final output.

 

Thanks

Sathya

 

Labels (4)
8 Replies
vapukov
Master II
Master II

Hi Sathya

 

call the first API, use tExtractJSONFields  to extract values from response JSON, store it to variable

use this variable in 2nd subjob to 2nd API call

Anonymous
Not applicable
Author

Hi Vapukov,

 

Thanks for your response. Can you please explain me a bit as I am very new to ETL  world.

 

I am trying as in the attached pic.

 

I a using tRest with POST to trigger a job and in response I am getting {"run_id":96,"number_in_job":20}

 

I need to use the "run_id":96 in another GET API to see the result.

 

GET API :- https://abc.net/api/2.0/job/runs/get?run_id=96

Thanks for helping

Sathya


pics1.PNG
Anonymous
Not applicable
Author

Given the JSON you are receiving back, you need to configure your tExtractJsonFields component as in this image....

 

0683p000009M2gW.png

Your "JSON Field" value will be the output String column of your tRest component. If you configure the tExtractJsonFields component as above, it will output the values held in the JSON. Then you need to create your URL for your next API call using String concatenation.

vapukov
Master II
Master II


@thinksathya wrote:

Hi Vapukov,

 

Thanks for your response. Can you please explain me a bit as I am very new to ETL  world.

 

I am trying as in the attached pic.

 

I a using tRest with POST to trigger a job and in response I am getting {"run_id":96,"number_in_job":20}

 

I need to use the "run_id":96 in another GET API to see the result.

 

GET API :- https://abc.net/api/2.0/job/runs/get?run_id=96

Thanks for helping

Sathya


as showing by @rhall 

 

first, you need to extract JSON

then you could use this column value in next component

Anonymous
Not applicable
Author

Sorry @vapukov, I wasn't meaning to steal your thunder. I thought you might be asleep now 🙂

vapukov
Master II
Master II

this is global resource - "The early bird catches the worm" 🙂

Anonymous
Not applicable
Author

Hi,

 

Thanks for your response. I tried the same but couldn't achieve what I need. Attached the snapshot of what I have done in the name 1,2 and 3.png.

 

I can see the job is running but I can't see the output from the GET API.

 

Thanks

Sathya


1.PNG
2.PNG
3.PNG
vapukov
Master II
Master II

you need to use different connections between components 

0683p000009M2iD.png

Iterate in your case does not transfer the value but do the loop only

 

and in 2nd tRESTClient, you need variable stored by iFlowToIterate, by default, it will be 

(String)globalMap.get("row2.run_id")

row2 - it is name of input connection line for tFlowToIterate, 

 

 

tJavaFlex - do nothing, empty