2016-07-28 56 views
0

我试图使用其他api找到:https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx从我的订阅中获取azure事件。我非常认真地跟着指示,但我的GET请求返回400错误:无法调用Azure管理事件REST API

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

我的卷曲请求可以看到下面。我节录任何私人信息

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" 

我试图过滤特性参数的许多变化,但我认为这应该是正确的。每个空间被替换为%20,而每个空间被替换为%27。

如果任何人都可以请告诉我什么正确的查询应该看起来像我真的很感激它!

谢谢!

回答

0

请尝试将url的双引号更改为单引号。修改后,它在我身边很好。

E.G.,

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'