Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "app_service_plan_filters": "key:value,filter:example",
// "automute": true,
// "client_id": "testc7f6-1234-5678-9101-3fcbf464test",
// "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt",
// "cspm_enabled": true,
// "custom_metrics_enabled": true,
// "errors": [
// "*"
// ],
// "host_filters": "key:value,filter:example",
// "new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test",
// "new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest",
// "tenant_name": "testc44-1234-5678-9101-cc00736ftest"
// }
loJson = createobject("CkJsonObject")
loJson.UpdateString("app_service_plan_filters","key:value,filter:example")
loJson.UpdateBool("automute",.T.)
loJson.UpdateString("client_id","testc7f6-1234-5678-9101-3fcbf464test")
loJson.UpdateString("client_secret","testingx./Sw*g/Y33t..R1cH+hScMDt")
loJson.UpdateBool("cspm_enabled",.T.)
loJson.UpdateBool("custom_metrics_enabled",.T.)
loJson.UpdateString("errors[0]","*")
loJson.UpdateString("host_filters","key:value,filter:example")
loJson.UpdateString("new_client_id","new1c7f6-1234-5678-9101-3fcbf464test")
loJson.UpdateString("new_tenant_name","new1c44-1234-5678-9101-cc00736ftest")
loJson.UpdateString("tenant_name","testc44-1234-5678-9101-cc00736ftest")
loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("Accept","application/json")
loSbRequestBody = createobject("CkStringBuilder")
loJson.EmitSb(loSbRequestBody)
loResp = loHttp.PTextSb("PUT","https://api.app.ddog-gov.com/api/v1/integration/azure",loSbRequestBody,"utf-8","application/json",.F.,.F.)
if (loHttp.LastMethodSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loJson
release loSbRequestBody
return
endif
loSbResponseBody = createobject("CkStringBuilder")
loResp.GetBodySb(loSbResponseBody)
loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
? "Response Header:"
? loResp.Header
? "Failed."
release loResp
release loHttp
release loJson
release loSbRequestBody
release loSbResponseBody
release loJResp
return
endif
release loResp
release loHttp
release loJson
release loSbRequestBody
release loSbResponseBody
release loJResp
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"app_service_plan_filters": "key:value,filter:example",
"automute": true,
"client_id": "testc7f6-1234-5678-9101-3fcbf464test",
"client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt",
"cspm_enabled": true,
"custom_metrics_enabled": true,
"errors": [
"*"
],
"host_filters": "key:value,filter:example",
"new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test",
"new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest",
"tenant_name": "testc44-1234-5678-9101-cc00736ftest"
}'
https://api.app.ddog-gov.com/api/v1/integration/azure
Postman Collection Item JSON
{
"name": "Update an Azure integration",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"testc7f6-1234-5678-9101-3fcbf464test\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\n \"*\"\n ],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"new1c7f6-1234-5678-9101-3fcbf464test\",\n \"new_tenant_name\": \"new1c44-1234-5678-9101-cc00736ftest\",\n \"tenant_name\": \"testc44-1234-5678-9101-cc00736ftest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/azure",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"azure"
]
},
"description": "Update a Datadog-Azure integration. Requires an existing `tenant_name` and `client_id`.\nAny other fields supplied will overwrite existing values. To overwrite `tenant_name` or `client_id`,\nuse `new_tenant_name` and `new_client_id`. To leave a field unchanged, do not supply that field in the payload."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"testc7f6-1234-5678-9101-3fcbf464test\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\n \"*\"\n ],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"new1c7f6-1234-5678-9101-3fcbf464test\",\n \"new_tenant_name\": \"new1c44-1234-5678-9101-cc00736ftest\",\n \"tenant_name\": \"testc44-1234-5678-9101-cc00736ftest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/azure",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"azure"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"testc7f6-1234-5678-9101-3fcbf464test\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\n \"*\"\n ],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"new1c7f6-1234-5678-9101-3fcbf464test\",\n \"new_tenant_name\": \"new1c44-1234-5678-9101-cc00736ftest\",\n \"tenant_name\": \"testc44-1234-5678-9101-cc00736ftest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/azure",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"azure"
]
}
},
"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": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"testc7f6-1234-5678-9101-3fcbf464test\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\n \"*\"\n ],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"new1c7f6-1234-5678-9101-3fcbf464test\",\n \"new_tenant_name\": \"new1c44-1234-5678-9101-cc00736ftest\",\n \"tenant_name\": \"testc44-1234-5678-9101-cc00736ftest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/azure",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"azure"
]
}
},
"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": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"testc7f6-1234-5678-9101-3fcbf464test\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\n \"*\"\n ],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"new1c7f6-1234-5678-9101-3fcbf464test\",\n \"new_tenant_name\": \"new1c44-1234-5678-9101-cc00736ftest\",\n \"tenant_name\": \"testc44-1234-5678-9101-cc00736ftest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/azure",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"azure"
]
}
},
"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}"
}
]
}