The endpoint accepts markdown for notebooks created in Confluence or Google Docs.
Postmortems created from notebooks need to be formatted using frontend notebook cells,
in addition to markdown format.
## default
#
# Path parameters exportincident_id="00000000-0000-0000-0000-000000000000" # Use a Personal Access Token or Service Access Token exportDD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"python3"example.py"
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"rb"example.rb"
// Create postmortem attachment returns "Created" 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.PostmortemAttachmentRequest{Data:datadogV2.PostmortemAttachmentRequestData{Attributes:datadogV2.PostmortemAttachmentRequestAttributes{Cells:[]datadogV2.PostmortemCell{{Attributes:&datadogV2.PostmortemCellAttributes{Definition:&datadogV2.PostmortemCellDefinition{Content:datadog.PtrString(`## Incident Summary
This incident was caused by...`),},},Id:datadog.PtrString("cell-1"),Type:datadogV2.POSTMORTEMCELLTYPE_MARKDOWN.Ptr(),},},Content:datadog.PtrString(`# Incident Report - IR-123
[...]`),PostmortemTemplateId:datadog.PtrString("93645509-874e-45c4-adfa-623bfeaead89-123"),Title:datadog.PtrString("Postmortem-IR-123"),},Type:datadogV2.INCIDENTATTACHMENTTYPE_INCIDENT_ATTACHMENTS,},}ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.CreateIncidentPostmortemAttachment",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewIncidentsApi(apiClient)resp,r,err:=api.CreateIncidentPostmortemAttachment(ctx,"00000000-0000-0000-0000-000000000000",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `IncidentsApi.CreateIncidentPostmortemAttachment`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `IncidentsApi.CreateIncidentPostmortemAttachment`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"go run"main.go"
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"java"Example.java"
// Create postmortem attachment returns "Created" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_incidents::IncidentsAPI;usedatadog_api_client::datadogV2::model::IncidentAttachmentType;usedatadog_api_client::datadogV2::model::PostmortemAttachmentRequest;usedatadog_api_client::datadogV2::model::PostmortemAttachmentRequestAttributes;usedatadog_api_client::datadogV2::model::PostmortemAttachmentRequestData;usedatadog_api_client::datadogV2::model::PostmortemCell;usedatadog_api_client::datadogV2::model::PostmortemCellAttributes;usedatadog_api_client::datadogV2::model::PostmortemCellDefinition;usedatadog_api_client::datadogV2::model::PostmortemCellType;#[tokio::main]asyncfnmain(){letbody=PostmortemAttachmentRequest::new(PostmortemAttachmentRequestData::new(PostmortemAttachmentRequestAttributes::new().cells(vec![PostmortemCell::new().attributes(PostmortemCellAttributes::new().definition(PostmortemCellDefinition::new().content(r#"## Incident Summary
This incident was caused by..."#.to_string(),),),).id("cell-1".to_string()).type_(PostmortemCellType::MARKDOWN)]).content(r#"# Incident Report - IR-123
[...]"#.to_string(),).postmortem_template_id("93645509-874e-45c4-adfa-623bfeaead89-123".to_string()).title("Postmortem-IR-123".to_string()),IncidentAttachmentType::INCIDENT_ATTACHMENTS,));letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.create_incident_postmortem_attachment",true);letapi=IncidentsAPI::with_config(configuration);letresp=api.create_incident_postmortem_attachment("00000000-0000-0000-0000-000000000000".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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create postmortem attachment returns "Created" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration({authMethods:{AuthZ:{accessToken: process.env.DD_BEARER_TOKENasstring,},},});configuration.unstableOperations["v2.createIncidentPostmortemAttachment"]=true;constapiInstance=newv2.IncidentsApi(configuration);constparams: v2.IncidentsApiCreateIncidentPostmortemAttachmentRequest={body:{data:{attributes:{cells:[{attributes:{definition:{content:"## Incident Summary\nThis incident was caused by...",},},id:"cell-1",type:"markdown",},],content:"# Incident Report - IR-123\n[...]",postmortemTemplateId:"93645509-874e-45c4-adfa-623bfeaead89-123",title:"Postmortem-IR-123",},type:"incident_attachments",},},incidentId:"00000000-0000-0000-0000-000000000000",};apiInstance.createIncidentPostmortemAttachment(params).then((data: v2.Attachment)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"tsc"example.ts"
パーソナライズされたデモをリクエスト
Datadog を始める
Ask AI
AI-generated responses may be inaccurate. Verify important info.