GET https://api.ap1.datadoghq.com/api/v2/containers https://api.datadoghq.eu/api/v2/containers https://api.ddog-gov.com/api/v2/containers https://api.datadoghq.com/api/v2/containers https://api.us3.datadoghq.com/api/v2/containers https://api.us5.datadoghq.com/api/v2/containers
Overview Get all containers for your organization.
Arguments Query Strings Comma-separated list of tags to filter containers by.
Comma-separated list of tags to group containers by.
Attribute to sort containers by.
Maximum number of results returned.
String to query the next page of results.
This key is provided with each valid response from the API in meta.pagination.next_cursor
.
Response OK
List of containers.
Expand All
Array of Container objects.
Attributes for a container.
Time the container was created.
Hostname of the host running the container.
Digest of the compressed image manifest.
Name of the associated container image.
List of image tags associated with the container image.
Time the container was started.
State of the container. This depends on the container runtime.
List of tags associated with the container.
Type of container.
Allowed enum values: container
default: container
Attributes for a container group.
Number of containers in the group.
Tags from the group name parsed in key/value format.
Relationships to containers inside a container group.
Relationships to Containers inside a Container Group.
Link to related containers.
Type of container group.
Allowed enum values: container_group
default: container_group
Response metadata object.
The cursor used to get the current results, if any.
Number of results returned
The cursor used to get the next results, if any.
The cursor used to get the previous results, if any.
Total number of records that match the query.
Type of Container pagination.
Allowed enum values: cursor_limit
default: cursor_limit
{
"data" : [
{
"attributes" : {
"container_id" : "string" ,
"created_at" : "string" ,
"host" : "string" ,
"image_digest" : "string" ,
"image_name" : "string" ,
"image_tags" : [],
"name" : "string" ,
"started_at" : "string" ,
"state" : "string" ,
"tags" : []
},
"id" : "string" ,
"type" : "container"
}
],
"links" : {
"first" : "string" ,
"last" : "string" ,
"next" : "string" ,
"prev" : "string" ,
"self" : "string"
},
"meta" : {
"pagination" : {
"cursor" : "string" ,
"limit" : "integer" ,
"next_cursor" : "string" ,
"prev_cursor" : "string" ,
"total" : "integer" ,
"type" : "cursor_limit"
}
}
}
Bad Request
{
"errors" : [
"Bad Request"
]
}
Authentication Error
{
"errors" : [
"Bad Request"
]
}
Too many requests
{
"errors" : [
"Bad Request"
]
}
Code Example Copy
# Curl command curl -X GET "https://api.ap1.datadoghq.com "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/containers " \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY} " \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY} "
"""
Get All Containers returns "OK" response
"""
from datadog_api_client import ApiClient , Configuration
from datadog_api_client.v2.api.containers_api import ContainersApi
configuration = Configuration ()
with ApiClient ( configuration ) as api_client :
api_instance = ContainersApi ( api_client )
response = api_instance . list_containers ()
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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ddog-gov.com " DD_API_KEY = "<DD_API_KEY>" DD_APP_KEY = "<DD_APP_KEY>" python3 "example.py"
# Get All Containers returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient :: V2 :: ContainersAPI . new
p api_instance . list_containers ()
Instructions First install the library and its dependencies and then save the example to example.rb
and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ddog-gov.com " DD_API_KEY = "<DD_API_KEY>" DD_APP_KEY = "<DD_APP_KEY>" rb "example.rb"
// Get All Containers 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 . NewContainersApi ( apiClient )
resp , r , err := api . ListContainers ( ctx , * datadogV2 . NewListContainersOptionalParameters ())
if err != nil {
fmt . Fprintf ( os . Stderr , "Error when calling `ContainersApi.ListContainers`: %v\n" , err )
fmt . Fprintf ( os . Stderr , "Full HTTP response: %v\n" , r )
}
responseContent , _ := json . MarshalIndent ( resp , "" , " " )
fmt . Fprintf ( os . Stdout , "Response from `ContainersApi.ListContainers`:\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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ddog-gov.com " DD_API_KEY = "<DD_API_KEY>" DD_APP_KEY = "<DD_APP_KEY>" go run "main.go"
// Get All Containers returns "OK" response
import com.datadog.api.client.ApiClient ;
import com.datadog.api.client.ApiException ;
import com.datadog.api.client.v2.api.ContainersApi ;
import com.datadog.api.client.v2.model.ContainersResponse ;
public class Example {
public static void main ( String [] args ) {
ApiClient defaultClient = ApiClient . getDefaultApiClient ();
ContainersApi apiInstance = new ContainersApi ( defaultClient );
try {
ContainersResponse result = apiInstance . listContainers ();
System . out . println ( result );
} catch ( ApiException e ) {
System . err . println ( "Exception when calling ContainersApi#listContainers" );
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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ddog-gov.com " DD_API_KEY = "<DD_API_KEY>" DD_APP_KEY = "<DD_APP_KEY>" java "Example.java"
/**
* Get All Containers returns "OK" response
*/
import { client , v2 } from "@datadog/datadog-api-client" ;
const configuration = client . createConfiguration ();
const apiInstance = new v2 . ContainersApi ( configuration );
apiInstance
. listContainers ()
. then (( data : v2.ContainersResponse ) => {
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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ddog-gov.com " DD_API_KEY = "<DD_API_KEY>" DD_APP_KEY = "<DD_APP_KEY>" tsc "example.ts"