## default
#
# Path parameters exportproject_id="e555e290-ed65-49bd-ae18-8acbfcf18db7" exportnotification_rule_id="e555e290-ed65-49bd-ae18-8acbfcf18db7" # Use a Personal Access Token or Service Access Token exportDD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
"""
Update a notification rule returns "No Content" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.case_management_apiimportCaseManagementApifromdatadog_api_client.v2.model.case_notification_rule_attributesimportCaseNotificationRuleAttributesfromdatadog_api_client.v2.model.case_notification_rule_recipientimportCaseNotificationRuleRecipientfromdatadog_api_client.v2.model.case_notification_rule_recipient_dataimportCaseNotificationRuleRecipientDatafromdatadog_api_client.v2.model.case_notification_rule_resource_typeimportCaseNotificationRuleResourceTypefromdatadog_api_client.v2.model.case_notification_rule_triggerimportCaseNotificationRuleTriggerfromdatadog_api_client.v2.model.case_notification_rule_trigger_dataimportCaseNotificationRuleTriggerDatafromdatadog_api_client.v2.model.case_notification_rule_updateimportCaseNotificationRuleUpdatefromdatadog_api_client.v2.model.case_notification_rule_update_requestimportCaseNotificationRuleUpdateRequestbody=CaseNotificationRuleUpdateRequest(data=CaseNotificationRuleUpdate(attributes=CaseNotificationRuleAttributes(recipients=[CaseNotificationRuleRecipient(data=CaseNotificationRuleRecipientData(),type="EMAIL",),],triggers=[CaseNotificationRuleTrigger(data=CaseNotificationRuleTriggerData(),type="CASE_CREATED",),],),type=CaseNotificationRuleResourceType.NOTIFICATION_RULE,),)configuration=Configuration()configuration.access_token=environ["DD_BEARER_TOKEN"]withApiClient(configuration)asapi_client:api_instance=CaseManagementApi(api_client)api_instance.update_project_notification_rule(project_id="project_id",notification_rule_id="notification_rule_id",body=body)
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"
# Update a notification rule returns "No Content" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.access_token=ENV["DD_BEARER_TOKEN"]endapi_instance=DatadogAPIClient::V2::CaseManagementAPI.newbody=DatadogAPIClient::V2::CaseNotificationRuleUpdateRequest.new({data:DatadogAPIClient::V2::CaseNotificationRuleUpdate.new({attributes:DatadogAPIClient::V2::CaseNotificationRuleAttributes.new({recipients:[DatadogAPIClient::V2::CaseNotificationRuleRecipient.new({data:DatadogAPIClient::V2::CaseNotificationRuleRecipientData.new({}),type:"EMAIL",}),],triggers:[DatadogAPIClient::V2::CaseNotificationRuleTrigger.new({data:DatadogAPIClient::V2::CaseNotificationRuleTriggerData.new({}),type:"CASE_CREATED",}),],}),type:DatadogAPIClient::V2::CaseNotificationRuleResourceType::NOTIFICATION_RULE,}),})api_instance.update_project_notification_rule("project_id","notification_rule_id",body)
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"
// Update a notification rule returns "No Content" responsepackagemainimport("context""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.CaseNotificationRuleUpdateRequest{Data:datadogV2.CaseNotificationRuleUpdate{Attributes:&datadogV2.CaseNotificationRuleAttributes{Recipients:[]datadogV2.CaseNotificationRuleRecipient{{Data:&datadogV2.CaseNotificationRuleRecipientData{},Type:datadog.PtrString("EMAIL"),},},Triggers:[]datadogV2.CaseNotificationRuleTrigger{{Data:&datadogV2.CaseNotificationRuleTriggerData{},Type:datadog.PtrString("CASE_CREATED"),},},},Type:datadogV2.CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE,},}ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewCaseManagementApi(apiClient)r,err:=api.UpdateProjectNotificationRule(ctx,"project_id","notification_rule_id",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `CaseManagementApi.UpdateProjectNotificationRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
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"
// Update a notification rule returns "No Content" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.CaseManagementApi;importcom.datadog.api.client.v2.model.CaseNotificationRuleAttributes;importcom.datadog.api.client.v2.model.CaseNotificationRuleRecipient;importcom.datadog.api.client.v2.model.CaseNotificationRuleRecipientData;importcom.datadog.api.client.v2.model.CaseNotificationRuleResourceType;importcom.datadog.api.client.v2.model.CaseNotificationRuleTrigger;importcom.datadog.api.client.v2.model.CaseNotificationRuleTriggerData;importcom.datadog.api.client.v2.model.CaseNotificationRuleUpdate;importcom.datadog.api.client.v2.model.CaseNotificationRuleUpdateRequest;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));CaseManagementApiapiInstance=newCaseManagementApi(defaultClient);CaseNotificationRuleUpdateRequestbody=newCaseNotificationRuleUpdateRequest().data(newCaseNotificationRuleUpdate().attributes(newCaseNotificationRuleAttributes().recipients(Collections.singletonList(newCaseNotificationRuleRecipient().data(newCaseNotificationRuleRecipientData()).type("EMAIL"))).triggers(Collections.singletonList(newCaseNotificationRuleTrigger().data(newCaseNotificationRuleTriggerData()).type("CASE_CREATED")))).type(CaseNotificationRuleResourceType.NOTIFICATION_RULE));try{apiInstance.updateProjectNotificationRule("e555e290-ed65-49bd-ae18-8acbfcf18db7","e555e290-ed65-49bd-ae18-8acbfcf18db7",body);}catch(ApiExceptione){System.err.println("Exception when calling CaseManagementApi#updateProjectNotificationRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
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"
// Update a notification rule returns "No Content" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_case_management::CaseManagementAPI;usedatadog_api_client::datadogV2::model::CaseNotificationRuleAttributes;usedatadog_api_client::datadogV2::model::CaseNotificationRuleRecipient;usedatadog_api_client::datadogV2::model::CaseNotificationRuleRecipientData;usedatadog_api_client::datadogV2::model::CaseNotificationRuleResourceType;usedatadog_api_client::datadogV2::model::CaseNotificationRuleTrigger;usedatadog_api_client::datadogV2::model::CaseNotificationRuleTriggerData;usedatadog_api_client::datadogV2::model::CaseNotificationRuleUpdate;usedatadog_api_client::datadogV2::model::CaseNotificationRuleUpdateRequest;#[tokio::main]asyncfnmain(){letbody=CaseNotificationRuleUpdateRequest::new(CaseNotificationRuleUpdate::new(CaseNotificationRuleResourceType::NOTIFICATION_RULE).attributes(CaseNotificationRuleAttributes::new().recipients(vec![CaseNotificationRuleRecipient::new().data(CaseNotificationRuleRecipientData::new()).type_("EMAIL".to_string())]).triggers(vec![CaseNotificationRuleTrigger::new().data(CaseNotificationRuleTriggerData::new()).type_("CASE_CREATED".to_string())]),),);letconfiguration=datadog::Configuration::new();letapi=CaseManagementAPI::with_config(configuration);letresp=api.update_project_notification_rule("project_id".to_string(),"notification_rule_id".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
/**
* Update a notification rule returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration({authMethods:{AuthZ:{accessToken: process.env.DD_BEARER_TOKENasstring,},},});constapiInstance=newv2.CaseManagementApi(configuration);constparams: v2.CaseManagementApiUpdateProjectNotificationRuleRequest={body:{data:{attributes:{recipients:[{data:{},type:"EMAIL",},],triggers:[{data:{},type:"CASE_CREATED",},],},type:"notification_rule",},},projectId:"project_id",notificationRuleId:"notification_rule_id",};apiInstance.updateProjectNotificationRule(params).then((data: any)=>{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"
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.