diff --git a/content/connectivity/magento-2/_index.en.md b/content/connectivity/magento-2/_index.en.md index 076bbed..e6e527d 100644 --- a/content/connectivity/magento-2/_index.en.md +++ b/content/connectivity/magento-2/_index.en.md @@ -137,6 +137,37 @@ In this example we will search for customers that were updated after 1985 (`@dat # ... ``` +#### With long filter +Filters are passed to the url. +But the most popular web browsers will not work with URLs over 2000 characters, and would return a 414 (Request-URI Too Long). +You can use the method `withLongFilter` to avoid this limitation and batch your request in multiple smaller requests. + +In this example we will search for specific orders with a lot of elements in the request's filter. +We have 214 increment_id, and we use a `withLongFilter` with parameters: + - `@order_increment_id` references our order's filter. + - `offset`, starts the request at the chosen index, by default we have 0. + - `length`, defines a batch length, by default we have 200. + +Here we have set an offset to 0 and a length to 150, it means we are starting the request from the first element and make multiple requests with 150 items max. +```yaml +# ... + order_filter_group: + class: Kiboko\Component\Flow\Magento2\FilterGroup + calls: + - withLongFilter: [ '@order_filter' ] + order_filter: + class: Kiboko\Component\Flow\Magento2\FilterGroup + calls: + - withLongFilter: ['@order_increment_id', 0, 150] + order_increment_id: + class: Kiboko\Component\Flow\Magento2\Filter + arguments: + - 'increment_id' + - 'in' + - '000000526,4000000026,00000918,000001754,6000000123,4000000150,6000000185,000003798,6000000211,[..],5000000445' +# ... +``` + ### Building a lookup There is a lookup class for Categories, and one for product Attributes.