Chilkat Online Tools

delphiDll / Datadog API Collection / Remove a Slack integration channel

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
resp: HCkHttpResponse;
respStatusCode: Integer;

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

http := CkHttp_Create();

CkHttp_SetRequestHeader(http,'Accept','application/json');

resp := CkHttp_QuickRequest(http,'DELETE','https://api.app.ddog-gov.com/api/v1/integration/slack/configuration/accounts/:account_name/channels/:channel_name');
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode <> 204) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttpResponse__header(resp));
    Memo1.Lines.Add('Response Body:');
    Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
    Memo1.Lines.Add('Failed.');
    CkHttpResponse_Dispose(resp);
    Exit;
  end;
CkHttpResponse_Dispose(resp);
Memo1.Lines.Add('Success.');

CkHttp_Dispose(http);

Curl Command

curl -X DELETE
	-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/integration/slack/configuration/accounts/:account_name/channels/:channel_name

Postman Collection Item JSON

{
  "name": "Remove a Slack integration channel",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v1/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "integration",
        "slack",
        "configuration",
        "accounts",
        ":account_name",
        "channels",
        ":channel_name"
      ],
      "variable": [
        {
          "key": "account_name",
          "value": "tempor Ut sed velit"
        },
        {
          "key": "channel_name",
          "value": "tempor Ut sed velit"
        }
      ]
    },
    "description": "Remove a channel from your Datadog-Slack integration."
  },
  "response": [
    {
      "name": "The channel was removed successfully.",
      "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/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "integration",
            "slack",
            "configuration",
            "accounts",
            ":account_name",
            "channels",
            ":channel_name"
          ],
          "variable": [
            {
              "key": "account_name"
            },
            {
              "key": "channel_name"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Bad Request",
      "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/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "integration",
            "slack",
            "configuration",
            "accounts",
            ":account_name",
            "channels",
            ":channel_name"
          ],
          "variable": [
            {
              "key": "account_name"
            },
            {
              "key": "channel_name"
            }
          ]
        }
      },
      "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": "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/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "integration",
            "slack",
            "configuration",
            "accounts",
            ":account_name",
            "channels",
            ":channel_name"
          ],
          "variable": [
            {
              "key": "account_name"
            },
            {
              "key": "channel_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": "Item 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/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "integration",
            "slack",
            "configuration",
            "accounts",
            ":account_name",
            "channels",
            ":channel_name"
          ],
          "variable": [
            {
              "key": "account_name"
            },
            {
              "key": "channel_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/integration/slack/configuration/accounts/:account_name/channels/:channel_name",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "integration",
            "slack",
            "configuration",
            "accounts",
            ":account_name",
            "channels",
            ":channel_name"
          ],
          "variable": [
            {
              "key": "account_name"
            },
            {
              "key": "channel_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}"
    }
  ]
}