Chilkat Online Tools

Perl / Datadog API Collection / Remove host tags

Back to Collection Items

use chilkat();

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

$http = chilkat::CkHttp->new();

$http->SetRequestHeader("Accept","application/json");

# resp is a HttpResponse
$resp = $http->QuickRequest("DELETE","velit");
if ($http->get_LastMethodSuccess() == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

$respStatusCode = $resp->get_StatusCode();
print "Response Status Code = " . $respStatusCode . "\r\n";
if ($respStatusCode != 204) {
    print "Response Header:" . "\r\n";
    print $resp->header() . "\r\n";
    print "Response Body:" . "\r\n";
    print $resp->bodyStr() . "\r\n";
    print "Failed." . "\r\n";

    exit;
}

print "Success." . "\r\n";

Curl Command

curl -X DELETE
	-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/tags/hosts/:host_name?source=tempor Ut sed velit

Postman Collection Item JSON

{
  "name": "Remove host tags",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v1/tags/hosts/:host_name?source=tempor Ut sed velit",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "tags",
        "hosts",
        ":host_name"
      ],
      "query": [
        {
          "key": "source",
          "value": "tempor Ut sed velit",
          "description": "The source of the tags (for example chef, puppet).\n[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)."
        }
      ],
      "variable": [
        {
          "key": "host_name",
          "value": "tempor Ut sed velit"
        }
      ]
    },
    "description": "This endpoint allows you to remove all user-assigned tags\nfor a single host."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v1/tags/hosts/:host_name?source=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "tags",
            "hosts",
            ":host_name"
          ],
          "query": [
            {
              "key": "source",
              "value": "tempor Ut sed velit",
              "description": "The source of the tags (for example chef, puppet).\n[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)."
            }
          ],
          "variable": [
            {
              "key": "host_name"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Forbidden",
      "originalRequest": {
        "method": "DELETE",
        "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/tags/hosts/:host_name?source=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "tags",
            "hosts",
            ":host_name"
          ],
          "query": [
            {
              "key": "source",
              "value": "tempor Ut sed velit",
              "description": "The source of the tags (for example chef, puppet).\n[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)."
            }
          ],
          "variable": [
            {
              "key": "host_name"
            }
          ]
        }
      },
      "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": "Not Found",
      "originalRequest": {
        "method": "DELETE",
        "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/tags/hosts/:host_name?source=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "tags",
            "hosts",
            ":host_name"
          ],
          "query": [
            {
              "key": "source",
              "value": "tempor Ut sed velit",
              "description": "The source of the tags (for example chef, puppet).\n[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)."
            }
          ],
          "variable": [
            {
              "key": "host_name"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_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": "DELETE",
        "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/tags/hosts/:host_name?source=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "tags",
            "hosts",
            ":host_name"
          ],
          "query": [
            {
              "key": "source",
              "value": "tempor Ut sed velit",
              "description": "The source of the tags (for example chef, puppet).\n[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)."
            }
          ],
          "variable": [
            {
              "key": "host_name"
            }
          ]
        }
      },
      "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}"
    }
  ]
}