I'm trying to filter a wpapi request, using Jmespath o standard built in filter string.
I would like to retrive all "id" in the list with one or more values in the "filters" array. "Filters" is nested under "_item_filter-options".
For ex I would filter all id with "filters"==409 OR 400.
And what about filter all "id" with "locations"==217 OR other value?
Could you help me to find solution?
[
{
"id": 2608,
"date": "2018-08-18T12:53:16",
"date_gmt": "2018-08-18T10:53:16",
"ait-locations": [
217,
19
],
"ait_item_filters-options": {
"filters": [
"419",
"400",
"409",
"418",
"531",
"403",
"408",
"575"
]
},
},
{
"id": 2588,
.....
I add some additional information, It might help to answer me. I'am using an ait-club wordpress theme with custom post type "ait-item" and meta fields.
I'm trying to use Wordpress Rest API to GET all ait-item with some properties, like latitude, title, address etc, filtered by _item_filters-options"->"filters".
Using for example http://mydomain/wp-json/wp/v2/ait-item?location=19 IT WORKS (location is a custom taxonomy). How can I retrive the same result with Jmespath?
How can get ait-item with filters=419 or more values?
Sorry for my little english, thank you.
Edit: Using:
https://www.mydomain.it/wp-json/wp/v2/ait-item?_query=[?_item_filters-options.filters[0]=='400']
i can retrive all "id" where the firt value of "filters" array is 400. I can't search in entire "filters" array!! Could you help me?
EDIT: I found solution using:
https://www.areepicnic.it/wp-json/wp/v2/ait-item?_query=[?"_ait-item_filters-options".filters[?@=='400']]
or
https://www.areepicnic.it/wp-json/wp/v2/ait-item?_query=[?"_ait-item_filters-options".filters[?contains(@,'397')]]
now I'm trying to filter with multiple values.