自动化REST API过滤器 [英] Automation REST API Filter
问题描述
我试图达到自动化REST API的终点,即作业,以获取作业运行的状态.它在文档https://docs.microsoft.com/zh-cn/rest/api/automation/job/listbyautomationaccount中指定,我们可以使用$ filter发送查询 REST API.任何人都可以让我知道,查询的格式必须发送.
I am trying to hits the automation REST API end point, jobs, to get the status of job runs. It is specified here in the documentation, https://docs.microsoft.com/en-us/rest/api/automation/job/listbyautomationaccount, that we can use $filter to send a query to REST API. Can anyone please let me know, the format the query has to be sent.
没有任何过滤器的端点的JSON响应就像
The JSON response of that endpoint without any filter is like,
{
"value":[
{
"properties":{
"status":"Completed",
"endTime":"2018-10-22T08:11:12.6009936+00:00",
"runOn":"None",
"creationTime":"2018-10-22T08:01:20.2425504+00:00",
"jobId":"XXXX-XXXXX-XXXX-XXXX",
"startTime":"2018-10-22T08:02:06.7175749+00:00",
"lastModifiedTime":"2018-10-22T08:11:12.6009936+00:00",
"runbook":{
"name":"$runbook_name"
},
"provisioningState":"Succeeded"
},
"type":"Microsoft.Automation/AutomationAccounts/Jobs",
"id":"/subscriptions/XXXX-XXXXX-XXXX-XXXX/resourceGrops/XXXX-XXXXX-XXXX-XXXX/providers/Microsoft.Automation/automationAccounts/XXXX-XXXXX-XXXX-XXXX/jobs/XXXX-XXXXX-XXXX-XXXX",
"name":"XXXX-XXXXX-XXXX-XXXX"
}
]
}
我尝试了$ filter = {"properties":{"runbook":{"name":"filter_runbook_name"}}}等过滤器.我收到类似$ filter应该只有布尔值的错误.任何人都可以帮助我查询的类型,我需要通过发送 此过滤器为REST API.我正在使用Python发送此请求.
I tried filters like $filter={"properties": {"runbook": {"name": "filter_runbook_name"}}}. I get errors like, $filter should have only boolean value. Can anyone help me with the type of query, I need to send through this filter to REST API. I am using Python to send this requests.
预先感谢
Santhosh
推荐答案
我确实尝试了您的请求,但仍找不到答案.但是我想我可以为您提供一些有关
I did tried your request, but i couldn't able to find the answer yet. But I think i can shed some lights for you about this
过滤器查询的信息.
基本上
过滤器是一个OData表达式,它遵循一些搜索规范
filter is a OData Expression which follows some specifications for the searching
https://docs.microsoft.com/en-us/rest/api/searchservice/odata-expression-syntax-for-azure-search
为.例如,您需要提供
For. E.g, Comparision you need to provide eq, ne, gt, lt, ge, le
例如,resourceType eq'Microsoft.Insights/alertRules'
E.g, resourceType eq 'Microsoft.Insights/alertRules'
请参见 回答
See this Answer
当我尝试使用嵌套的JSON查询时,我发现此 解决方案
While I tried with the nested JSON Query I find this solution
一旦找到解决问题的方法,我会通知您.同时,请尝试使用我提供的信息从您的角度进行尝试.
I'll let you know once I find any solution for your problem.Meantime please try some thing from yourend with the information I provide.
这篇关于自动化REST API过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!