Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Here’s an outline with best practices for making your inquiry.
My question:
I need to construct a query using XPath to find objects that have a member array with specific key:value.
Details (like screenshots):
I have a REST service that returns the following data:
{
"content": [
{
"domain": "one",
"tags": [
{
"key": "foo",
"value": "bar"
},
{
"key": "baz",
"value": "blah"
}
]
},
{
"domain": "two",
"tags": [
{
"key": "foo",
"value": "bar"
}
]
},
{
"domain": "three",
"tags": [
{
"key": "baz",
"value": "blah"
}
]
}
],
"totalElements": 3,
"numberOfElements": 3
}
I can successfully query by “domain” with:
https://{{myServer}}/path/to/service?$filter=domain eq 'one'
What I want to do is query for all of the objects where key = foo and value = bar.
How I found the problem:
Still working on it.
I’ve already tried:
https://{{myServer}}/path/to/service?$filter=tags[foo] eq 'bar'
https://{{myServer}}/path/to/service?$filter=tags['foo'] eq 'bar'
https://{{myServer}}/path/to/service?$filter=tags.[foo] eq 'bar'
https://{{myServer}}/path/to/service?$filter=tags.key[foo] eq 'bar'