警报:updateAlerts
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新一个请求而不是多个请求中的多个警报。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
SecurityEvents.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
SecurityEvents.ReadWrite.All |
HTTP 请求
POST /security/alerts/updateAlerts
| 名称 |
说明 |
| Authorization |
Bearer {code} |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。 每个实体必须具有 id 和 vendorInformation 属性。 有关可更新的属性的详细信息,请参阅 更新警报。
| 参数 |
类型 |
说明 |
| 值 |
警报集合 |
要更新的警报集合。 每个实体必须具有 id、 vendorInformation 和其他可编辑属性以进行更新。 |
响应
如果成功,此方法在响应 200, OK 正文中返回 响应 代码和 alert 集合对象。
示例
以下示例演示如何调用此 API。
请求
下面展示了示例请求。
POST https://graph.microsoft.com/beta/security/alerts/updateAlerts
Content-type: application/json
{
"value": [
{
"assignedTo": "String",
"closedDateTime": "String (timestamp)",
"comments": ["String"],
"feedback": {"@odata.type": "microsoft.graph.alertFeedback"},
"id": "String (identifier)",
"status": {"@odata.type": "microsoft.graph.alertStatus"},
"tags": ["String"],
"vendorInformation":
{
"provider": "String",
"vendor": "String"
}
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var value = new List<Alert>()
{
new Alert
{
AssignedTo = "String",
ClosedDateTime = DateTimeOffset.Parse("String (timestamp)"),
Comments = new List<String>()
{
"String"
},
Feedback = new AlertFeedback
{
},
Id = "String (identifier)",
Status = new AlertStatus
{
},
Tags = new List<String>()
{
"String"
},
VendorInformation = new SecurityVendorInformation
{
Provider = "String",
Vendor = "String"
}
}
};
await graphClient.Security.Alerts
.UpdateAlerts(value)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const alert = {
value: [
{
assignedTo: 'String',
closedDateTime: 'String (timestamp)',
comments: ['String'],
feedback: {'@odata.type': 'microsoft.graph.alertFeedback'},
id: 'String (identifier)',
status: {'@odata.type': 'microsoft.graph.alertStatus'},
tags: ['String'],
vendorInformation:
{
provider: 'String',
vendor: 'String'
}
}
]
};
await client.api('/security/alerts/updateAlerts')
.version('beta')
.post(alert);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/security/alerts/updateAlerts"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *valueList = [[NSMutableArray alloc] init];
MSGraphAlert *value = [[MSGraphAlert alloc] init];
[value setAssignedTo:@"String"];
[value setClosedDateTime:@"String (timestamp)"];
NSMutableArray *commentsList = [[NSMutableArray alloc] init];
[commentsList addObject: @"String"];
[value setComments:commentsList];
MSGraphAlertFeedback *feedback = [[MSGraphAlertFeedback alloc] init];
[value setFeedback:feedback];
[value setId:@"String (identifier)"];
MSGraphAlertStatus *status = [[MSGraphAlertStatus alloc] init];
[value setStatus:status];
NSMutableArray *tagsList = [[NSMutableArray alloc] init];
[tagsList addObject: @"String"];
[value setTags:tagsList];
MSGraphSecurityVendorInformation *vendorInformation = [[MSGraphSecurityVendorInformation alloc] init];
[vendorInformation setProvider:@"String"];
[vendorInformation setVendor:@"String"];
[value setVendorInformation:vendorInformation];
[valueList addObject: value];
payloadDictionary[@"value"] = valueList;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<Alert> valueList = new LinkedList<Alert>();
Alert value = new Alert();
value.assignedTo = "String";
value.closedDateTime = OffsetDateTimeSerializer.deserialize("String (timestamp)");
LinkedList<String> commentsList = new LinkedList<String>();
commentsList.add("String");
value.comments = commentsList;
AlertFeedback feedback = new AlertFeedback();
value.feedback = feedback;
value.id = "String (identifier)";
AlertStatus status = new AlertStatus();
value.status = status;
LinkedList<String> tagsList = new LinkedList<String>();
tagsList.add("String");
value.tags = tagsList;
SecurityVendorInformation vendorInformation = new SecurityVendorInformation();
vendorInformation.provider = "String";
vendorInformation.vendor = "String";
value.vendorInformation = vendorInformation;
valueList.add(value);
AlertCollectionResponse alertCollectionResponse = new AlertCollectionResponse();
alertCollectionResponse.value = valueList;
AlertCollectionPage alertCollectionPage = new AlertCollectionPage(alertCollectionResponse, null);
graphClient.security().alerts()
.updateAlerts(AlertUpdateAlertsParameterSet
.newBuilder()
.withValue(valueList)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewValueRequestBody()
requestBody.SetValue( []Alert {
msgraphsdk.NewAlert(),
SetAdditionalData(map[string]interface{}{
"assignedTo": "String",
"closedDateTime": "String (timestamp)",
"comments": []String {
"String",
}
"id": "String (identifier)",
"tags": []String {
"String",
}
}
}
result, err := graphClient.Security().Alerts().UpdateAlerts().Post(requestBody)
Import-Module Microsoft.Graph.Security
$params = @{
Value = @(
@{
AssignedTo = "String"
ClosedDateTime = [System.DateTime]::Parse("String (timestamp)")
Comments = @(
"String"
)
Feedback = @{
"@odata.type" = "microsoft.graph.alertFeedback"
}
Id = "String (identifier)"
Status = @{
"@odata.type" = "microsoft.graph.alertStatus"
}
Tags = @(
"String"
)
VendorInformation = @{
Provider = "String"
Vendor = "String"
}
}
)
}
Update-MgSecurityAlertMultiple -BodyParameter $params
响应
下面展示了示例响应。
备注
为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"activityGroupName": "activityGroupName-value",
"assignedTo": "assignedTo-value",
"azureSubscriptionId": "azureSubscriptionId-value",
"azureTenantId": "azureTenantId-value",
"category": "category-value",
"closedDateTime": "datetime-value"
}
]
}