Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/rest_api/segments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,12 @@ Date fields
- Occurrence before the specified date
* - ``lte``
- Occurrence on or before the specified date
* - ``inLast``
- Occurrence within the interval leading up to today
* - ``inNext``
- Occurrence between today and the end of the interval

For ``inLast`` and ``inNext``, send ``properties.filter`` as an object with an ``interval`` integer and a ``unit`` of ``day``, ``month``, or ``year`` instead of a scalar value. Refer to :ref:`In the last and In the next filter <in the last and in the next filter>` for an example.

Select or multi-select fields

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented the inLast/inNext API payload shape added in this PR. Unlike other date operators (scalar filter), these require properties.filter to be an object with interval and unit keys — confirmed by the API test ListApiControllerFunctionalTest.php ('properties' => ['filter' => ['interval' => '1', 'unit' => 'day']]) and preserved by FieldFilterTransformer which skips its usual date normalization for these operators. Valid units (day/month/year) come from DateSpanType.php.

Source: mautic/mautic#16574

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -898,3 +904,26 @@ Behavior action filter
"filter": "acme"
}
}

.. _in the last and in the next filter:

In the last and In the next filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``inLast`` and ``inNext`` operators take an interval and a unit instead of a scalar date. Send ``properties.filter`` as an object with an ``interval`` integer and a ``unit`` of ``day``, ``month``, or ``year``:

.. code-block:: json

{
"glue": "and",
"field": "date_modified",
"object": "lead",
"type": "datetime",
"operator": "inLast",
"properties": {
"filter": {
"interval": 1,
"unit": "day"
}
}
}
Loading