Chilkat Online Tools

VB.NET / Datadog API Collection / Delete an SLO

Back to Collection Items

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

Dim http As New Chilkat.Http
Dim success As Boolean

http.SetRequestHeader("Accept","application/json")

Dim resp As Chilkat.HttpResponse = http.QuickRequest("DELETE","velit")
If (http.LastMethodSuccess = False) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If


Dim sbResponseBody As New Chilkat.StringBuilder
resp.GetBodySb(sbResponseBody)

Dim jResp As New Chilkat.JsonObject
jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False

Debug.WriteLine("Response Body:")
Debug.WriteLine(jResp.Emit())

Dim respStatusCode As Integer = resp.StatusCode
Debug.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
    Debug.WriteLine("Response Header:")
    Debug.WriteLine(resp.Header)
    Debug.WriteLine("Failed.")

    Exit Sub
End If



' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)

' {
'   "data": [
'     "consequat dolor",
'     "mollit dolore veniam"
'   ],
'   "errors": {
'     "sitd8": "esse ullamco",
'     "sit_5": "eu laborum nisi culpa",
'     "amet_1": "ullamco Ut aliqua commodo",
'     "dolor_a4": "in"
'   }
' }

' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code



Dim strVal As String

Dim Sitd8 As String = jResp.StringOf("errors.sitd8")
Dim Sit_5 As String = jResp.StringOf("errors.sit_5")
Dim Amet_1 As String = jResp.StringOf("errors.amet_1")
Dim Dolor_a4 As String = jResp.StringOf("errors.dolor_a4")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("data")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("data[i]")
    i = i + 1
End While

Curl Command

curl -X DELETE
	-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/slo/:slo_id?force=tempor Ut sed velit

Postman Collection Item JSON

{
  "name": "Delete an SLO",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v1/slo/:slo_id?force=tempor Ut sed velit",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "slo",
        ":slo_id"
      ],
      "query": [
        {
          "key": "force",
          "value": "tempor Ut sed velit",
          "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
        }
      ],
      "variable": [
        {
          "key": "slo_id",
          "value": "tempor Ut sed velit"
        }
      ]
    },
    "description": "Permanently delete the specified service level objective object.\n\nIf an SLO is used in a dashboard, the `DELETE /v1/slo/` endpoint returns\na 409 conflict error because the SLO is referenced in a dashboard."
  },
  "response": [
    {
      "name": "OK",
      "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/slo/:slo_id?force=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "slo",
            ":slo_id"
          ],
          "query": [
            {
              "key": "force",
              "value": "tempor Ut sed velit",
              "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
            }
          ],
          "variable": [
            {
              "key": "slo_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"data\": [\n    \"consequat dolor\",\n    \"mollit dolore veniam\"\n  ],\n  \"errors\": {\n    \"sitd8\": \"esse ullamco\",\n    \"sit_5\": \"eu laborum nisi culpa\",\n    \"amet_1\": \"ullamco Ut aliqua commodo\",\n    \"dolor_a4\": \"in\"\n  }\n}"
    },
    {
      "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/slo/:slo_id?force=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "slo",
            ":slo_id"
          ],
          "query": [
            {
              "key": "force",
              "value": "tempor Ut sed velit",
              "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
            }
          ],
          "variable": [
            {
              "key": "slo_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": "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/slo/:slo_id?force=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "slo",
            ":slo_id"
          ],
          "query": [
            {
              "key": "force",
              "value": "tempor Ut sed velit",
              "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
            }
          ],
          "variable": [
            {
              "key": "slo_id"
            }
          ]
        }
      },
      "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": "Conflict",
      "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/slo/:slo_id?force=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "slo",
            ":slo_id"
          ],
          "query": [
            {
              "key": "force",
              "value": "tempor Ut sed velit",
              "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
            }
          ],
          "variable": [
            {
              "key": "slo_id"
            }
          ]
        }
      },
      "status": "Conflict",
      "code": 409,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"data\": [\n    \"consequat dolor\",\n    \"mollit dolore veniam\"\n  ],\n  \"errors\": {\n    \"sitd8\": \"esse ullamco\",\n    \"sit_5\": \"eu laborum nisi culpa\",\n    \"amet_1\": \"ullamco Ut aliqua commodo\",\n    \"dolor_a4\": \"in\"\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/slo/:slo_id?force=tempor Ut sed velit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "slo",
            ":slo_id"
          ],
          "query": [
            {
              "key": "force",
              "value": "tempor Ut sed velit",
              "description": "Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor)."
            }
          ],
          "variable": [
            {
              "key": "slo_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}"
    }
  ]
}