【发布时间】:2021-05-26 12:45:24
【问题描述】:
考虑如下没有任何过滤器的 api 响应,
[
{
"Account": {
"AccountID": "1",
"Name": "Acc1"
}
},
{
"Account": {
"AccountID": "2",
"Name": "Acc2"
}
},
{
"Account": {
"AccountID": "3",
"Name": "Acc3"
}
},
{
"Account": {
"AccountID": "4",
"Name": "Acc4"
}
}
...
...
]
当我有 帐户 ID 数组时,我正在使用 odata 查询来过滤帐户,如下所示。
.......apiurl?$filter=Account/AccountID eq '1' OR Account/AccountID eq '2' OR Account/AccountID eq '3'
这似乎有效。但是当 account ids 数组有更多的值时,uqi 查询长度会增加。
是否有任何其他选项可以仅在 uri 中使用该字段一次 Account/AccountID 来检查 Id 数组。
提前致谢。
【问题讨论】:
-
这能回答你的问题吗? OData "where ID in list" query
-
你可以使用
in,例如$filter=Name in ('Milk', 'Cheese')
标签: filter postman odata asp.net-core-webapi