Espace de noms: microsoft.graph
Importante
Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Mettez à jour plusieurs alertes dans une seule requête au lieu de plusieurs requêtes.
Cette API est disponible dans les déploiements de cloud national suivants.
| Service global |
Gouvernement des États-Unis L4 |
Us Government L5 (DOD) |
Chine gérée par 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations.
| Type d’autorisation |
Autorisations avec privilèges minimum |
Autorisations privilégiées plus élevées |
| Déléguée (compte professionnel ou scolaire) |
SecurityEvents.ReadWrite.All |
Non disponible. |
| Déléguée (compte Microsoft personnel) |
Non prise en charge. |
Non prise en charge. |
| Application |
SecurityEvents.ReadWrite.All |
Non disponible. |
Requête HTTP
POST /security/alerts/updateAlerts
Corps de la demande
Dans le corps de la demande, indiquez un objet JSON avec les paramètres suivants. Chaque entité doit avoir des propriétés id et vendorInformation . Pour plus d’informations sur les propriétés qui peuvent être mises à jour, consultez Alerte de mise à jour.
| Paramètre |
Type |
Description |
| value |
collectionalert |
Collection d’alertes à mettre à jour. Chaque entité doit avoir id, vendorInformation et d’autres propriétés modifiables à mettre à jour. |
Réponse
Si elle réussit, cette méthode renvoie 200, OK le code de réponse et l’objet de collection d’alertes dans le corps de la réponse.
Exemples
L’exemple ci-après montre comment appeler cette API.
Demande
L’exemple suivant illustre une demande.
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"
}
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Security.Alerts.UpdateAlerts;
using Microsoft.Graph.Beta.Models;
var requestBody = new UpdateAlertsPostRequestBody
{
Value = new List<Alert>
{
new Alert
{
AssignedTo = "String",
ClosedDateTime = DateTimeOffset.Parse("String (timestamp)"),
Comments = new List<string>
{
"String",
},
Feedback = new AlertFeedback
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.type" , "microsoft.graph.alertFeedback"
},
},
},
Id = "String (identifier)",
Status = new AlertStatus
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.type" , "microsoft.graph.alertStatus"
},
},
},
Tags = new List<string>
{
"String",
},
VendorInformation = new SecurityVendorInformation
{
Provider = "String",
Vendor = "String",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.Alerts.UpdateAlerts.PostAsUpdateAlertsPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphsecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/security"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphsecurity.NewUpdateAlertsPostRequestBody()
alert := graphmodels.NewAlert()
assignedTo := "String"
alert.SetAssignedTo(&assignedTo)
closedDateTime , err := time.Parse(time.RFC3339, "String (timestamp)")
alert.SetClosedDateTime(&closedDateTime)
comments := []string {
"String",
}
alert.SetComments(comments)
feedback := graphmodels.NewAlertFeedback()
additionalData := map[string]interface{}{
}
feedback.SetAdditionalData(additionalData)
alert.SetFeedback(feedback)
id := "String (identifier)"
alert.SetId(&id)
status := graphmodels.NewAlertStatus()
additionalData := map[string]interface{}{
}
status.SetAdditionalData(additionalData)
alert.SetStatus(status)
tags := []string {
"String",
}
alert.SetTags(tags)
vendorInformation := graphmodels.NewSecurityVendorInformation()
provider := "String"
vendorInformation.SetProvider(&provider)
vendor := "String"
vendorInformation.SetVendor(&vendor)
alert.SetVendorInformation(vendorInformation)
value := []graphmodels.Alertable {
alert,
}
requestBody.SetValue(value)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
updateAlerts, err := graphClient.Security().Alerts().UpdateAlerts().PostAsUpdateAlertsPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.security.alerts.updatealerts.UpdateAlertsPostRequestBody updateAlertsPostRequestBody = new com.microsoft.graph.beta.security.alerts.updatealerts.UpdateAlertsPostRequestBody();
LinkedList<Alert> value = new LinkedList<Alert>();
Alert alert = new Alert();
alert.setAssignedTo("String");
OffsetDateTime closedDateTime = OffsetDateTime.parse("String (timestamp)");
alert.setClosedDateTime(closedDateTime);
LinkedList<String> comments = new LinkedList<String>();
comments.add("String");
alert.setComments(comments);
AlertFeedback feedback = new AlertFeedback();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("@odata.type", "microsoft.graph.alertFeedback");
feedback.setAdditionalData(additionalData);
alert.setFeedback(feedback);
alert.setId("String (identifier)");
AlertStatus status = new AlertStatus();
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("@odata.type", "microsoft.graph.alertStatus");
status.setAdditionalData(additionalData1);
alert.setStatus(status);
LinkedList<String> tags = new LinkedList<String>();
tags.add("String");
alert.setTags(tags);
SecurityVendorInformation vendorInformation = new SecurityVendorInformation();
vendorInformation.setProvider("String");
vendorInformation.setVendor("String");
alert.setVendorInformation(vendorInformation);
value.add(alert);
updateAlertsPostRequestBody.setValue(value);
var result = graphClient.security().alerts().updateAlerts().post(updateAlertsPostRequestBody);
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);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Security\Alerts\UpdateAlerts\UpdateAlertsPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Alert;
use Microsoft\Graph\Beta\Generated\Models\AlertFeedback;
use Microsoft\Graph\Beta\Generated\Models\AlertStatus;
use Microsoft\Graph\Beta\Generated\Models\SecurityVendorInformation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UpdateAlertsPostRequestBody();
$valueAlert1 = new Alert();
$valueAlert1->setAssignedTo('String');
$valueAlert1->setClosedDateTime(new \DateTime('String (timestamp)'));
$valueAlert1->setComments(['String', ]);
$valueAlert1Feedback = new AlertFeedback();
$additionalData = [
'@odata.type' => 'microsoft.graph.alertFeedback',
];
$valueAlert1Feedback->setAdditionalData($additionalData);
$valueAlert1->setFeedback($valueAlert1Feedback);
$valueAlert1->setId('String (identifier)');
$valueAlert1Status = new AlertStatus();
$additionalData = [
'@odata.type' => 'microsoft.graph.alertStatus',
];
$valueAlert1Status->setAdditionalData($additionalData);
$valueAlert1->setStatus($valueAlert1Status);
$valueAlert1->setTags(['String', ]);
$valueAlert1VendorInformation = new SecurityVendorInformation();
$valueAlert1VendorInformation->setProvider('String');
$valueAlert1VendorInformation->setVendor('String');
$valueAlert1->setVendorInformation($valueAlert1VendorInformation);
$valueArray []= $valueAlert1;
$requestBody->setValue($valueArray);
$result = $graphServiceClient->security()->alerts()->updateAlerts()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.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-MgBetaSecurityAlertMultiple -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.security.alerts.update_alerts.update_alerts_post_request_body import UpdateAlertsPostRequestBody
from msgraph_beta.generated.models.alert import Alert
from msgraph_beta.generated.models.alert_feedback import AlertFeedback
from msgraph_beta.generated.models.alert_status import AlertStatus
from msgraph_beta.generated.models.security_vendor_information import SecurityVendorInformation
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UpdateAlertsPostRequestBody(
value = [
Alert(
assigned_to = "String",
closed_date_time = "String (timestamp)",
comments = [
"String",
],
feedback = AlertFeedback(
additional_data = {
"@odata_type" : "microsoft.graph.alertFeedback",
}
),
id = "String (identifier)",
status = AlertStatus(
additional_data = {
"@odata_type" : "microsoft.graph.alertStatus",
}
),
tags = [
"String",
],
vendor_information = SecurityVendorInformation(
provider = "String",
vendor = "String",
),
),
],
)
result = await graph_client.security.alerts.update_alerts.post(request_body)
Réponse
L’exemple suivant illustre la réponse.
Remarque
L’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.
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"
}
]
}