使用Azure Resource Manager资源API的InvalidFilter

时间:2016-08-16 18:57:56

标签: azure odata azure-resource-manager

尝试使用Azure Resource Manager API搜索资源。首先我尝试了这个:

GET /subscriptions/xxx/resources?$filter=startswith(name,%20'web')&api-version=2015-01-01
  

查询字符串中指定的$ filter 'startswith(name, 'web')'无效。详细信息:'找不到支持的过滤功能:'startswith'。物业名称:'名称'。支持的功能:'substringof''

然后我尝试了这个:

GET /subscriptions/xxx/resources?$filter=substringof('web',%20name)%20eq%20true&api-version=2015-01-01
  

查询字符串中指定的$ filter 'substringof('web', name) eq true'无效。详细信息:'$ filter string中找不到支持的令牌。'

我不是OData专家,因此我不确定我的语法是否错误,或者我是否正在尝试做一些在此API中不支持的内容。

1 个答案:

答案 0 :(得分:0)

查询必须是:

GET /subscriptions/xxx/resources?$filter=substringof('web',%20name)&api-version=2015-01-01

忽略eq true。即使它可以被视为v2和v3 odata协议的官方示例的一部分,但似乎Azure API不支持此功能。

相关问题