cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic passing in REST API

Harsha3
New Contributor III

Hi ,

I was trying to invoke the REST API dynamically . Let me share my requirement , I have on REST API in place which gives certain information of each country with respect to the country_id . Each country_id is unique , so instead of placing the country_id all the time in a pipeline , I thought of getting it done by passing it from pipeline execute . However it throws error . Is there only a way to achieve this is by using query parameters?

image -Sample Rest

Sample harcoded API:

image

In the place of CID highlighted in yellow we have different unique values . Can I know is there any way to achieve this dynamically instead of changing that unique value every time after the previous execution .

Thanks

7 REPLIES 7

Deepti
New Contributor II

Hi, Do we have any updates on this query? I have a similar use case and would really appreciate any input here. Thanks!

Harsha3
New Contributor III

Hi Deepti,

Actually, in my case, I passed the country Id as a parameter to the child pipeline. I prepared a sheet (excel) containing the list of countries and the corresponding country Id. I loaded the sheet in the child pipeline’s file reader. In the parent pipeline, I specified all those countries in the ‘;’ separated format, so that during each run, the countries are passed into the child pipeline one by one.

Then I used the mapper and specified the REST API path. According to my use case, each time we need to change the country ID in the REST API depending on the upcoming country fed by the parent pipeline and this can be achieved using the normal mapping function.

Deepti
New Contributor II

Thanks, Harsha, for your response, but I didn’t really get the ‘;’ separated part you mentioned for the parent pipeline. Would it be possible for you to provide a pipeline snapshot for me to relate to in a better way? Thanks again!