Hi Team, I was working on low code connector and f...
# help-connector-development
s
Hi Team, I was working on low code connector and facing issue while stopping the loop for cursor based pagination using next link, any help would be appreciated.
Copy code
paginator:
        type: DefaultPaginator
        pagination_strategy:
          type: "CursorPagination"
          cursor_value: "{{ response.links.next }}"
          stop_condition: "{{ 'links' not in response }}"
k
A message from kapa.ai
It seems like you're trying to implement cursor-based pagination using the next link in the response. Based on the provided YAML configuration, you're using the
CursorPagination
strategy with a
stop_condition
. Here's the relevant extract from the documentation:
Copy code
yaml CursorPagination:     type: object     additionalProperties: true     required:     - cursor_value     properties:     "$parameters":     "$ref": "#/definitions/$parameters"     cursor_value:     type: string     stop_condition:     type: string     page_size:     type: integer
Source: [Pagination Strategies - Cursor](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/pagination#CursorPagination) To fix the issue with stopping the loop, you can try modifying the
stop_condition
to check if the
next
link is not present in the
response.links
object:
Copy code
yaml paginator:   type: DefaultPaginator   pagination_strategy:     type: "CursorPagination"     cursor_value: "{{ response.links.next }}"     stop_condition: "{{ 'next' not in response.links }}"
However, I cannot guarantee that this will work without knowing more about the API response structure. Make sure to adjust the
stop_condition
according to the actual response format.
j
@Shreepad Khandve what behavior are you seeing?
s
Loop is not stopping after no link found in response
j
how does the response look like? Is there actually no "links" property or is it null/empty string
Could you post a request/response example and the current state of your manifest?
s
There is no links property
j
Please post a request/response example and the current state of your manifest
s
below is the response with next link :
........
"options": {
"size": "multi"
}
}
}
]
},
"links": {
"next": "<https://iteratehq.com/api/v1/surveys/5d6e82a775********7ee1f/responses?access_token=************&page[cursor]=5d6f14e2b270******ab757d>"
}
}
and below is the last page where we dont get - links.next
"label": "Very low effort",
"value": "very-low-effort"
}
],
"labels": [
"Very high effort",
"High effort",
"Neither low nor high",
"Low effort",
"Very low effort"
],
"type": "custom"
}
}
}
]
}
}
j
It's hard to help you with these small snippets - could you post your full manifest? Also, how do you know that the pagination loop is not stopping?