Hi, Does anyone have experience getting increment...
# replication-troubleshooting
s
Hi, Does anyone have experience getting incremental syncs working properly with Microsoft Business Central Cloud OData endpoints? I'm trying to use the $filter parameter on lastModifiedDate, but I can't figure out how exactly to get that to work with Incremental Sync
k
Short answer: the knowledge sources don’t include specifics for Microsoft Business Central OData, but they do cover how to configure incremental syncs in the Connector Builder and how to handle APIs that filter by time versus those that don’t. If your OData endpoint supports filtering by a last modified timestamp (for example via $filter=lastModifiedDateTime ge <start> and le <end>), you can set up incremental sync in the Connector Builder like this: - Choose the cursor field: the API’s last modified field (e.g., lastModifiedDateTime). [[Incremental sync](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync)] - Define the cursor datetime format(s) that match the API’s field. [[Next incremental sync](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync)] - Set start datetime (user input or config) and end datetime (typically now). [[1.7 incremental sync](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/incremental-sync); [Next incremental sync](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync)] - Inject start/end into the HTTP request as query parameters using the API’s expected names (e.g., $filter). [[1.7 example](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/incremental-sync#example); [Next example](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync#example)] If the API does not return the modified time in records or you’re worried about late updates, use a lookback window to re-sync a small window before the last cutoff to catch late changes. [[Lookback window](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync#lookback-window); [1.7 lookback](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/incremental-sync#lookback-window)] If the endpoint cannot filter by time but provides a newest-to-oldest feed, use “No filter” mode and stop when you reach the cutoff cursor; otherwise, full refresh may be safer. [[Incremental without time filtering](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync#incremental-sync-without-time-filtering)] Note: The docs do not provide a concrete $filter expression for Business Central OData or confirm its exact datetime format/operators. I’m sorry, but there’s no information about the precise OData filter syntax for Business Central in the provided sources. You may need to verify the exact $filter pattern and datetime format in Microsoft’s docs, then map those into the Connector Builder settings as above. [[Incremental sync](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync); [Next incremental sync](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync)]
s
@kapa.ai can i get example yaml for this
k
A message from kapa.ai
Below is a minimal example YAML snippet showing how to configure an incremental sync that injects a start/end time into a request parameter (you would adapt field names and formats to your API, e.g., map to $filter). This follows the DatetimeBasedCursor and RequestOption pattern from the docs.
Copy code
yaml streams:   - name: example_stream     retriever:       requester:         name: example         url_base: https://api.example.com/         path: /items         http_method: GET       record_selector:         extractor:           field_path: ["items"]     incremental_sync:       type: DatetimeBasedCursor       cursor_field: lastModifiedDateTime       cursor_datetime_formats:         - "%Y-%m-%dT%H:%M:%SZ"         - "%Y-%m-%dT%H:%M:%S.%fZ"       start_datetime:         type: MinMaxDatetime         datetime: "{{ config['start_time'] }}"       end_datetime:         type: NowDatetime       step: "P1D"       start_time_option:         type: RequestOption         field_name: "created[gte]"         inject_into: "request_parameter"       end_time_option:         type: RequestOption         field_name: "created[lte]"         inject_into: "request_parameter"
Notes: - Replace cursor_field and cursor_datetime_formats with those matching your API’s field and format. - Adjust field_name in start_time_option/end_time_option to how your API expects time filtering (e.g., query params). [[Request options](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/request-options#incremental-syncs); [Filtering by cursor](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#filtering-according-to-cursor-field)] - In the Connector Builder UI, you’d configure the same pieces (cursor field, formats, start/end, injection to request parameters). [[Builder incremental](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync); [1.7 example](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/incremental-sync#example)] If you need to reference the current interval directly (e.g., to build a path or complex filter), you can use placeholders like {{ stream_interval.start_time }} and {{ stream_interval.end_time }}. [[1.7 builder example](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/incremental-sync#example)]
s
@kapa.ai I don't know if that yaml would be correct in this instance, because the request parameter name is technically "$filter" and the value of the parameter starts with lastModifiedDate gt then we would put the timestamp after "lastModifiedDate gt" in the request parameter value
k
A message from kapa.ai
You’re right—when an API expects a single $filter parameter whose value embeds both the field and operator, use custom parameter injection instead of start_time_option/end_time_option. In Airbyte, disable the built-in injection and add a query param that builds $filter with the stream interval. Example (config-based YAML):
Copy code
yaml streams:   - name: business_central_entities     retriever:       requester:         url_base: https://api.businesscentral.dynamics.com/v2.0/tenant/env/api/v2.0/         path: items         http_method: GET       record_selector:         extractor:           field_path: []  # adjust if response nests records     incremental_sync:       type: DatetimeBasedCursor       cursor_field: lastModifiedDateTime       cursor_datetime_formats:         - "%Y-%m-%dT%H:%M:%SZ"         - "%Y-%m-%dT%H:%M:%S.%fZ"       start_datetime:         type: MinMaxDatetime         datetime: "{{ config['start_time'] }}"       end_datetime:         type: NowDatetime       step: "P1D"      # Custom parameter injection: build the single $filter parameter value     request_options:       request_parameters:         - name: "$filter"           value: "lastModifiedDateTime ge {{ stream_interval.start_time }} and lastModifiedDateTime le {{ stream_interval.end_time }}"
Notes: - This uses stream_interval.start_time and stream_interval.end_time to compose the OData $filter value in one parameter, which is exactly the “custom parameter injection” pattern. [[Custom injection](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync#custom-parameter-injection)] - Keep the built-in start/end injection disabled, since you’re supplying your own $filter. [[Custom injection](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync#custom-parameter-injection)] - The DatetimeBasedCursor pattern is supported for filtering by cursor via request options when the API supports it; here we’re composing it manually into $filter. [[Filtering by cursor](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#filtering-according-to-cursor-field)] - Adjust cursor_field name and datetime formats to match the exact field/format returned by your endpoint. [[Cursor formats](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync#cursor-datetime-formats)] If your endpoint needs a different operator (gt/lt vs ge/le) or quotes around timestamps, tweak the value string accordingly using Jinja. [[Custom injection](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/incremental-sync#custom-parameter-injection)]
s
@kapa.ai where can i find the request options in the stream config? It doesn't seem like an option to me
k
A message from kapa.ai
In config-based connectors, request options are set on the requester via the request_options_provider. You define request_parameters, request_headers, request_body_data, or request_body_json there. [[Request options provider](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/request-options#request-options-provider)] Example snippet:
Copy code
yaml retriever:   requester:     type: HttpRequester     url_base: https://api.example.com/     path: items     http_method: GET     request_options_provider:       request_parameters:         "$filter": "lastModifiedDateTime ge {{ stream_interval.start_time }} and lastModifiedDateTime le {{ stream_interval.end_time }}"       request_headers:         Accept: application/json
This is also where you’d add JSON or form bodies if needed. [[1.7 request options](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/request-options#request-options-provider); [1.6 HttpRequester](https://docs.airbyte.com/platform/1.6/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/HttpRequester)] If you need components (like paginators or datetime cursors) to inject values, they use a RequestOption to specify where and under which key to inject. [[1.7 request options](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/request-options#request-options-provider)] In the Connector Builder UI, for cases like building a single $filter, disable the built-in start/end injection and add a custom query parameter at the bottom of the stream form using Jinja variables such as stream_interval.start_time and stream_interval.end_time. [[Custom parameter injection](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync#custom-parameter-injection)]