Bulk delete suites

POST https://api.ap1.datadoghq.com/api/v2/synthetics/suites/bulk-deletehttps://api.ap2.datadoghq.com/api/v2/synthetics/suites/bulk-deletehttps://api.datadoghq.eu/api/v2/synthetics/suites/bulk-deletehttps://api.ddog-gov.com/api/v2/synthetics/suites/bulk-deletehttps://api.us2.ddog-gov.com/api/v2/synthetics/suites/bulk-deletehttps://api.datadoghq.com/api/v2/synthetics/suites/bulk-deletehttps://api.us3.datadoghq.com/api/v2/synthetics/suites/bulk-deletehttps://api.us5.datadoghq.com/api/v2/synthetics/suites/bulk-delete

Overview

This endpoint requires the synthetics_write permission.

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

Request

Body Data (required)

Expand All

Field

Type

Description

data [required]

object

Data object for a bulk delete Synthetic test suites request.

attributes [required]

object

Attributes for a bulk delete Synthetic test suites request.

force_delete_dependencies

boolean

Whether to force deletion of suites that have dependent resources.

public_ids [required]

[string]

List of public IDs of the Synthetic test suites to delete.

id

string

An optional identifier for the delete request.

type

enum

Type for the bulk delete Synthetic suites request, delete_suites_request. Allowed enum values: delete_suites_request

default: delete_suites_request

{
  "data": {
    "attributes": {
      "force_delete_dependencies": false,
      "public_ids": [
        ""
      ]
    },
    "id": "string",
    "type": "delete_suites_request"
  }
}

Response

OK

Response containing the list of deleted Synthetic test suites.

Expand All

Field

Type

Description

data

[object]

List of deleted Synthetic suite data objects.

attributes

object

Attributes of a deleted Synthetic test suite, including deletion timestamp and public ID.

deleted_at

string

Deletion timestamp of the Synthetic suite ID.

public_id

string

The Synthetic suite ID deleted.

id

string

The public ID of the deleted Synthetic test suite.

type

enum

Type for the Synthetics suites responses, suites. Allowed enum values: suites

default: suites

{
  "data": [
    {
      "attributes": {
        "deleted_at": "string",
        "public_id": "string"
      },
      "id": "string",
      "type": "suites"
    }
  ]
}

API error response.

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Code Example

                  ## default
# 

# Curl command
curl -X POST "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.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/synthetics/suites/bulk-delete" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "public_ids": [ "" ] }, "type": "delete_suites_request" } } EOF
"""
Bulk delete suites returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi
from datadog_api_client.v2.model.deleted_suites_request_delete import DeletedSuitesRequestDelete
from datadog_api_client.v2.model.deleted_suites_request_delete_attributes import DeletedSuitesRequestDeleteAttributes
from datadog_api_client.v2.model.deleted_suites_request_delete_request import DeletedSuitesRequestDeleteRequest
from datadog_api_client.v2.model.deleted_suites_request_type import DeletedSuitesRequestType

body = DeletedSuitesRequestDeleteRequest(
    data=DeletedSuitesRequestDelete(
        attributes=DeletedSuitesRequestDeleteAttributes(
            public_ids=[
                "",
            ],
        ),
        type=DeletedSuitesRequestType.DELETE_SUITES_REQUEST,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.delete_synthetics_suites(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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Bulk delete suites returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SyntheticsAPI.new

body = DatadogAPIClient::V2::DeletedSuitesRequestDeleteRequest.new({
  data: DatadogAPIClient::V2::DeletedSuitesRequestDelete.new({
    attributes: DatadogAPIClient::V2::DeletedSuitesRequestDeleteAttributes.new({
      public_ids: [
        "",
      ],
    }),
    type: DatadogAPIClient::V2::DeletedSuitesRequestType::DELETE_SUITES_REQUEST,
  }),
})
p api_instance.delete_synthetics_suites(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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Bulk delete suites 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.DeletedSuitesRequestDeleteRequest{
		Data: datadogV2.DeletedSuitesRequestDelete{
			Attributes: datadogV2.DeletedSuitesRequestDeleteAttributes{
				PublicIds: []string{
					"",
				},
			},
			Type: datadogV2.DELETEDSUITESREQUESTTYPE_DELETE_SUITES_REQUEST.Ptr(),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSyntheticsApi(apiClient)
	resp, r, err := api.DeleteSyntheticsSuites(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.DeleteSyntheticsSuites`:\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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Bulk delete suites returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SyntheticsApi;
import com.datadog.api.client.v2.model.DeletedSuitesRequestDelete;
import com.datadog.api.client.v2.model.DeletedSuitesRequestDeleteAttributes;
import com.datadog.api.client.v2.model.DeletedSuitesRequestDeleteRequest;
import com.datadog.api.client.v2.model.DeletedSuitesRequestType;
import com.datadog.api.client.v2.model.DeletedSuitesResponse;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);

    DeletedSuitesRequestDeleteRequest body =
        new DeletedSuitesRequestDeleteRequest()
            .data(
                new DeletedSuitesRequestDelete()
                    .attributes(
                        new DeletedSuitesRequestDeleteAttributes()
                            .publicIds(Collections.singletonList("")))
                    .type(DeletedSuitesRequestType.DELETE_SUITES_REQUEST));

    try {
      DeletedSuitesResponse result = apiInstance.deleteSyntheticsSuites(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#deleteSyntheticsSuites");
      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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Bulk delete suites returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_synthetics::SyntheticsAPI;
use datadog_api_client::datadogV2::model::DeletedSuitesRequestDelete;
use datadog_api_client::datadogV2::model::DeletedSuitesRequestDeleteAttributes;
use datadog_api_client::datadogV2::model::DeletedSuitesRequestDeleteRequest;
use datadog_api_client::datadogV2::model::DeletedSuitesRequestType;

#[tokio::main]
async fn main() {
    let body = DeletedSuitesRequestDeleteRequest::new(
        DeletedSuitesRequestDelete::new(DeletedSuitesRequestDeleteAttributes::new(vec![
            "".to_string()
        ]))
        .type_(DeletedSuitesRequestType::DELETE_SUITES_REQUEST),
    );
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api.delete_synthetics_suites(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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Bulk delete suites returns "OK" response
 */

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

const configuration = client.createConfiguration();
const apiInstance = new v2.SyntheticsApi(configuration);

const params: v2.SyntheticsApiDeleteSyntheticsSuitesRequest = {
  body: {
    data: {
      attributes: {
        publicIds: [""],
      },
      type: "delete_suites_request",
    },
  },
};

apiInstance
  .deleteSyntheticsSuites(params)
  .then((data: v2.DeletedSuitesResponse) => {
    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.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"