// Update a custom variable 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/datadogV1")funcmain(){// there is a valid "webhook_custom_variable" in the systemWebhookCustomVariableName:=os.Getenv("WEBHOOK_CUSTOM_VARIABLE_NAME")body:=datadogV1.WebhooksIntegrationCustomVariableUpdateRequest{Value:datadog.PtrString("variable-updated"),}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewWebhooksIntegrationApi(apiClient)resp,r,err:=api.UpdateWebhooksIntegrationCustomVariable(ctx,WebhookCustomVariableName,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `WebhooksIntegrationApi.UpdateWebhooksIntegrationCustomVariable`:\n%s\n",responseContent)}
// Update a custom variable returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.WebhooksIntegrationApi;importcom.datadog.api.client.v1.model.WebhooksIntegrationCustomVariableResponse;importcom.datadog.api.client.v1.model.WebhooksIntegrationCustomVariableUpdateRequest;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();WebhooksIntegrationApiapiInstance=newWebhooksIntegrationApi(defaultClient);// there is a valid "webhook_custom_variable" in the systemStringWEBHOOK_CUSTOM_VARIABLE_NAME=System.getenv("WEBHOOK_CUSTOM_VARIABLE_NAME");WebhooksIntegrationCustomVariableUpdateRequestbody=newWebhooksIntegrationCustomVariableUpdateRequest().value("variable-updated");try{WebhooksIntegrationCustomVariableResponseresult=apiInstance.updateWebhooksIntegrationCustomVariable(WEBHOOK_CUSTOM_VARIABLE_NAME,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling WebhooksIntegrationApi#updateWebhooksIntegrationCustomVariable");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a custom variable returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.webhooks_integration_apiimportWebhooksIntegrationApifromdatadog_api_client.v1.model.webhooks_integration_custom_variable_update_requestimport(WebhooksIntegrationCustomVariableUpdateRequest,)# there is a valid "webhook_custom_variable" in the systemWEBHOOK_CUSTOM_VARIABLE_NAME=environ["WEBHOOK_CUSTOM_VARIABLE_NAME"]body=WebhooksIntegrationCustomVariableUpdateRequest(value="variable-updated",)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=WebhooksIntegrationApi(api_client)response=api_instance.update_webhooks_integration_custom_variable(custom_variable_name=WEBHOOK_CUSTOM_VARIABLE_NAME,body=body)print(response)
# Update a custom variable returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::WebhooksIntegrationAPI.new# there is a valid "webhook_custom_variable" in the systemWEBHOOK_CUSTOM_VARIABLE_NAME=ENV["WEBHOOK_CUSTOM_VARIABLE_NAME"]body=DatadogAPIClient::V1::WebhooksIntegrationCustomVariableUpdateRequest.new({value:"variable-updated",})papi_instance.update_webhooks_integration_custom_variable(WEBHOOK_CUSTOM_VARIABLE_NAME,body)
// Update a custom variable returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_webhooks_integration::WebhooksIntegrationAPI;usedatadog_api_client::datadogV1::model::WebhooksIntegrationCustomVariableUpdateRequest;#[tokio::main]asyncfnmain(){// there is a valid "webhook_custom_variable" in the system
letwebhook_custom_variable_name=std::env::var("WEBHOOK_CUSTOM_VARIABLE_NAME").unwrap();letbody=WebhooksIntegrationCustomVariableUpdateRequest::new().value("variable-updated".to_string());letconfiguration=datadog::Configuration::new();letapi=WebhooksIntegrationAPI::with_config(configuration);letresp=api.update_webhooks_integration_custom_variable(webhook_custom_variable_name.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update a custom variable returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.WebhooksIntegrationApi(configuration);// there is a valid "webhook_custom_variable" in the system
constWEBHOOK_CUSTOM_VARIABLE_NAME=process.env.WEBHOOK_CUSTOM_VARIABLE_NAMEasstring;constparams: v1.WebhooksIntegrationApiUpdateWebhooksIntegrationCustomVariableRequest={body:{value:"variable-updated",},customVariableName: WEBHOOK_CUSTOM_VARIABLE_NAME,};apiInstance.updateWebhooksIntegrationCustomVariable(params).then((data: v1.WebhooksIntegrationCustomVariableResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));