Forum Discussion

Vikas2022's avatar
Vikas2022
New Contributor II
3 years ago

HTTP Client Snap - How to replace/override Raw entity value for next iteration (pagination)

Hello,

In Snaplogic I am connecting to Elasticsearch API 7.17 via Apikey using HTTP Client Snap to read aggregate data

Below are the settings of the Snap

Request Method: GET
URI: https://elasticsearch-instance/_search
Entity Type: raw
Raw Entity:
{
< JSON Request Body>
}

Has Next:
$entity[‘aggregations’][‘by_customer’][‘after_key’][‘by_customer’] !=null

So as shown above, I am checking in Has Next property if a value is not null only then go to the next iteration. Next URI property will remain the same as URI. However, the catch is for the next iteration I want to replace/override the Raw entity property of the Snap with a different < JSON Request Body> which will include dynamic value coming from $entity[‘aggregations’][‘by_customer’][‘after_key’][‘by_customer’]

How can I achieve the above?

Reference link from Elastic API for the pagination

@dmiller can you please help me

Thanks.