Hi, I'm using the UI builder to create a new Graph...
# ask-ai
s
Hi, I'm using the UI builder to create a new GraphQL source connector and have a pagination question. I need to add a variable to my GraphQL query that should only be populated starting from the second iteration (i.e., the first request shouldn't include this variable, but subsequent paginated requests should). This means I need to conditionally modify the GraphQL query based on the pagination state. Is this possible with the current UI builder? If so, could you point me toward the right approach? Thanks!
k
Based on the available knowledge sources, the Airbyte UI Connector Builder does not natively support conditional injection of variables into a request body or query—such as only including a variable in your GraphQL query starting from the second request—using the standard pagination or parameter injection options. However, there is a documented workaround for APIs with special requirements: you can disable the default injection options and use the generic parameter section at the bottom of the stream configuration form. This section allows you to use Jinja expressions and available variables (like next_page_token) to dynamically construct query parameters, headers, or body properties. This approach is typically used for REST APIs, but the same principle may be adapted for GraphQL if your query can be templated with Jinja. For example, you could use a Jinja expression to conditionally include a variable based on the presence of a pagination token:
Copy code
jinja {   "query": "...",   "variables": {     {% if next_page_token %}       "cursor": "{{ next_page_token }}"     {% endif %}   } }
This would only include the "cursor" variable in the request if next_page_token is set (i.e., on paginated requests after the first one). You can find more about this approach in the documentation under "Custom parameter injection" for the Connector Builder UI, which describes how to use Jinja and available variables to handle cases where conditional logic is needed in request construction. If the UI does not provide enough flexibility for your use case, you may need to use the low-code or Python CDK for full control over request construction and pagination logic [Custom parameter injection](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#custom-parameter-injection). In summary: - Disable default injection for the variable in question. - Use the generic parameter/body section with Jinja to conditionally include the variable based on pagination state. If you need more advanced logic than what Jinja templating allows in the UI, consider switching to the low-code or Python CDK for your connector implementation.
s
@kapa.ai My API doesn't support Jinja
k
A message from kapa.ai
Thank you for clarifying. Based on the knowledge sources, the Airbyte UI Connector Builder relies on Jinja expressions in the generic parameter section to handle advanced or conditional parameter injection scenarios, such as conditionally including a variable in a request based on pagination state. This is the documented workaround for cases where the standard injection options are insufficient, and it is referenced as the main method for custom logic in request construction [Custom parameter injection](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/pagination#custom-parameter-injection). If your API or GraphQL implementation does not support Jinja templating (i.e., you cannot use Jinja to dynamically construct your query or variables), the knowledge sources do not describe an alternative way to achieve conditional parameter injection directly in the UI Builder. In such cases, the documentation suggests that if none of the built-in pagination or injection methods work for your API, you will need to use the low-code CDK or Python CDK for more advanced logic and full control over request construction [Pagination methods](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/pagination). In summary: If your API does not support Jinja and you need conditional logic for request construction, the current UI Builder does not provide a built-in solution. You will need to use the low-code or Python CDK for this level of customization. I'm sorry, but the knowledge sources do not describe a way to achieve this in the UI Builder without Jinja support.