Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "account_id": "1234567",
// "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"
// }
let json = CkoJsonObject()!
json.update("account_id", value: "1234567")
json.update("lambda_arn", value: "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest")
http.setRequestHeader("Content-Type", value: "application/json")
http.setRequestHeader("Accept", value: "application/json")
let sbRequestBody = CkoStringBuilder()!
json.emitSb(sbRequestBody)
var resp: CkoHttpResponse? = http.pTextSb("DELETE", url: "https://api.app.ddog-gov.com/api/v1/integration/aws/logs", textData: sbRequestBody, charset: "utf-8", contentType: "application/json", md5: false, gzip: false)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
let sbResponseBody = CkoStringBuilder()!
resp!.getBodySb(sbResponseBody)
let jResp = CkoJsonObject()!
jResp.loadSb(sbResponseBody)
jResp.emitCompact = false
print("Response Body:")
print("\(jResp.emit()!)")
var respStatusCode: Int = resp!.statusCode.intValue
print("Response Status Code = \(respStatusCode)")
if respStatusCode >= 400 {
print("Response Header:")
print("\(resp!.header!)")
print("Failed.")
resp = nil
return
}
resp = nil
}
Curl Command
curl -X DELETE
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"account_id": "1234567",
"lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"
}'
https://api.app.ddog-gov.com/api/v1/integration/aws/logs
Postman Collection Item JSON
{
"name": "Delete an AWS Logs integration",
"request": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account_id\": \"1234567\",\n \"lambda_arn\": \"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws/logs",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws",
"logs"
]
},
"description": "Delete a Datadog-AWS logs configuration by removing the specific Lambda ARN associated with a given AWS account."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account_id\": \"1234567\",\n \"lambda_arn\": \"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws/logs",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws",
"logs"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account_id\": \"1234567\",\n \"lambda_arn\": \"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws/logs",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws",
"logs"
]
}
},
"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": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account_id\": \"1234567\",\n \"lambda_arn\": \"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws/logs",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws",
"logs"
]
}
},
"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": "Too many requests",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account_id\": \"1234567\",\n \"lambda_arn\": \"arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/integration/aws/logs",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"integration",
"aws",
"logs"
]
}
},
"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}"
}
]
}