Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oQueryParams = ObjCreate("Chilkat.JsonObject")
$oQueryParams.UpdateString("account_id","cupidatat Ut Duis")
$oQueryParams.UpdateString("role_name","cupidatat Ut Duis")
$oQueryParams.UpdateString("access_key_id","cupidatat Ut Duis")
$oHttp.SetRequestHeader "Accept","application/json"
Local $oResp = $oHttp.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v1/integration/aws",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oResp.Header & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "accounts": [
; {
; "access_key_id": "sit Lorem commodo est",
; "account_id": "123456789012",
; "account_specific_namespace_rules": {
; "auto_scaling": false,
; "opswork": false
; },
; "cspm_resource_collection_enabled": true,
; "excluded_regions": [
; "us-east-1",
; "us-west-2"
; ],
; "filter_tags": [
; "$KEY:$VALUE"
; ],
; "host_tags": [
; "$KEY:$VALUE"
; ],
; "metrics_collection_enabled": false,
; "resource_collection_enabled": true,
; "role_name": "DatadogAWSIntegrationRole",
; "secret_access_key": "qui veniam sint anim"
; },
; {
; "access_key_id": "quis enim laboris",
; "account_id": "123456789012",
; "account_specific_namespace_rules": {
; "auto_scaling": false,
; "opswork": false
; },
; "cspm_resource_collection_enabled": true,
; "excluded_regions": [
; "us-east-1",
; "us-west-2"
; ],
; "filter_tags": [
; "$KEY:$VALUE"
; ],
; "host_tags": [
; "$KEY:$VALUE"
; ],
; "metrics_collection_enabled": false,
; "resource_collection_enabled": true,
; "role_name": "DatadogAWSIntegrationRole",
; "secret_access_key": "ea esse Duis"
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Local $sAccess_key_id
Local $sAccount_id
Local $bAuto_scaling
Local $bOpswork
Local $bCspm_resource_collection_enabled
Local $bMetrics_collection_enabled
Local $bResource_collection_enabled
Local $sRole_name
Local $secret_access_key
Local $iJ
Local $iCount_j
Local $strVal
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("accounts")
While $i < $iCount_i
$oJResp.I = $i
$sAccess_key_id = $oJResp.StringOf("accounts[i].access_key_id")
$sAccount_id = $oJResp.StringOf("accounts[i].account_id")
$bAuto_scaling = $oJResp.BoolOf("accounts[i].account_specific_namespace_rules.auto_scaling")
$bOpswork = $oJResp.BoolOf("accounts[i].account_specific_namespace_rules.opswork")
$bCspm_resource_collection_enabled = $oJResp.BoolOf("accounts[i].cspm_resource_collection_enabled")
$bMetrics_collection_enabled = $oJResp.BoolOf("accounts[i].metrics_collection_enabled")
$bResource_collection_enabled = $oJResp.BoolOf("accounts[i].resource_collection_enabled")
$sRole_name = $oJResp.StringOf("accounts[i].role_name")
$secret_access_key = $oJResp.StringOf("accounts[i].secret_access_key")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("accounts[i].excluded_regions")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("accounts[i].excluded_regions[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("accounts[i].filter_tags")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("accounts[i].filter_tags[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("accounts[i].host_tags")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("accounts[i].host_tags[j]")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
Curl Command
curl -G -d "account_id=cupidatat%20Ut%20Duis"
-d "role_name=cupidatat%20Ut%20Duis"
-d "access_key_id=cupidatat%20Ut%20Duis"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/integration/aws
Postman Collection Item JSON
{
"name": "List all AWS integrations",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws?account_id=cupidatat Ut Duis&role_name=cupidatat Ut Duis&access_key_id=cupidatat Ut Duis",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws"
],
"query": [
{
"key": "account_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `account_id`."
},
{
"key": "role_name",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this role_name."
},
{
"key": "access_key_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `access_key_id`."
}
]
},
"description": "List all Datadog-AWS integrations available in your Datadog organization."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws?account_id=cupidatat Ut Duis&role_name=cupidatat Ut Duis&access_key_id=cupidatat Ut Duis",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws"
],
"query": [
{
"key": "account_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `account_id`."
},
{
"key": "role_name",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this role_name."
},
{
"key": "access_key_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `access_key_id`."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"accounts\": [\n {\n \"access_key_id\": \"sit Lorem commodo est\",\n \"account_id\": \"123456789012\",\n \"account_specific_namespace_rules\": {\n \"auto_scaling\": false,\n \"opswork\": false\n },\n \"cspm_resource_collection_enabled\": true,\n \"excluded_regions\": [\n \"us-east-1\",\n \"us-west-2\"\n ],\n \"filter_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"host_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"metrics_collection_enabled\": false,\n \"resource_collection_enabled\": true,\n \"role_name\": \"DatadogAWSIntegrationRole\",\n \"secret_access_key\": \"qui veniam sint anim\"\n },\n {\n \"access_key_id\": \"quis enim laboris\",\n \"account_id\": \"123456789012\",\n \"account_specific_namespace_rules\": {\n \"auto_scaling\": false,\n \"opswork\": false\n },\n \"cspm_resource_collection_enabled\": true,\n \"excluded_regions\": [\n \"us-east-1\",\n \"us-west-2\"\n ],\n \"filter_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"host_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"metrics_collection_enabled\": false,\n \"resource_collection_enabled\": true,\n \"role_name\": \"DatadogAWSIntegrationRole\",\n \"secret_access_key\": \"ea esse Duis\"\n }\n ]\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws?account_id=cupidatat Ut Duis&role_name=cupidatat Ut Duis&access_key_id=cupidatat Ut Duis",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws"
],
"query": [
{
"key": "account_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `account_id`."
},
{
"key": "role_name",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this role_name."
},
{
"key": "access_key_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `access_key_id`."
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Authentication Error",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws?account_id=cupidatat Ut Duis&role_name=cupidatat Ut Duis&access_key_id=cupidatat Ut Duis",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws"
],
"query": [
{
"key": "account_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `account_id`."
},
{
"key": "role_name",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this role_name."
},
{
"key": "access_key_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `access_key_id`."
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Too many requests",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws?account_id=cupidatat Ut Duis&role_name=cupidatat Ut Duis&access_key_id=cupidatat Ut Duis",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws"
],
"query": [
{
"key": "account_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `account_id`."
},
{
"key": "role_name",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this role_name."
},
{
"key": "access_key_id",
"value": "cupidatat Ut Duis",
"description": "Only return AWS accounts that matches this `access_key_id`."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
}
]
}