Selecting href based on rel value in Agillic connector using low-code builder

Summary

The user is working on building a connector for Agillic using the low-code builder. They are facing an issue where the API response includes a link object with different ‘rel’ values like ‘next’, ‘self’, etc. They are looking for a way to select the ‘href’ value based on the ‘rel’ value being ‘next’ using the low-code framework.


Question

Hi
I am working on building a connector for Agillic using the low-code builder. The API does not provide a direct path to the next page url but returns the following link object as part of the response:

        {
            "rel": "first",
            "href": "<https://api-eu1.agillic.net/recipients/?documentId=DJYsN5gtSz&amp;pageStart=1&amp;pageSize=1000>"
        },
        {
            "rel": "self",
            "href": "<https://api-eu1.agillic.net/recipients/?documentId=DJYsN5gtSz&amp;pageStart=1&amp;pageSize=1000>"
        },
        {
            "rel": "next",
            "href": "<https://api-eu1.agillic.net/recipients/?documentId=DJYsN5gtSz&amp;pageStart=1001&amp;pageSize=1000>"
        },
        {
            "rel": "last",
            "href": "<https://api-eu1.agillic.net/recipients/?documentId=DJYsN5gtSz&amp;pageStart=176&amp;pageSize=1000>"
        }
    ],```
Are there any way to select the href of the object where rel = next using the low-code framework?

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C027KKE4BCZ/p1709310303956029) if you want to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["agillic-connector", "low-code-builder", "api-response", "link-object", "rel-value", "href-value"]
</sub>

New message text here

Is link rel next always the third object in the array? Then I think you can index into it. Otherwise, we’d have to build a conditional / predicate filter to get to the next page token. An issue requesting this would be very welcome.

It is the third element on the first call and the 4th on the next pages.

I ended up solving it by reconstructing the next page path using the following jinja code:
{{ response['links'][2]['href'].split('?')[0]~'?'~response['links'][2]['href'].split('?')[1].split('&amp;')[0] ~'&amp;pageStart='~(response['page']['number']*response['page']['size']+1)}}
With the following stop condition:
{{ response['page']['number'] &gt;= response['page']['totalPages'] }}

The main thing I needed to extract was the documentId, which is the same for all of the links and is needed in the next requests.

I was then able to use the page object in the response to add the page start parameter