简体   繁体   English

无法调用Azure管理事件REST API

[英]Unable to call Azure Management Events REST API

I am trying to use the rest api found here: https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx to get the azure events from my subscription. 我正在尝试使用在此处找到的其余api: https ://msdn.microsoft.com/zh-cn/library/azure/dn931934.aspx从我的订阅中获取azure事件。 I have followed the instructions very carefully, but my GET requests return a 400 error: 我已经非常仔细地遵循了说明,但是我的GET请求返回了400错误:

{"Code":"BadRequest","Message":"The $filter query parameter value is invalid."}

My cURL request can be seen below. 我的cURL请求可以在下面看到。 I've redacted any private info 我已删除所有私人信息

curl -X GET -H "Authorization: bearer XXX" -H "content-type: application/json" "https://management.azure.com/subscriptions/YYY/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27"

I have tried many variations of the filter param, but I think this should be correct. 我已经尝试了过滤器参数的许多变体,但是我认为这应该是正确的。 Each space was replaced with a %20, and each ' was replaced with a %27. 每个空格都用%20代替,每个'用%27代替。

If anyone can please inform me as to what the correct query should look like i'd really appreciate it! 如果有人可以告诉我正确查询应该是什么样子,我将不胜感激!

Thanks! 谢谢!

Please try to change the double quotes over the url to the single quotes. 请尝试将url上的双引号更改为单引号。 And it works fine on my side after modification. 修改后,它对我而言效果很好。

EG, 例如,

curl -X GET -H 'Authorization: bearer <token>' -H 'content-type: application/json' 'https://management.azure.com/subscriptions/XXX/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM