背景
IDictionary<string,string>
问题
IDictionary<string,string>
https://management.azure.com/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Automation/automationAccounts/XXX/jobs?$filter=properties/parameters/any(keyValue: keyValue/owner eq 'Adam@test.com')&api-version=2015-10-31
{
"code": "BadRequest",
"message": "Could not find a property named 'owner' on type 'System.Collections.Generic.KeyValuePair_2OfString_String'."
}
问题
我要应用过滤器的JSON响应
"value": [
{
"id": "/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Automation/automationAccounts/XXX/jobs/XXX",
"properties": {
"jobId": "XXX",
"runbook": {
"name": "HelloWorldRunbook"
},
"schedule": null,
"provisioningState": "Succeeded",
"status": "Completed",
"creationTime": "2018-06-17T05:44:12.197+00:00",
"startTime": "2018-06-17T05:44:21.227+00:00",
"lastModifiedTime": "2018-06-17T05:44:43.43+00:00",
"endTime": "2018-06-17T05:44:43.43+00:00",
"jobScheduleId": "7fc134ac-d8bd-464e-b041-6e6b50f83f0c",
"runOn": null,
"parameters": {
"Owner": "Adam@test.com",
"mailBox": "test_mailbox@test.com"
}
}
............removed for brevity
&#13;
答案 0 :(得分:0)
当我尝试运行List Job By Automation Account Rest API时,响应正文中没有返回任何属性parameters
。
如果是,那么我做错了什么?
...
"parameters": {
"Owner": "Adam@test.com",
"mailBox": "test_mailbox@test.com"
}
...
但是根据你提到的响应json格式,参数属性是一个对象而不是一个字典,所以你可以使用$filter=properties/parameters/Owner eq 'Adam@test.com'
来确保参数存在。
Get https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs?api-version=2015-10-31&$filter=properties/parameters/Owner eq 'Adam@test.com'