2016-07-28 60 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'