使用curl时,SCOM rest api返回;索引超出了数组的边界;

使用curl时,SCOM rest api返回;索引超出了数组的边界;,curl,scom,Curl,Scom,我正试图通过curl使用其RESTAPI检索SCOM警报。它不断返回: "errorMessage": "Index was outside the bounds of the array.", "errorTrace": " at Microsoft.EnterpriseManagement.OMDataService.Filters.ValidateAntiForgeryTokenAttribute.OnActionE

我正试图通过curl使用其RESTAPI检索SCOM警报。它不断返回:

"errorMessage": "Index was outside the bounds of the array.",
"errorTrace": "   at Microsoft.EnterpriseManagement.OMDataService.Filters.ValidateAntiForgeryTokenAttribute.OnActionExecuting(HttpActionContext actionContext)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)\r\n...
首先,我拿了我的:

AuthenticationMode:<domain>\<username>:<password>
AuthenticationMode:\:
字符串并将其转换为UTF8,然后使用openssl对其进行base64编码。我将该“令牌”用于/OperationsManager/authenticate调用,如下所示:

curl --location --request POST 'https://myhostname/OperationsManager/authenticate' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '"<my_base64_encoded_token>"'
curl--位置--请求发布'https://myhostname/OperationsManager/authenticate' \
--标题的内容类型:application/json;字符集=utf-8'\
--数据原始''''
这将返回一个“SCOMSessionId”和“SCOM-CSRF-TOKEN”。然后,我使用“SCOM-CSRF-TOKEN”并对/OperationsManager/data/alert进行以下调用:

curl --location --request POST 'https://myhostname/OperationsManager/data/alert' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'SCOM-CSRF-TOKEN:<csrf_token_value_here>' \
--data-raw '{
    "criteria":"(ResolutionState = '\''0'\'')",
    "displayColumns": [
        "severity","monitoringobjectdisplayname","name","age","repeatcount"
    ]
}'
curl--位置--请求发布'https://myhostname/OperationsManager/data/alert' \
--标题的内容类型:application/json;字符集=utf-8'\
--标题“SCOM-CSRF-TOKEN:”\
--数据原始'{
“标准”:(ResolutionState='\''0'\''),
“显示列”:[
“严重性”、“监视对象显示名称”、“名称”、“年龄”、“重复计数”
]
}'

我可能做错了什么?我找到的所有文档都以powershell为中心。

需要对SCOM-CSRF-TOKEN进行解码。我知道文件里没有告诉你这些

例如,使用一个像will这样的站点,或者如果您希望以编程方式实现它,您可以在ruby中使用类似URI.decode()的东西。在bash中也可以这样做