Service Definition

API to create, update, retrieve and delete service definitions.

GET https://api.datadoghq.eu/api/v2/services/definitionshttps://api.ddog-gov.com/api/v2/services/definitionshttps://api.datadoghq.com/api/v2/services/definitionshttps://api.us3.datadoghq.com/api/v2/services/definitionshttps://api.us5.datadoghq.com/api/v2/services/definitions

Overview

Get a list of all service definitions from the Datadog Service Catalog.

Response

OK

Create service definitions response.

Expand All

Field

Type

Description

data

[object]

Data representing service definitions.

attributes

object

Service definition attributes.

meta

object

Metadata about a service definition.

github-html-url

string

GitHub HTML URL.

ingested-schema-version

string

Ingestion schema version.

ingestion-source

string

Ingestion source of the service definition.

last-modified-time

string

Last modified time of the service definition.

schema

object <oneOf>

Service definition schema.

Option 1

object

DEPRECATED: Deprecated - Service definition V1 for providing additional service metadata and integrations.

contact

Contact information about the service.

email

email

Service owner’s email.

slack

string

Service owner’s Slack channel.

extensions

object

Extensions to V1 schema.

external-resources

[object]

A list of external links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

info [required]

object

Basic information about a service.

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

description

string

A short description of the service.

display-name

string

A friendly name of the service.

service-tier

string

Service tier.

integrations

object

Third party integrations that Datadog supports.

pagerduty

string

PagerDuty service URL for the service.

org

object

Org related information about the service.

application

string

App feature this service supports.

team

string

Team that owns the service.

schema-version [required]

enum

Schema version being used. Allowed enum values: v1

tags

[string]

A set of custom tags.

Option 2

object

Service definition V2 for providing service metadata and integrations.

contacts

[ <oneOf>]

A list of contacts related to the services.

Option 1

object

Service owner's email.

contact [required]

email

Contact value.

name

string

Contact email.

type [required]

enum

Contact type. Allowed enum values: email

Option 2

object

Service owner's Slack channel.

contact [required]

string

Slack Channel.

name

string

Contact Slack.

type [required]

enum

Contact type. Allowed enum values: slack

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

dd-team

string

Experimental feature. A Team handle that matches a Team in the Datadog Teams product.

docs

[object]

A list of documentation related to the services.

name [required]

string

Document name.

provider

string

Document provider.

url [required]

string

Document URL.

extensions

object

Extensions to V2 schema.

integrations

object

Third party integrations that Datadog supports.

opsgenie

object

Opsgenie integration for the service.

region

enum

Opsgenie instance region. Allowed enum values: US,EU

service-url [required]

string

Opsgenie service url.

pagerduty

string

PagerDuty service URL for the service.

links

[object]

A list of links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

repos

[object]

A list of code repositories related to the services.

name [required]

string

Repository name.

provider

string

Repository provider.

url [required]

string

Repository URL.

schema-version [required]

enum

Schema version being used. Allowed enum values: v2

tags

[string]

A set of custom tags.

team

string

Team that owns the service.

type

string

Service definition type.

{
  "data": [
    {
      "attributes": {
        "meta": {
          "github-html-url": "string",
          "ingested-schema-version": "string",
          "ingestion-source": "string",
          "last-modified-time": "string"
        },
        "schema": {
          "contact": {
            "email": "contact@datadoghq.com",
            "slack": "https://yourcompany.slack.com/archives/channel123"
          },
          "extensions": {
            "myorg/extension": "extensionValue"
          },
          "external-resources": [
            {
              "name": "Runbook",
              "type": "runbook",
              "url": "https://my-runbook"
            }
          ],
          "info": {
            "dd-service": "myservice",
            "description": "A shopping cart service",
            "display-name": "My Service",
            "service-tier": "Tier 1"
          },
          "integrations": {
            "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"
          },
          "org": {
            "application": "E-Commerce",
            "team": "my-team"
          },
          "schema-version": "v1",
          "tags": [
            "my:tag",
            "service:tag"
          ]
        }
      },
      "type": "string"
    }
  ]
}

Forbidden

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


# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/services/definitions" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// Get all service definitions 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewServiceDefinitionApi(apiClient)
	resp, r, err := api.ListServiceDefinitions(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.ListServiceDefinitions`:\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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get all service definitions returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
import com.datadog.api.client.v2.model.ServiceDefinitionsListResponse;

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

    try {
      ServiceDefinitionsListResponse result = apiInstance.listServiceDefinitions();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ServiceDefinitionApi#listServiceDefinitions");
      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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Get all service definitions returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceDefinitionApi(api_client)
    response = api_instance.list_service_definitions()

    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get all service definitions returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new
p api_instance.list_service_definitions()

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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Get all service definitions returns "OK" response
 */

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

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

apiInstance
  .listServiceDefinitions()
  .then((data: v2.ServiceDefinitionsListResponse) => {
    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

POST https://api.datadoghq.eu/api/v2/services/definitionshttps://api.ddog-gov.com/api/v2/services/definitionshttps://api.datadoghq.com/api/v2/services/definitionshttps://api.us3.datadoghq.com/api/v2/services/definitionshttps://api.us5.datadoghq.com/api/v2/services/definitions

Overview

Create or update service definition in the Datadog Service Catalog.

Request

Body Data (required)

Service Definition YAML/JSON.

Expand All

Field

Type

Description

Option 1

object

Service definition V2 for providing service metadata and integrations.

contacts

[ <oneOf>]

A list of contacts related to the services.

Option 1

object

Service owner's email.

contact [required]

email

Contact value.

name

string

Contact email.

type [required]

enum

Contact type. Allowed enum values: email

Option 2

object

Service owner's Slack channel.

contact [required]

string

Slack Channel.

name

string

Contact Slack.

type [required]

enum

Contact type. Allowed enum values: slack

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

dd-team

string

Experimental feature. A Team handle that matches a Team in the Datadog Teams product.

docs

[object]

A list of documentation related to the services.

name [required]

string

Document name.

provider

string

Document provider.

url [required]

string

Document URL.

extensions

object

Extensions to V2 schema.

integrations

object

Third party integrations that Datadog supports.

opsgenie

object

Opsgenie integration for the service.

region

enum

Opsgenie instance region. Allowed enum values: US,EU

service-url [required]

string

Opsgenie service url.

pagerduty

string

PagerDuty service URL for the service.

links

[object]

A list of links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

repos

[object]

A list of code repositories related to the services.

name [required]

string

Repository name.

provider

string

Repository provider.

url [required]

string

Repository URL.

schema-version [required]

enum

Schema version being used. Allowed enum values: v2

tags

[string]

A set of custom tags.

team

string

Team that owns the service.

Option 2

string

Service Definition in raw JSON/YAML representation.

{
  "contacts": [
    {
      "contact": "contact@datadoghq.com",
      "name": "Team Email",
      "type": "email"
    }
  ],
  "dd-service": "service-Example-Create_or_update_service_definition_returns_CREATED_response",
  "dd-team": "my-team",
  "docs": [
    {
      "name": "Architecture",
      "provider": "google drive",
      "url": "https://gdrive/mydoc"
    }
  ],
  "extensions": {
    "myorgextension": "extensionvalue"
  },
  "integrations": {
    "opsgenie": {
      "region": "US",
      "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
    },
    "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"
  },
  "links": [
    {
      "name": "Runbook",
      "type": "runbook",
      "url": "https://my-runbook"
    }
  ],
  "repos": [
    {
      "name": "Source Code",
      "provider": "GitHub",
      "url": "https://github.com/DataDog/schema"
    }
  ],
  "schema-version": "v2",
  "tags": [
    "my:tag",
    "service:tag"
  ],
  "team": "my-team"
}

Response

CREATED

Create service definitions response.

Expand All

Field

Type

Description

data

[object]

Create service definitions response payload.

attributes

object

Service definition attributes.

meta

object

Metadata about a service definition.

github-html-url

string

GitHub HTML URL.

ingested-schema-version

string

Ingestion schema version.

ingestion-source

string

Ingestion source of the service definition.

last-modified-time

string

Last modified time of the service definition.

schema

object <oneOf>

Service definition schema.

Option 1

object

DEPRECATED: Deprecated - Service definition V1 for providing additional service metadata and integrations.

contact

Contact information about the service.

email

email

Service owner’s email.

slack

string

Service owner’s Slack channel.

extensions

object

Extensions to V1 schema.

external-resources

[object]

A list of external links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

info [required]

object

Basic information about a service.

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

description

string

A short description of the service.

display-name

string

A friendly name of the service.

service-tier

string

Service tier.

integrations

object

Third party integrations that Datadog supports.

pagerduty

string

PagerDuty service URL for the service.

org

object

Org related information about the service.

application

string

App feature this service supports.

team

string

Team that owns the service.

schema-version [required]

enum

Schema version being used. Allowed enum values: v1

tags

[string]

A set of custom tags.

Option 2

object

Service definition V2 for providing service metadata and integrations.

contacts

[ <oneOf>]

A list of contacts related to the services.

Option 1

object

Service owner's email.

contact [required]

email

Contact value.

name

string

Contact email.

type [required]

enum

Contact type. Allowed enum values: email

Option 2

object

Service owner's Slack channel.

contact [required]

string

Slack Channel.

name

string

Contact Slack.

type [required]

enum

Contact type. Allowed enum values: slack

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

dd-team

string

Experimental feature. A Team handle that matches a Team in the Datadog Teams product.

docs

[object]

A list of documentation related to the services.

name [required]

string

Document name.

provider

string

Document provider.

url [required]

string

Document URL.

extensions

object

Extensions to V2 schema.

integrations

object

Third party integrations that Datadog supports.

opsgenie

object

Opsgenie integration for the service.

region

enum

Opsgenie instance region. Allowed enum values: US,EU

service-url [required]

string

Opsgenie service url.

pagerduty

string

PagerDuty service URL for the service.

links

[object]

A list of links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

repos

[object]

A list of code repositories related to the services.

name [required]

string

Repository name.

provider

string

Repository provider.

url [required]

string

Repository URL.

schema-version [required]

enum

Schema version being used. Allowed enum values: v2

tags

[string]

A set of custom tags.

team

string

Team that owns the service.

type

string

Service definition type.

{
  "data": [
    {
      "attributes": {
        "meta": {
          "github-html-url": "string",
          "ingested-schema-version": "string",
          "ingestion-source": "string",
          "last-modified-time": "string"
        },
        "schema": {
          "contact": {
            "email": "contact@datadoghq.com",
            "slack": "https://yourcompany.slack.com/archives/channel123"
          },
          "extensions": {
            "myorg/extension": "extensionValue"
          },
          "external-resources": [
            {
              "name": "Runbook",
              "type": "runbook",
              "url": "https://my-runbook"
            }
          ],
          "info": {
            "dd-service": "myservice",
            "description": "A shopping cart service",
            "display-name": "My Service",
            "service-tier": "Tier 1"
          },
          "integrations": {
            "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"
          },
          "org": {
            "application": "E-Commerce",
            "team": "my-team"
          },
          "schema-version": "v1",
          "tags": [
            "my:tag",
            "service:tag"
          ]
        }
      },
      "type": "string"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Conflict

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

  
  # Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/services/definitions" \
-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
{
  "contacts": [
    {
      "contact": "contact@datadoghq.com",
      "name": "Team Email",
      "type": "email"
    }
  ],
  "dd-service": "service-Example-Create_or_update_service_definition_returns_CREATED_response",
  "dd-team": "my-team",
  "docs": [
    {
      "name": "Architecture",
      "provider": "google drive",
      "url": "https://gdrive/mydoc"
    }
  ],
  "extensions": {
    "myorgextension": "extensionvalue"
  },
  "integrations": {
    "opsgenie": {
      "region": "US",
      "service-url": "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
    },
    "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"
  },
  "links": [
    {
      "name": "Runbook",
      "type": "runbook",
      "url": "https://my-runbook"
    }
  ],
  "repos": [
    {
      "name": "Source Code",
      "provider": "GitHub",
      "url": "https://github.com/DataDog/schema"
    }
  ],
  "schema-version": "v2",
  "tags": [
    "my:tag",
    "service:tag"
  ],
  "team": "my-team"
}
EOF
// Create or update service definition returns "CREATED" 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.ServiceDefinitionsCreateRequest{
		ServiceDefinitionV2: &datadogV2.ServiceDefinitionV2{
			Contacts: []datadogV2.ServiceDefinitionV2Contact{
				datadogV2.ServiceDefinitionV2Contact{
					ServiceDefinitionV2Email: &datadogV2.ServiceDefinitionV2Email{
						Contact: "contact@datadoghq.com",
						Name:    datadog.PtrString("Team Email"),
						Type:    datadogV2.SERVICEDEFINITIONV2EMAILTYPE_EMAIL,
					}},
			},
			DdService: "service-Example-Create_or_update_service_definition_returns_CREATED_response",
			DdTeam:    datadog.PtrString("my-team"),
			Docs: []datadogV2.ServiceDefinitionV2Doc{
				{
					Name:     "Architecture",
					Provider: datadog.PtrString("google drive"),
					Url:      "https://gdrive/mydoc",
				},
			},
			Extensions: map[string]interface{}{
				"myorgextension": "extensionvalue",
			},
			Integrations: &datadogV2.ServiceDefinitionV2Integrations{
				Opsgenie: &datadogV2.ServiceDefinitionV2Opsgenie{
					Region:    datadogV2.SERVICEDEFINITIONV2OPSGENIEREGION_US.Ptr(),
					ServiceId: "123e4567-e89b-12d3-a456-426614174000",
				},
				Pagerduty: datadog.PtrString("https://my-org.pagerduty.com/service-directory/PMyService"),
			},
			Links: []datadogV2.ServiceDefinitionV2Link{
				{
					Name: "Runbook",
					Type: datadogV2.SERVICEDEFINITIONV2LINKTYPE_RUNBOOK,
					Url:  "https://my-runbook",
				},
			},
			Repos: []datadogV2.ServiceDefinitionV2Repo{
				{
					Name:     "Source Code",
					Provider: datadog.PtrString("GitHub"),
					Url:      "https://github.com/DataDog/schema",
				},
			},
			SchemaVersion: datadogV2.SERVICEDEFINITIONV2VERSION_V2,
			Tags: []string{
				"my:tag",
				"service:tag",
			},
			Team: datadog.PtrString("my-team"),
		}}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewServiceDefinitionApi(apiClient)
	resp, r, err := api.CreateOrUpdateServiceDefinitions(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.CreateOrUpdateServiceDefinitions`:\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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Create or update service definition returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
import com.datadog.api.client.v2.model.ServiceDefinitionCreateResponse;
import com.datadog.api.client.v2.model.ServiceDefinitionV2;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Contact;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Doc;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Email;
import com.datadog.api.client.v2.model.ServiceDefinitionV2EmailType;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Integrations;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Link;
import com.datadog.api.client.v2.model.ServiceDefinitionV2LinkType;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Opsgenie;
import com.datadog.api.client.v2.model.ServiceDefinitionV2OpsgenieRegion;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Repo;
import com.datadog.api.client.v2.model.ServiceDefinitionV2Version;
import com.datadog.api.client.v2.model.ServiceDefinitionsCreateRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

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

    ServiceDefinitionsCreateRequest body =
        new ServiceDefinitionsCreateRequest(
            new ServiceDefinitionV2()
                .contacts(
                    Collections.singletonList(
                        new ServiceDefinitionV2Contact(
                            new ServiceDefinitionV2Email()
                                .contact("contact@datadoghq.com")
                                .name("Team Email")
                                .type(ServiceDefinitionV2EmailType.EMAIL))))
                .ddService(
                    "service-Example-Create_or_update_service_definition_returns_CREATED_response")
                .ddTeam("my-team")
                .docs(
                    Collections.singletonList(
                        new ServiceDefinitionV2Doc()
                            .name("Architecture")
                            .provider("google drive")
                            .url("https://gdrive/mydoc")))
                .extensions(Map.ofEntries(Map.entry("myorgextension", "extensionvalue")))
                .integrations(
                    new ServiceDefinitionV2Integrations()
                        .opsgenie(
                            new ServiceDefinitionV2Opsgenie()
                                .region(ServiceDefinitionV2OpsgenieRegion.US)
                                .serviceUrl(
                                    "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"))
                        .pagerduty("https://my-org.pagerduty.com/service-directory/PMyService"))
                .links(
                    Collections.singletonList(
                        new ServiceDefinitionV2Link()
                            .name("Runbook")
                            .type(ServiceDefinitionV2LinkType.RUNBOOK)
                            .url("https://my-runbook")))
                .repos(
                    Collections.singletonList(
                        new ServiceDefinitionV2Repo()
                            .name("Source Code")
                            .provider("GitHub")
                            .url("https://github.com/DataDog/schema")))
                .schemaVersion(ServiceDefinitionV2Version.V2)
                .tags(Arrays.asList("my:tag", "service:tag"))
                .team("my-team"));

    try {
      ServiceDefinitionCreateResponse result = apiInstance.createOrUpdateServiceDefinitions(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling ServiceDefinitionApi#createOrUpdateServiceDefinitions");
      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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Create or update service definition returns "CREATED" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi
from datadog_api_client.v2.model.service_definition_v2 import ServiceDefinitionV2
from datadog_api_client.v2.model.service_definition_v2_doc import ServiceDefinitionV2Doc
from datadog_api_client.v2.model.service_definition_v2_email import ServiceDefinitionV2Email
from datadog_api_client.v2.model.service_definition_v2_email_type import ServiceDefinitionV2EmailType
from datadog_api_client.v2.model.service_definition_v2_integrations import ServiceDefinitionV2Integrations
from datadog_api_client.v2.model.service_definition_v2_link import ServiceDefinitionV2Link
from datadog_api_client.v2.model.service_definition_v2_link_type import ServiceDefinitionV2LinkType
from datadog_api_client.v2.model.service_definition_v2_opsgenie import ServiceDefinitionV2Opsgenie
from datadog_api_client.v2.model.service_definition_v2_opsgenie_region import ServiceDefinitionV2OpsgenieRegion
from datadog_api_client.v2.model.service_definition_v2_repo import ServiceDefinitionV2Repo
from datadog_api_client.v2.model.service_definition_v2_version import ServiceDefinitionV2Version

body = ServiceDefinitionV2(
    contacts=[
        ServiceDefinitionV2Email(
            contact="contact@datadoghq.com",
            name="Team Email",
            type=ServiceDefinitionV2EmailType.EMAIL,
        ),
    ],
    dd_service="service-Example-Create_or_update_service_definition_returns_CREATED_response",
    dd_team="my-team",
    docs=[
        ServiceDefinitionV2Doc(
            name="Architecture",
            provider="google drive",
            url="https://gdrive/mydoc",
        ),
    ],
    extensions=dict(myorgextension="extensionvalue"),
    integrations=ServiceDefinitionV2Integrations(
        opsgenie=ServiceDefinitionV2Opsgenie(
            region=ServiceDefinitionV2OpsgenieRegion.US,
            service_url="https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
        ),
        pagerduty="https://my-org.pagerduty.com/service-directory/PMyService",
    ),
    links=[
        ServiceDefinitionV2Link(
            name="Runbook",
            type=ServiceDefinitionV2LinkType.RUNBOOK,
            url="https://my-runbook",
        ),
    ],
    repos=[
        ServiceDefinitionV2Repo(
            name="Source Code",
            provider="GitHub",
            url="https://github.com/DataDog/schema",
        ),
    ],
    schema_version=ServiceDefinitionV2Version.V2,
    tags=[
        "my:tag",
        "service:tag",
    ],
    team="my-team",
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceDefinitionApi(api_client)
    response = api_instance.create_or_update_service_definitions(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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Create or update service definition returns "CREATED" response

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

body = DatadogAPIClient::V2::ServiceDefinitionV2.new({
  contacts: [
    DatadogAPIClient::V2::ServiceDefinitionV2Email.new({
      contact: "contact@datadoghq.com",
      name: "Team Email",
      type: DatadogAPIClient::V2::ServiceDefinitionV2EmailType::EMAIL,
    }),
  ],
  dd_service: "service-Example-Create_or_update_service_definition_returns_CREATED_response",
  dd_team: "my-team",
  docs: [
    DatadogAPIClient::V2::ServiceDefinitionV2Doc.new({
      name: "Architecture",
      provider: "google drive",
      url: "https://gdrive/mydoc",
    }),
  ],
  extensions: {
    myorgextension: "extensionvalue",
  },
  integrations: DatadogAPIClient::V2::ServiceDefinitionV2Integrations.new({
    opsgenie: DatadogAPIClient::V2::ServiceDefinitionV2Opsgenie.new({
      region: DatadogAPIClient::V2::ServiceDefinitionV2OpsgenieRegion::US,
      service_url: "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
    }),
    pagerduty: "https://my-org.pagerduty.com/service-directory/PMyService",
  }),
  links: [
    DatadogAPIClient::V2::ServiceDefinitionV2Link.new({
      name: "Runbook",
      type: DatadogAPIClient::V2::ServiceDefinitionV2LinkType::RUNBOOK,
      url: "https://my-runbook",
    }),
  ],
  repos: [
    DatadogAPIClient::V2::ServiceDefinitionV2Repo.new({
      name: "Source Code",
      provider: "GitHub",
      url: "https://github.com/DataDog/schema",
    }),
  ],
  schema_version: DatadogAPIClient::V2::ServiceDefinitionV2Version::V2,
  tags: [
    "my:tag",
    "service:tag",
  ],
  team: "my-team",
})
p api_instance.create_or_update_service_definitions(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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Create or update service definition returns "CREATED" response
 */

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

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

const params: v2.ServiceDefinitionApiCreateOrUpdateServiceDefinitionsRequest = {
  body: {
    contacts: [
      {
        contact: "contact@datadoghq.com",
        name: "Team Email",
        type: "email",
      },
    ],
    ddService:
      "service-Example-Create_or_update_service_definition_returns_CREATED_response",
    ddTeam: "my-team",
    docs: [
      {
        name: "Architecture",
        provider: "google drive",
        url: "https://gdrive/mydoc",
      },
    ],
    extensions: {
      myorgextension: "extensionvalue",
    },
    integrations: {
      opsgenie: {
        region: "US",
        serviceUrl:
          "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000",
      },
      pagerduty: "https://my-org.pagerduty.com/service-directory/PMyService",
    },
    links: [
      {
        name: "Runbook",
        type: "runbook",
        url: "https://my-runbook",
      },
    ],
    repos: [
      {
        name: "Source Code",
        provider: "GitHub",
        url: "https://github.com/DataDog/schema",
      },
    ],
    schemaVersion: "v2",
    tags: ["my:tag", "service:tag"],
    team: "my-team",
  },
};

apiInstance
  .createOrUpdateServiceDefinitions(params)
  .then((data: v2.ServiceDefinitionCreateResponse) => {
    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.datadoghq.eu/api/v2/services/definitions/{service_name}https://api.ddog-gov.com/api/v2/services/definitions/{service_name}https://api.datadoghq.com/api/v2/services/definitions/{service_name}https://api.us3.datadoghq.com/api/v2/services/definitions/{service_name}https://api.us5.datadoghq.com/api/v2/services/definitions/{service_name}

Overview

Get a single service definition from the Datadog Service Catalog.

Arguments

Path Parameters

Name

Type

Description

service_name [required]

string

The name of the service.

Response

OK

Get service definition response.

Expand All

Field

Type

Description

data

object

Service definition data.

attributes

object

Service definition attributes.

meta

object

Metadata about a service definition.

github-html-url

string

GitHub HTML URL.

ingested-schema-version

string

Ingestion schema version.

ingestion-source

string

Ingestion source of the service definition.

last-modified-time

string

Last modified time of the service definition.

schema

object <oneOf>

Service definition schema.

Option 1

object

DEPRECATED: Deprecated - Service definition V1 for providing additional service metadata and integrations.

contact

Contact information about the service.

email

email

Service owner’s email.

slack

string

Service owner’s Slack channel.

extensions

object

Extensions to V1 schema.

external-resources

[object]

A list of external links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

info [required]

object

Basic information about a service.

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

description

string

A short description of the service.

display-name

string

A friendly name of the service.

service-tier

string

Service tier.

integrations

object

Third party integrations that Datadog supports.

pagerduty

string

PagerDuty service URL for the service.

org

object

Org related information about the service.

application

string

App feature this service supports.

team

string

Team that owns the service.

schema-version [required]

enum

Schema version being used. Allowed enum values: v1

tags

[string]

A set of custom tags.

Option 2

object

Service definition V2 for providing service metadata and integrations.

contacts

[ <oneOf>]

A list of contacts related to the services.

Option 1

object

Service owner's email.

contact [required]

email

Contact value.

name

string

Contact email.

type [required]

enum

Contact type. Allowed enum values: email

Option 2

object

Service owner's Slack channel.

contact [required]

string

Slack Channel.

name

string

Contact Slack.

type [required]

enum

Contact type. Allowed enum values: slack

dd-service [required]

string

Unique identifier of the service. Must be unique across all services and is used to match with a service in Datadog.

dd-team

string

Experimental feature. A Team handle that matches a Team in the Datadog Teams product.

docs

[object]

A list of documentation related to the services.

name [required]

string

Document name.

provider

string

Document provider.

url [required]

string

Document URL.

extensions

object

Extensions to V2 schema.

integrations

object

Third party integrations that Datadog supports.

opsgenie

object

Opsgenie integration for the service.

region

enum

Opsgenie instance region. Allowed enum values: US,EU

service-url [required]

string

Opsgenie service url.

pagerduty

string

PagerDuty service URL for the service.

links

[object]

A list of links related to the services.

name [required]

string

Link name.

type [required]

enum

Link type. Allowed enum values: doc,wiki,runbook,url,repo,dashboard,oncall,code,link

url [required]

string

Link URL.

repos

[object]

A list of code repositories related to the services.

name [required]

string

Repository name.

provider

string

Repository provider.

url [required]

string

Repository URL.

schema-version [required]

enum

Schema version being used. Allowed enum values: v2

tags

[string]

A set of custom tags.

team

string

Team that owns the service.

type

string

Service definition type.

{
  "data": {
    "attributes": {
      "meta": {
        "github-html-url": "string",
        "ingested-schema-version": "string",
        "ingestion-source": "string",
        "last-modified-time": "string"
      },
      "schema": {
        "contact": {
          "email": "contact@datadoghq.com",
          "slack": "https://yourcompany.slack.com/archives/channel123"
        },
        "extensions": {
          "myorg/extension": "extensionValue"
        },
        "external-resources": [
          {
            "name": "Runbook",
            "type": "runbook",
            "url": "https://my-runbook"
          }
        ],
        "info": {
          "dd-service": "myservice",
          "description": "A shopping cart service",
          "display-name": "My Service",
          "service-tier": "Tier 1"
        },
        "integrations": {
          "pagerduty": "https://my-org.pagerduty.com/service-directory/PMyService"
        },
        "org": {
          "application": "E-Commerce",
          "team": "my-team"
        },
        "schema-version": "v1",
        "tags": [
          "my:tag",
          "service:tag"
        ]
      }
    },
    "type": "string"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Conflict

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


# Path parameters
export service_name="my-service"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/services/definitions/${service_name}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// Get a single service definition 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewServiceDefinitionApi(apiClient)
	resp, r, err := api.GetServiceDefinition(ctx, "service-Example-Get_a_single_service_definition_returns_OK_response")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ServiceDefinitionApi.GetServiceDefinition`:\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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get a single service definition returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;
import com.datadog.api.client.v2.model.ServiceDefinitionGetResponse;

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

    try {
      ServiceDefinitionGetResponse result =
          apiInstance.getServiceDefinition("service-definition-test");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ServiceDefinitionApi#getServiceDefinition");
      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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Get a single service definition returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceDefinitionApi(api_client)
    response = api_instance.get_service_definition(
        service_name="service-definition-test",
    )

    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get a single service definition returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new
p api_instance.get_service_definition("service-definition-test")

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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Get a single service definition returns "OK" response
 */

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

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

const params: v2.ServiceDefinitionApiGetServiceDefinitionRequest = {
  serviceName: "service-definition-test",
};

apiInstance
  .getServiceDefinition(params)
  .then((data: v2.ServiceDefinitionGetResponse) => {
    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

DELETE https://api.datadoghq.eu/api/v2/services/definitions/{service_name}https://api.ddog-gov.com/api/v2/services/definitions/{service_name}https://api.datadoghq.com/api/v2/services/definitions/{service_name}https://api.us3.datadoghq.com/api/v2/services/definitions/{service_name}https://api.us5.datadoghq.com/api/v2/services/definitions/{service_name}

Overview

Delete a single service definition in the Datadog Service Catalog.

Arguments

Path Parameters

Name

Type

Description

service_name [required]

string

The name of the service.

Response

OK

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Not Found

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


# Path parameters
export service_name="my-service"
# Curl command curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/services/definitions/${service_name}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// Delete a single service definition returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewServiceDefinitionApi(apiClient)
	r, err := api.DeleteServiceDefinition(ctx, "service-Example-Delete_a_single_service_definition_returns_OK_response")

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

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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Delete a single service definition returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ServiceDefinitionApi;

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

    try {
      apiInstance.deleteServiceDefinition("service-definition-test");
    } catch (ApiException e) {
      System.err.println("Exception when calling ServiceDefinitionApi#deleteServiceDefinition");
      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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Delete a single service definition returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceDefinitionApi(api_client)
    api_instance.delete_service_definition(
        service_name="service-definition-test",
    )

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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Delete a single service definition returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ServiceDefinitionAPI.new
api_instance.delete_service_definition("service-definition-test")

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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Delete a single service definition returns "OK" response
 */

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

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

const params: v2.ServiceDefinitionApiDeleteServiceDefinitionRequest = {
  serviceName: "service-definition-test",
};

apiInstance
  .deleteServiceDefinition(params)
  .then((data: any) => {
    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.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"