Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.

new Http http;
ckbool success;

call http.SetRequestHeader("Accept","application/yaml");

new StringBuilder sbResponseBody;
success = http.QuickGetSb("https://api.app.ddog-gov.com/api/v2/security/cloud_workload/policy/download",sbResponseBody);
if (success == ckfalse) {
    println http.LastErrorText;
    return;
}

ERROR: ExpectedResponseType not yet supported...
ExpectedResponseType: [application/yaml]
m_reqType = 8
ERROR: Something in the response processing not yet supported...

---- end chilkat script ----

Node.js / Datadog API Collection / Get the latest Cloud Workload Security policy

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    var http = new chilkat.Http();
    var success;

    http.SetRequestHeader("Accept","application/yaml");

    var sbResponseBody = new chilkat.StringBuilder();
    success = http.QuickGetSb("https://api.app.ddog-gov.com/api/v2/security/cloud_workload/policy/download",sbResponseBody);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

ERROR: "=" expected
ERROR: Undefined variable(ERROR)

}

chilkatExample();

Curl Command

curl -X GET
	-H "Accept: application/yaml"
https://api.app.ddog-gov.com/api/v2/security/cloud_workload/policy/download

Postman Collection Item JSON

{
  "name": "Get the latest Cloud Workload Security policy",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/yaml"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/security/cloud_workload/policy/download",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "security",
        "cloud_workload",
        "policy",
        "download"
      ]
    },
    "description": "The download endpoint generates a Cloud Workload Security policy file from your currently active\nCloud Workload Security rules, and downloads them as a .policy file. This file can then be deployed to\nyour Agents to update the policy running in your environment."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/yaml"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v2/security/cloud_workload/policy/download",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "security",
            "cloud_workload",
            "policy",
            "download"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/yaml"
        }
      ],
      "cookie": [
      ],
      "body": "<string>"
    },
    {
      "name": "Not Authorized",
      "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/v2/security/cloud_workload/policy/download",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "security",
            "cloud_workload",
            "policy",
            "download"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\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/v2/security/cloud_workload/policy/download",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "security",
            "cloud_workload",
            "policy",
            "download"
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    }
  ]
}