{"id":19054222,"url":"https://github.com/datadog/datadog-api-client-java","last_synced_at":"2025-04-04T11:16:56.360Z","repository":{"id":36958046,"uuid":"193793890","full_name":"DataDog/datadog-api-client-java","owner":"DataDog","description":"Java client for the Datadog API","archived":false,"fork":false,"pushed_at":"2025-03-31T23:37:21.000Z","size":71430,"stargazers_count":65,"open_issues_count":36,"forks_count":32,"subscribers_count":534,"default_branch":"master","last_synced_at":"2025-04-01T00:27:25.387Z","etag":null,"topics":["datadog","datadog-api","java-client","openapi"],"latest_commit_sha":null,"homepage":"https://www.javadoc.io/doc/com.datadoghq/datadog-api-client","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataDog.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-25T22:54:41.000Z","updated_at":"2025-03-31T17:51:58.000Z","dependencies_parsed_at":"2024-04-15T14:03:41.722Z","dependency_job_id":"139f7ebf-1138-4996-a3b3-7c7689ba46e6","html_url":"https://github.com/DataDog/datadog-api-client-java","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fdatadog-api-client-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDog","download_url":"https://codeload.github.com/DataDog/datadog-api-client-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166171,"owners_count":20894654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datadog","datadog-api","java-client","openapi"],"created_at":"2024-11-08T23:37:12.955Z","updated_at":"2025-04-04T11:16:56.330Z","avatar_url":"https://github.com/DataDog.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datadog-api-client-java\n\nThis repository contains a Java API client for the [Datadog API](https://docs.datadoghq.com/api/).\n\n## Requirements\n\nBuilding the API client library requires:\n\n1. Java 1.8+\n2. Maven/Gradle\n\n## Installation\n\nTo install the API client library to your local Maven repository, simply execute:\n\n```shell\nmvn clean install\n```\n\nTo deploy it to a remote Maven repository instead, configure the settings of the repository and execute:\n\n```shell\nmvn clean deploy\n```\n\nRefer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.\n\n### Maven users\n\nAdd this dependency to your project's POM:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.datadoghq\u003c/groupId\u003e\n  \u003cartifactId\u003edatadog-api-client\u003c/artifactId\u003e\n  \u003cversion\u003e2.10.0\u003c/version\u003e\n  \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nSee the [Releases page](https://github.com/DataDog/datadog-api-client-java/releases) for the latest available version.\n\n### Gradle users\n\nAdd this dependency to your project's build file:\n\n```groovy\ncompile \"com.datadoghq:datadog-api-client:2.0.0\"\n```\n\nSee the [Releases page](https://github.com/DataDog/datadog-api-client-java/releases) for the latest available version.\n\n### Others\n\nAt first generate the JAR by executing:\n\n```shell\nmvn clean package\n```\n\nThen manually install the following JARs:\n\n- `target/datadog-api-client-\u003cVERSION\u003e.jar`\n- `target/lib/*.jar`\n\n## Getting Started\n\nPlease follow the [installation](#installation) instruction and execute the following Java code:\n\n```java\nimport com.datadog.api.client.ApiClient;\nimport com.datadog.api.client.ApiException;\nimport com.datadog.api.client.v1.api.MonitorsApi;\nimport com.datadog.api.client.v1.model.Monitor;\nimport com.datadog.api.client.v1.model.MonitorType;\nimport java.util.Arrays;\n\npublic class MonitorCreatedExample {\n  public static void main(String[] args) {\n    ApiClient defaultClient = ApiClient.getDefaultApiClient();\n    MonitorsApi apiInstance = new MonitorsApi(defaultClient);\n\n    Monitor body =\n        new Monitor()\n            .name(\"my-monitor\")\n            .type(MonitorType.LOG_ALERT)\n            .query(\n                \"\"\"\nlogs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") \u003e 2\n\"\"\")\n            .message(\"some message Notify: @hipchat-channel\")\n            .tags(Arrays.asList(\"test:example\", \"env:ci\"))\n            .priority(3L);\n\n    try {\n      Monitor result = apiInstance.createMonitor(body);\n      System.out.println(result);\n    } catch (ApiException e) {\n      System.err.println(\"Exception when calling MonitorsApi#createMonitor\");\n      System.err.println(\"Status code: \" + e.getCode());\n      System.err.println(\"Reason: \" + e.getResponseBody());\n      System.err.println(\"Response headers: \" + e.getResponseHeaders());\n      e.printStackTrace();\n    }\n  }\n}\n\n```\n\n### Asynchronous support\n\nAll API methods have asynchronous versions returning `CompletableFuture` when adding the `Async` suffix to their names:\n\n```java\nimport com.datadog.api.client.ApiClient;\nimport com.datadog.api.client.v1.api.MonitorsApi;\n\npublic class ListMonitorsAsyncExample {\n  public static void main(String[] args) {\n    ApiClient defaultClient = ApiClient.getDefaultApiClient();\n    MonitorsApi apiInstance = new MonitorsApi(defaultClient);\n\n    apiInstance.listMonitorsAsync().thenApply(monitors -\u003e {\n      System.out.println(monitors);\n      return null;\n    }).exceptionally(error -\u003e {\n      System.out.println(error);\n      return null;\n    });\n  }\n}\n```\n\n### Unstable Endpoints\n\nThis client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints:\n\n```java\ndefaultClient.setUnstableOperationEnabled(\"\u003cVersion\u003e.\u003cOperationName\u003e\", true);\n```\n\nwhere `\u003cOperationName\u003e` is the name of the method used to interact with that endpoint. For example: `listSLOCorrection`, or `getSLOHistory`\n\n### Changing Server\n\nWhen talking to a different server, like the `eu` instance, change the `serverVariables` on your client:\n\n```java\nHashMap\u003cString, String\u003e serverVariables = new HashMap\u003cString, String\u003e();\nserverVariables.put(\"site\", \"datadoghq.eu\");\ndefaultApiClient.setServerVariables(serverVariables);\n```\n\n### Disable compressed payloads\n\nIf you want to disable GZIP compressed responses, set the `compress` flag\non your client:\n\n```java\ndefaultClient.setCompress(false)\n```\n\n### Enable requests logging\n\nIf you want to enable requests logging, set the `debugging` flag on your client:\n\n```java\ndefaultClient.setDebugging(true)\n```\n\n### Enable Retry\n\nTo enable the client to retry when rate limited (status 429) or status 500 and above:\n\n```java\ndefaultClient.enableRetry(true)\n```\n\nThe interval between 2 retry attempts will be the value of the `x-ratelimit-reset` response header when available. If not, it will be :\n`Math.pow (multiplier_for_retry_backoff, current_retry_count)*base_for_retry_backoff`.\n\n### Configure proxy\n\nYou can provide custom `connectorProvider` implementation to `clientConfig` to use proxy. See example below using `ApacheConnectorProvider`:\n\n```java\nimport org.glassfish.jersey.apache.connector.ApacheConnectorProvider;\nimport org.glassfish.jersey.client.ClientConfig;\nimport org.glassfish.jersey.client.ClientProperties;\n\nimport com.datadog.api.client.ApiClient;\nimport com.datadog.api.client.ApiException;\nimport com.datadog.api.client.v1.api.DashboardsApi;\nimport com.datadog.api.client.v1.model.DashboardSummary;\n\npublic class ProxyExample {\n  public static void main( String[] args ) {\n    ApiClient defaultClient = ApiClient.getDefaultApiClient();\n    ClientConfig clientConfig = defaultClient.getClientConfig().connectorProvider(new ApacheConnectorProvider());\n    clientConfig.property(ClientProperties.PROXY_URI, \"http://127.0.0.1:80\");\n    defaultClient.setClientConfig(clientConfig);\n\n    DashboardsApi apiInstance = new DashboardsApi(defaultClient);\n    try {\n      DashboardSummary result =\n          apiInstance.listDashboards();\n      System.out.println(result);\n    } catch (ApiException e) {\n      System.err.println(\"Exception when calling DashboardsApi#listDashboards\");\n      System.err.println(\"Status code: \" + e.getCode());\n      System.err.println(\"Reason: \" + e.getResponseBody());\n      System.err.println(\"Response headers: \" + e.getResponseHeaders());\n      e.printStackTrace();\n    }\n  }\n}\n```\n\n### Using alternative artifacts\n\nOutside of the regular JAR file we also release 2 artifacts that can be useful for development, namely:\n\n- `jar-with-dependencies`, which contains all the dependencies of the client in a single JAR\n- `shaded-jar`, which includes and renames the core dependencies of the client, allowing you to use different versions of those\n  libraries in your project.\n\nTo use them in Maven, just add the `classifier` keyword in the dependency definition. For example:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.datadoghq\u003c/groupId\u003e\n  \u003cartifactId\u003edatadog-api-client\u003c/artifactId\u003e\n  \u003cversion\u003e2.10.0\u003c/version\u003e\n  \u003cclassifier\u003eshaded-jar\u003c/classifier\u003e\n  \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n## Documentation for API Endpoints and Models\n\nJavadoc is available on [javadoc.io](https://www.javadoc.io/doc/com.datadoghq/datadog-api-client/latest/).\n\n## Documentation for Authorization\n\nTo programmatically defined authorization headers, calls the `configureApiKeys`\nmethod with a map containing the required secrets for the operations:\n\n```java\nHashMap\u003cString, String\u003e secrets = new HashMap\u003c\u003e();\nsecrets.put(\"apiKeyAuth\", \"\u003cYOUR API KEY\u003e\");\nsecrets.put(\"appKeyAuth\", \"\u003cYOUR APPLICATION KEY\u003e\");\ngeneralApiClient.configureApiKeys(secrets);\n```\n\n## Recommendation\n\nIt's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.\n\n## Author\n\nsupport@datadoghq.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fdatadog-api-client-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatadog%2Fdatadog-api-client-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fdatadog-api-client-java/lists"}