Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global_Ref.html">Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
http.SetRequestHeader("Accept","application/json")
resp := http.QuickRequest("DELETE","https://api.app.ddog-gov.com/api/v2/api_keys/:api_key_id")
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
return
}
respStatusCode := resp.StatusCode()
fmt.Println("Response Status Code = ", respStatusCode)
if respStatusCode != 204 {
fmt.Println("Response Header:")
fmt.Println(resp.Header())
fmt.Println("Response Body:")
fmt.Println(resp.BodyStr())
fmt.Println("Failed.")
resp.DisposeHttpResponse()
http.DisposeHttp()
return
}
resp.DisposeHttpResponse()
fmt.Println("Success.")
http.DisposeHttp()
Curl Command
curl -X DELETE
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v2/api_keys/:api_key_id
Postman Collection Item JSON
{
"name": "Delete an API key",
"request": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/api_keys/:api_key_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"api_keys",
":api_key_id"
],
"variable": [
{
"key": "api_key_id",
"value": "<string>"
}
]
},
"description": "Delete an API key."
},
"response": [
{
"name": "No Content",
"originalRequest": {
"method": "DELETE",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/api_keys/:api_key_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"api_keys",
":api_key_id"
],
"variable": [
{
"key": "api_key_id"
}
]
}
},
"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/v2/api_keys/:api_key_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"api_keys",
":api_key_id"
],
"variable": [
{
"key": "api_key_id"
}
]
}
},
"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": "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/v2/api_keys/:api_key_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"api_keys",
":api_key_id"
],
"variable": [
{
"key": "api_key_id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_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": "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/v2/api_keys/:api_key_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"api_keys",
":api_key_id"
],
"variable": [
{
"key": "api_key_id"
}
]
}
},
"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}"
}
]
}