cancel
Showing results for 
Search instead for 
Did you mean: 

How to get response value and pass it to parameter for next run

mayur_vaikar
New Contributor

Hi All,

I have an API where I am passing a parameter called changenumber as below

https://stg.integration-platform.medi-map.co.nz/fhir/MedicationAdministration?change-number=1711209

Once the call is made, it returns data with change number greater than 1711209. It returns around 100 records per run.

I need to pass the last change number from the response to the new call I make. Lets say the last record had a change number 1711308. This needs to be the parameter of the new call.

How can this be achieved.

TIA.

Mayur

3 REPLIES 3

ddellsperger
Employee
Employee

You'll probably want to use the HTTP Client with the same (or similar) settings to the following. This actually supports pagination (which is effectively what this call stack is) the things you'll want to look out for in the pagination section are:

  1. The Has Next property should likely be used to determine if you have the expected number of results in the page and continue to paging if you've maxed out the results
  2. If you want to limit the number of pages, use Total pages to fetch and that will cap the number of pages it will request
  3. You'll want to check the "Reuse request parameters" and override just the change-number and that override value will depend on how the resulting data comes back, but if the entity is an array, you can use :$entity.slice(-1).changeNumber or wherever the change number that you want to reference is located within that last element, .slice(-1) gets you the last element in that array.

ddellsperger_0-1697674868769.png

 

Thanks for the reply. But I am not sure of the expression that needs to be used for the Override parameter. 

 

It will depend on what the output of your document looks like, the parameters in that section will be able to reference fields in the output document (as opposed to the input document in most fields) to get the values, so you'd have to look at where in the output document the data you need to determine your data for the next page would be.