Continuing the discussion from How to use AssetQuery to query assets via HTTP API:
…I am trying to query an asset via HTTP query POST.
Asset has the attribute e.g. meter_number (as described in related post)
and its value is
{
"obj1": {
"obj1Key1": [
{
"obj2Key1": true
}
]
}
}
So I send HTTP POST to {{baseUrl}}/asset/query with body
{
"path": [
"obj1",
"obj1Key1",
0,
"obj2Key1"
],
"name": {
"match": "EXACT",
"value": "meter_number",
"predicateType": "string"
},
"value": {
"predicateType": "boolean",
"value": true
}
}
but as result I get all assets, not only the one which satisfys search criteria.
I tried also this query
{
"attributes": {
"items": [
{
"path": [
"obj1",
"obj1Key1",
0,
"obj2Key1"
],
"name": {
"match": "EXACT",
"caseSensitive": "true",
"value": "meter_number",
"negate": "false",
"predicateType": "string"
},
"value": {
"predicateType": "boolean",
"value": true
}
}
]
}
}
but I get exception
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `org.openremote.model.query.filter.NameValuePredicate$Path` from Array value (token `JsonToken.START_ARRAY`)
at [Source: (io.undertow.servlet.spec.ServletInputStreamImpl); line: 5, column: 25] (through reference chain: org.openremote.model.query.AssetQuery["attributes"]->org.openremote.model.query.LogicGroup["items"]->java.util.ArrayList[0]->org.openremote.model.query.filter.AttributePredicate["path"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)