tiIndicator:updateTiIndicators
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
在一个 (() 请求)中更新多个威胁情报和 TI 智能指示器。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
ThreatIndicators.ReadWrite.OwnedBy
委派(个人 Microsoft 帐户)
不支持。
应用程序
ThreatIndicators.ReadWrite.OwnedBy
HTTP 请求
POST /security/tiIndicators/updateTiIndicators
名称
说明
Authorization
Bearer {code}
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。 有关可更新的属性的详细信息,请参阅 更新 tiIndicator 。 每个 tiIndicator 的必填字段为:、id``expirationDateTime、targetProduct。
参数
类型
说明
值
tiIndicator 集合
要 更新的 tiIndicator 集合。 每个实体必须具有 id 和其他可编辑属性以进行更新。
响应
如果成功,此方法在响应 200 OK 正文中返回 响应代码和 tiIndicator 对象集合。 如果出现错误,此方法将返回 响应 206 Partial Content 代码。 有关详细信息 , 请参阅错误。
示例
以下示例演示如何调用此 API。
请求
下面展示了示例请求。
POST https://graph.microsoft.com/beta/security/tiIndicators/updateTiIndicators
Content-type: application/json
{
"value": [
{
"id": "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4",
"additionalInformation": "mytest"
},
{
"id": "e58c072b-c9bb-a5c4-34ce-eb69af44fb1e",
"additionalInformation": "test again"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var value = new List<TiIndicator>()
{
new TiIndicator
{
Id = "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4",
AdditionalInformation = "mytest"
},
new TiIndicator
{
Id = "e58c072b-c9bb-a5c4-34ce-eb69af44fb1e",
AdditionalInformation = "test again"
}
};
await graphClient.Security.TiIndicators
.UpdateTiIndicators(value)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const tiIndicator = {
value: [
{
id: 'c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4',
additionalInformation: 'mytest'
},
{
id: 'e58c072b-c9bb-a5c4-34ce-eb69af44fb1e',
additionalInformation: 'test again'
}
]
};
await client.api('/security/tiIndicators/updateTiIndicators')
.version('beta')
.post(tiIndicator);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/security/tiIndicators/updateTiIndicators"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSMutableArray *valueList = [[NSMutableArray alloc] init];
MSGraphTiIndicator *value = [[MSGraphTiIndicator alloc] init];
[value setId:@"c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4"];
[value setAdditionalInformation:@"mytest"];
[valueList addObject: value];
MSGraphTiIndicator *value = [[MSGraphTiIndicator alloc] init];
[value setId:@"e58c072b-c9bb-a5c4-34ce-eb69af44fb1e"];
[value setAdditionalInformation:@"test again"];
[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<TiIndicator> valueList = new LinkedList<TiIndicator>();
TiIndicator value = new TiIndicator();
value.id = "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4";
value.additionalInformation = "mytest";
valueList.add(value);
TiIndicator value1 = new TiIndicator();
value1.id = "e58c072b-c9bb-a5c4-34ce-eb69af44fb1e";
value1.additionalInformation = "test again";
valueList.add(value1);
TiIndicatorCollectionResponse tiIndicatorCollectionResponse = new TiIndicatorCollectionResponse();
tiIndicatorCollectionResponse.value = valueList;
TiIndicatorCollectionPage tiIndicatorCollectionPage = new TiIndicatorCollectionPage(tiIndicatorCollectionResponse, null);
graphClient.security().tiIndicators()
.updateTiIndicators(TiIndicatorUpdateTiIndicatorsParameterSet
.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( []TiIndicator {
msgraphsdk.NewTiIndicator(),
SetAdditionalData(map[string]interface{}{
"id": "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4",
"additionalInformation": "mytest",
}
msgraphsdk.NewTiIndicator(),
SetAdditionalData(map[string]interface{}{
"id": "e58c072b-c9bb-a5c4-34ce-eb69af44fb1e",
"additionalInformation": "test again",
}
}
result, err := graphClient.Security().TiIndicators().UpdateTiIndicators().Post(requestBody)
Import-Module Microsoft.Graph.Security
$params = @{
Value = @(
@{
Id = "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4"
AdditionalInformation = "mytest"
}
@{
Id = "e58c072b-c9bb-a5c4-34ce-eb69af44fb1e"
AdditionalInformation = "test again"
}
)
}
Update-MgSecurityTiIndicatorMultiple -BodyParameter $params
响应
下面展示了示例响应。
备注
为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.tiIndicator",
"id": "c6fb948b-89c5-3bba-a2cd-a9d9a1e430e4",
"azureTenantId": "XXXXXXXXXXXXXXXXXX",
"action": null,
"additionalInformation": "mytest",
"activityGroupNames": [],
"confidence": 0,
"description": "This is a test indicator for demo purpose. Take no action on any observables set in this indicator.",
}
]
}