PUT https://api.ap1.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.ap2.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.datadoghq.eu/api/v2/maintenance_windows/{maintenance_window_id}https://api.ddog-gov.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.us2.ddog-gov.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.uk1.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.us3.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}https://api.us5.datadoghq.com/api/v2/maintenance_windows/{maintenance_window_id}

概要

Updates the name, query, start time, or end time of an existing maintenance window.

OAuth apps require the event_correlation_config_write authorization scope to access this endpoint.

引数

パスパラメーター

名前

タイプ

説明

maintenance_window_id [required]

string

The UUID of the maintenance window.

リクエスト

Body Data (required)

Maintenance window payload.

Expand All

フィールド

タイプ

説明

data [required]

object

Data object for updating a maintenance window.

attributes

object

Attributes that can be updated on a maintenance window. All fields are optional; only provided fields are changed.

end_at

date-time

The end time of the maintenance window.

name

string

The name of the maintenance window.

query

string

The query to filter event management work items for this maintenance window.

start_at

date-time

The start time of the maintenance window.

type [required]

enum

JSON:API resource type for maintenance windows. Allowed enum values: maintenance_window

default: maintenance_window

{
  "data": {
    "attributes": {
      "end_at": "2019-09-19T10:00:00.000Z",
      "name": "string",
      "query": "string",
      "start_at": "2019-09-19T10:00:00.000Z"
    },
    "type": "maintenance_window"
  }
}

応答

OK

Response containing a single maintenance window.

Expand All

フィールド

タイプ

説明

data [required]

object

A maintenance window that defines a scheduled time period during which notifications and automation rules related to work items are suppressed. Each maintenance window applies to work items matching a specified query.

attributes [required]

object

Attributes of a maintenance window, including its schedule and the query that determines which work items are affected.

created_by

string

The UUID of the user who created this maintenance window. Read-only.

end_at [required]

date-time

The ISO 8601 timestamp when the maintenance window ends and normal notification behavior resumes.

name [required]

string

A human-readable name for the maintenance window (for example, Database migration - Dec 15).

query [required]

string

A work item search query that determines which work items are affected during the maintenance window. Uses the same syntax as the Work Management search bar.

start_at [required]

date-time

The ISO 8601 timestamp when the maintenance window begins and notifications start being suppressed.

updated_by

string

The UUID of the user who last modified this maintenance window. Read-only.

id [required]

string

The maintenance window's identifier.

type [required]

enum

JSON:API resource type for maintenance windows. Allowed enum values: maintenance_window

default: maintenance_window

{
  "data": {
    "attributes": {
      "created_by": "string",
      "end_at": "2026-06-01T06:00:00Z",
      "name": "Weekly maintenance",
      "query": "project:SEC",
      "start_at": "2026-06-01T00:00:00Z",
      "updated_by": "string"
    },
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "maintenance_window"
  }
}

Bad Request

API error response.

Expand All

フィールド

タイプ

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

フィールド

タイプ

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

フィールド

タイプ

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

フィールド

タイプ

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

タイプ

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                  ## default
# 

# Path parameters
export maintenance_window_id="a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/maintenance_windows/${maintenance_window_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DD_BEARER_TOKEN}" \ -d @- << EOF { "data": { "attributes": { "end_at": "2026-06-01T06:00:00Z", "name": "Weekly maintenance", "query": "project:SEC", "start_at": "2026-06-01T00:00:00Z" }, "type": "maintenance_window" } } EOF
"""
Update a maintenance window returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.case_management_api import CaseManagementApi
from datadog_api_client.v2.model.maintenance_window_resource_type import MaintenanceWindowResourceType
from datadog_api_client.v2.model.maintenance_window_update import MaintenanceWindowUpdate
from datadog_api_client.v2.model.maintenance_window_update_attributes import MaintenanceWindowUpdateAttributes
from datadog_api_client.v2.model.maintenance_window_update_request import MaintenanceWindowUpdateRequest

body = MaintenanceWindowUpdateRequest(
    data=MaintenanceWindowUpdate(
        attributes=MaintenanceWindowUpdateAttributes(),
        type=MaintenanceWindowResourceType.MAINTENANCE_WINDOW,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = CaseManagementApi(api_client)
    response = api_instance.update_maintenance_window(maintenance_window_id="maintenance_window_id", body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
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 maintenance window returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new

body = DatadogAPIClient::V2::MaintenanceWindowUpdateRequest.new({
  data: DatadogAPIClient::V2::MaintenanceWindowUpdate.new({
    attributes: DatadogAPIClient::V2::MaintenanceWindowUpdateAttributes.new({}),
    type: DatadogAPIClient::V2::MaintenanceWindowResourceType::MAINTENANCE_WINDOW,
  }),
})
p api_instance.update_maintenance_window("maintenance_window_id", body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
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 maintenance window returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.MaintenanceWindowUpdateRequest{
		Data: datadogV2.MaintenanceWindowUpdate{
			Attributes: &datadogV2.MaintenanceWindowUpdateAttributes{},
			Type:       datadogV2.MAINTENANCEWINDOWRESOURCETYPE_MAINTENANCE_WINDOW,
		},
	}
	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)
	resp, r, err := api.UpdateMaintenanceWindow(ctx, "maintenance_window_id", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.UpdateMaintenanceWindow`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.UpdateMaintenanceWindow`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
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 maintenance window returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CaseManagementApi;
import com.datadog.api.client.v2.model.MaintenanceWindowResourceType;
import com.datadog.api.client.v2.model.MaintenanceWindowResponse;
import com.datadog.api.client.v2.model.MaintenanceWindowUpdate;
import com.datadog.api.client.v2.model.MaintenanceWindowUpdateAttributes;
import com.datadog.api.client.v2.model.MaintenanceWindowUpdateRequest;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    CaseManagementApi apiInstance = new CaseManagementApi(defaultClient);

    MaintenanceWindowUpdateRequest body =
        new MaintenanceWindowUpdateRequest()
            .data(
                new MaintenanceWindowUpdate()
                    .attributes(new MaintenanceWindowUpdateAttributes())
                    .type(MaintenanceWindowResourceType.MAINTENANCE_WINDOW));

    try {
      MaintenanceWindowResponse result =
          apiInstance.updateMaintenanceWindow("a1b2c3d4-e5f6-7890-abcd-ef1234567890", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CaseManagementApi#updateMaintenanceWindow");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
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 maintenance window returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
use datadog_api_client::datadogV2::model::MaintenanceWindowResourceType;
use datadog_api_client::datadogV2::model::MaintenanceWindowUpdate;
use datadog_api_client::datadogV2::model::MaintenanceWindowUpdateAttributes;
use datadog_api_client::datadogV2::model::MaintenanceWindowUpdateRequest;

#[tokio::main]
async fn main() {
    let body = MaintenanceWindowUpdateRequest::new(
        MaintenanceWindowUpdate::new(MaintenanceWindowResourceType::MAINTENANCE_WINDOW)
            .attributes(MaintenanceWindowUpdateAttributes::new()),
    );
    let configuration = datadog::Configuration::new();
    let api = CaseManagementAPI::with_config(configuration);
    let resp = api
        .update_maintenance_window("maintenance_window_id".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
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 maintenance window returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.CaseManagementApi(configuration);

const params: v2.CaseManagementApiUpdateMaintenanceWindowRequest = {
  body: {
    data: {
      attributes: {},
      type: "maintenance_window",
    },
  },
  maintenanceWindowId: "maintenance_window_id",
};

apiInstance
  .updateMaintenanceWindow(params)
  .then((data: v2.MaintenanceWindowResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
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"