aashu1807
aashu1807

Reputation: 202

How to change query parameter value of tRestClient

I am new in talend. I am working on this from last 2 days but not able to do it. I want to consume api data into my database. I have this api =>
http://api.dss.adapt-odisha.com/aagro?url=https://mausam.imd.gov.in/api/nowcast_district_api.php

which giving me data of all districts. I am able to consume all district data, but my requirement is, i want to load data of for few districts and my url supports only one district id as query parameter like this=>

 http://api.dss.adapt-odisha.com/aagro?url=https://mausam.imd.gov.in/api/nowcast_district_api.php?id=204

and like this

http://api.dss.adapt-odisha.com/aagro?url=https://mausam.imd.gov.in/api/nowcast_district_api.php?id=215

these url showing data of only that district which i passed in query parameter. I am able to consume all district data, but i want to store data of these districts only. How can i achieve it?
i have tried this till now:

enter image description here

Upvotes: 1

Views: 1159

Answers (1)

Corentin
Corentin

Reputation: 2552

You are almost there ! What you need to do is to build a list of district that you want to get (here I put a tFixedFlow with fixed value, but you could have a file, a DB query, etc).

enter image description here

Pass this to a tFlowToIterate, this will allow you to iterate over the district list : there will be an API call for each district in your list. Configure the 2d tFixedFlow to retrieve the current district from tFlowToIterate : enter image description here Adapt the tRestClientUrl like this :

"http://api.dss.adapt-odisha.com/aagro?url=https://mausam.imd.gov.in/api/nowcast_district_api.php?id="+row2.district

Upvotes: 1

Related Questions