我有一个使用REST/ODATA的API。所有产品都有一个可扩展的属性,该属性是一系列对象。但是一些产品缺少这些对象。我需要通过过滤所有在数组中具有内容的内容,然后返回所有具有空数组的内容来找到哪些。
这是普通对象的结构:
{
"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
}
]
}
[
}
我尝试过:
myapi.com/Products?$filter=length(ProductPropertyArray) eq 0
但这是不起作用的,因为它想要一个字符串。
我也尝试了
myapi.com/Products?$filter=ProductPropertyArray eq null
但这也不起作用。
请在以下方式调用API时在您的脑海中使用pree Pref ='odata.include-notations ="*",return =表示=表示'