I have an api that uses REST/OData. All of the products have an expandable property that is an array of objects. But some of the products are missing these objects. I need to find which ones by filtering out all the ones that have content in the arrays, and returning all of the ones that have an empty array.
Here's the structure of a normal object:
{
"odata.metadata": "https://myapi.com/$metadata#Products",
"value": [
{
"Name": "myName"
"StatusId": 1,
"Id": 88,
"DateCreated": "2015-01-22T14:30:00.6611598",
"DateModified": "2015-01-22T23:48:41.4590534",
"ProductPropertyArray": [
{
"Property1": 1,
"Property2": 3
},
{
"Property1": 4,
"Property2": 2
}
]
}
[
}
I've tried:
myapi.com/Products?$filter=length(ProductPropertyArray) eq 0
But this doesn't work because it wants a string.
I've also tried
myapi.com/Products?$filter=ProductPropertyArray eq null
But that doesn't work either.
像这样调用api时,请在头脑中使用Prefer = Prefer ='odata.include-annotations =“ *”,return = representation'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.