Creates a data deletion request by providing a query and a timeframe targeting the proper data.
This endpoint requires the logs_delete_data permission.
인수
경로 파라미터
이름
유형
설명
product [required]
string
Name of the product to be deleted. Only logs is supported.
The response from the create data deletion request endpoint.
Expand All
항목
유형
설명
data
object
The created data deletion request information.
attributes [required]
object
Deletion attribute for data deletion response.
created_at [required]
string
Creation time of the deletion request.
created_by [required]
string
User who created the deletion request.
customer_message
string
A message for the customer regarding the deletion request, if any.
displayed_total [required]
int64
Total number of elements to be deleted as displayed to the user.
error_category
string
The category of the error for the deletion request, if any.
from_time [required]
int64
Start of requested time window, milliseconds since Unix epoch.
indexes
[string]
List of indexes for the search. If not provided, the search is performed in all indexes.
is_created [required]
boolean
Whether the deletion request is fully created or not. It can take several minutes to fully create a deletion request depending on the target query and timeframe.
org_id [required]
int64
Organization ID.
product [required]
string
Product name.
query [required]
string
Query for creating a data deletion request.
starting_at [required]
string
Starting time of the process to delete the requested data.
status [required]
string
Status of the deletion request.
to_time [required]
int64
End of requested time window, milliseconds since Unix epoch.
total_unrestricted [required]
int64
Total number of elements to be deleted. Only the data accessible to the current user that matches the query and timeframe provided will be deleted.
updated_at [required]
string
Update time of the deletion request.
id [required]
string
The ID of the created data deletion request.
type [required]
string
The type of the request created.
meta
object
The metadata of the data deletion response.
count_product
object
The total deletion requests created by product.
<any-key>
int64
count_status
object
The total deletion requests created by status.
<any-key>
int64
next_page
string
The next page when searching deletion requests created in the current organization.
product
string
The product of the deletion request.
request_status
string
The status of the executed request.
{"data":{"attributes":{"created_at":"2024-01-01T00:00:00.000000Z","created_by":"test.user@datadoghq.com","customer_message":"Your deletion request is being processed.","displayed_total":100,"error_category":"validation_error","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":true,"org_id":321813,"product":"logs","query":"service:xyz host:abc","starting_at":"2024-01-01T02:00:00.000000Z","status":"pending","to_time":1704063600000,"total_unrestricted":100,"updated_at":"2024-01-01T00:00:00.000000Z"},"id":"1","type":"deletion_request"},"meta":{"count_product":{"<any-key>":"integer"},"count_status":{"<any-key>":"integer"},"next_page":"cGFnZTI=","product":"logs","request_status":"canceled"}}
// Creates a data deletion request returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.CreateDataDeletionRequestBody{Data:datadogV2.CreateDataDeletionRequestBodyData{Attributes:datadogV2.CreateDataDeletionRequestBodyAttributes{DisplayedTotal:100,From:1672527600000,Indexes:[]string{"test-index","test-index-2",},Query:map[string]string{"host":"abc","service":"xyz",},To:1704063600000,},Type:datadogV2.CREATEDATADELETIONREQUESTBODYDATATYPE_CREATE_DELETION_REQ,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDataDeletionApi(apiClient)resp,r,err:=api.CreateDataDeletionRequest(ctx,"logs",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DataDeletionApi.CreateDataDeletionRequest`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DataDeletionApi.CreateDataDeletionRequest`:\n%s\n",responseContent)}
"""
Creates a data deletion request returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.data_deletion_apiimportDataDeletionApifromdatadog_api_client.v2.model.create_data_deletion_request_bodyimportCreateDataDeletionRequestBodyfromdatadog_api_client.v2.model.create_data_deletion_request_body_attributesimport(CreateDataDeletionRequestBodyAttributes,)fromdatadog_api_client.v2.model.create_data_deletion_request_body_dataimportCreateDataDeletionRequestBodyDatafromdatadog_api_client.v2.model.create_data_deletion_request_body_data_typeimport(CreateDataDeletionRequestBodyDataType,)body=CreateDataDeletionRequestBody(data=CreateDataDeletionRequestBodyData(attributes=CreateDataDeletionRequestBodyAttributes(displayed_total=100,_from=1672527600000,indexes=["test-index","test-index-2",],query=dict(host="abc",service="xyz",),to=1704063600000,),type=CreateDataDeletionRequestBodyDataType.CREATE_DELETION_REQ,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DataDeletionApi(api_client)response=api_instance.create_data_deletion_request(product="logs",body=body)print(response)
# Creates a data deletion request returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::DataDeletionAPI.newbody=DatadogAPIClient::V2::CreateDataDeletionRequestBody.new({data:DatadogAPIClient::V2::CreateDataDeletionRequestBodyData.new({attributes:DatadogAPIClient::V2::CreateDataDeletionRequestBodyAttributes.new({displayed_total:100,from:1672527600000,indexes:["test-index","test-index-2",],query:{host:"abc",service:"xyz",},to:1704063600000,}),type:DatadogAPIClient::V2::CreateDataDeletionRequestBodyDataType::CREATE_DELETION_REQ,}),})papi_instance.create_data_deletion_request("logs",body)
// Creates a data deletion request returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_data_deletion::DataDeletionAPI;usedatadog_api_client::datadogV2::model::CreateDataDeletionRequestBody;usedatadog_api_client::datadogV2::model::CreateDataDeletionRequestBodyAttributes;usedatadog_api_client::datadogV2::model::CreateDataDeletionRequestBodyData;usedatadog_api_client::datadogV2::model::CreateDataDeletionRequestBodyDataType;usestd::collections::BTreeMap;#[tokio::main]asyncfnmain(){letbody=CreateDataDeletionRequestBody::new(CreateDataDeletionRequestBodyData::new(CreateDataDeletionRequestBodyAttributes::new(100,1672527600000,BTreeMap::from([("host".to_string(),"abc".to_string()),("service".to_string(),"xyz".to_string()),]),1704063600000,).indexes(vec!["test-index".to_string(),"test-index-2".to_string()]),CreateDataDeletionRequestBodyDataType::CREATE_DELETION_REQ,));letconfiguration=datadog::Configuration::new();letapi=DataDeletionAPI::with_config(configuration);letresp=api.create_data_deletion_request("logs".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Creates a data deletion request returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DataDeletionApi(configuration);constparams: v2.DataDeletionApiCreateDataDeletionRequestRequest={body:{data:{attributes:{displayedTotal: 100,from:1672527600000,indexes:["test-index","test-index-2"],query:{host:"abc",service:"xyz",},to: 1704063600000,},type:"create_deletion_req",},},product:"logs",};apiInstance.createDataDeletionRequest(params).then((data: v2.CreateDataDeletionResponseBody)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));