curl --request POST \
--url https://audit.cpln.io/audit/org/{org}/auditctx/{contextName} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"resource": {
"id": "dfedd8b9-7737-498a-883f-0162510c0d68",
"name": "my-workload",
"type": "workload",
"data": {
"foo": "bar"
}
},
"id": "7f2195ac-e003-42a3-8324-d4bb1f11d10e",
"eventTime": "2021-01-02T13:01:02.345Z",
"postedTime": "2021-01-02T13:01:03.123Z",
"receivedTime": "2021-01-02T13:01:03.159Z",
"requestId": "d4e26a95-1988-4bf5-94fb-40d605cce0e9",
"context": {
"org": "myorg",
"name": "audit-context-1",
"remoteIp": "1.2.3.4",
"eventSource": "system",
"location": "aws-us-west-2",
"gvcAlias": "gm0b1e3a1vxjj",
"podId": "workload-00016-deployment-54b5b8f94f-jqkcn",
"data": {}
},
"subject": {
"email": "bob@company.com",
"name": "Bob Johnson",
"claims": {},
"data": {}
},
"action": {
"type": "delete",
"data": {}
},
"result": {
"status": "OK",
"message": "Object created successfully"
}
}
'import requests
url = "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}"
payload = {
"resource": {
"id": "dfedd8b9-7737-498a-883f-0162510c0d68",
"name": "my-workload",
"type": "workload",
"data": { "foo": "bar" }
},
"id": "7f2195ac-e003-42a3-8324-d4bb1f11d10e",
"eventTime": "2021-01-02T13:01:02.345Z",
"postedTime": "2021-01-02T13:01:03.123Z",
"receivedTime": "2021-01-02T13:01:03.159Z",
"requestId": "d4e26a95-1988-4bf5-94fb-40d605cce0e9",
"context": {
"org": "myorg",
"name": "audit-context-1",
"remoteIp": "1.2.3.4",
"eventSource": "system",
"location": "aws-us-west-2",
"gvcAlias": "gm0b1e3a1vxjj",
"podId": "workload-00016-deployment-54b5b8f94f-jqkcn",
"data": {}
},
"subject": {
"email": "bob@company.com",
"name": "Bob Johnson",
"claims": {},
"data": {}
},
"action": {
"type": "delete",
"data": {}
},
"result": {
"status": "OK",
"message": "Object created successfully"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resource: {
id: 'dfedd8b9-7737-498a-883f-0162510c0d68',
name: 'my-workload',
type: 'workload',
data: {foo: 'bar'}
},
id: '7f2195ac-e003-42a3-8324-d4bb1f11d10e',
eventTime: '2021-01-02T13:01:02.345Z',
postedTime: '2021-01-02T13:01:03.123Z',
receivedTime: '2021-01-02T13:01:03.159Z',
requestId: 'd4e26a95-1988-4bf5-94fb-40d605cce0e9',
context: {
org: 'myorg',
name: 'audit-context-1',
remoteIp: '1.2.3.4',
eventSource: 'system',
location: 'aws-us-west-2',
gvcAlias: 'gm0b1e3a1vxjj',
podId: 'workload-00016-deployment-54b5b8f94f-jqkcn',
data: {}
},
subject: {email: 'bob@company.com', name: 'Bob Johnson', claims: {}, data: {}},
action: {type: 'delete', data: {}},
result: {status: 'OK', message: 'Object created successfully'}
})
};
fetch('https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'resource' => [
'id' => 'dfedd8b9-7737-498a-883f-0162510c0d68',
'name' => 'my-workload',
'type' => 'workload',
'data' => [
'foo' => 'bar'
]
],
'id' => '7f2195ac-e003-42a3-8324-d4bb1f11d10e',
'eventTime' => '2021-01-02T13:01:02.345Z',
'postedTime' => '2021-01-02T13:01:03.123Z',
'receivedTime' => '2021-01-02T13:01:03.159Z',
'requestId' => 'd4e26a95-1988-4bf5-94fb-40d605cce0e9',
'context' => [
'org' => 'myorg',
'name' => 'audit-context-1',
'remoteIp' => '1.2.3.4',
'eventSource' => 'system',
'location' => 'aws-us-west-2',
'gvcAlias' => 'gm0b1e3a1vxjj',
'podId' => 'workload-00016-deployment-54b5b8f94f-jqkcn',
'data' => [
]
],
'subject' => [
'email' => 'bob@company.com',
'name' => 'Bob Johnson',
'claims' => [
],
'data' => [
]
],
'action' => [
'type' => 'delete',
'data' => [
]
],
'result' => [
'status' => 'OK',
'message' => 'Object created successfully'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}"
payload := strings.NewReader("{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1234",
"message": "Published event with ID 1234 on primary transport"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Create a new audit event
curl --request POST \
--url https://audit.cpln.io/audit/org/{org}/auditctx/{contextName} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"resource": {
"id": "dfedd8b9-7737-498a-883f-0162510c0d68",
"name": "my-workload",
"type": "workload",
"data": {
"foo": "bar"
}
},
"id": "7f2195ac-e003-42a3-8324-d4bb1f11d10e",
"eventTime": "2021-01-02T13:01:02.345Z",
"postedTime": "2021-01-02T13:01:03.123Z",
"receivedTime": "2021-01-02T13:01:03.159Z",
"requestId": "d4e26a95-1988-4bf5-94fb-40d605cce0e9",
"context": {
"org": "myorg",
"name": "audit-context-1",
"remoteIp": "1.2.3.4",
"eventSource": "system",
"location": "aws-us-west-2",
"gvcAlias": "gm0b1e3a1vxjj",
"podId": "workload-00016-deployment-54b5b8f94f-jqkcn",
"data": {}
},
"subject": {
"email": "bob@company.com",
"name": "Bob Johnson",
"claims": {},
"data": {}
},
"action": {
"type": "delete",
"data": {}
},
"result": {
"status": "OK",
"message": "Object created successfully"
}
}
'import requests
url = "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}"
payload = {
"resource": {
"id": "dfedd8b9-7737-498a-883f-0162510c0d68",
"name": "my-workload",
"type": "workload",
"data": { "foo": "bar" }
},
"id": "7f2195ac-e003-42a3-8324-d4bb1f11d10e",
"eventTime": "2021-01-02T13:01:02.345Z",
"postedTime": "2021-01-02T13:01:03.123Z",
"receivedTime": "2021-01-02T13:01:03.159Z",
"requestId": "d4e26a95-1988-4bf5-94fb-40d605cce0e9",
"context": {
"org": "myorg",
"name": "audit-context-1",
"remoteIp": "1.2.3.4",
"eventSource": "system",
"location": "aws-us-west-2",
"gvcAlias": "gm0b1e3a1vxjj",
"podId": "workload-00016-deployment-54b5b8f94f-jqkcn",
"data": {}
},
"subject": {
"email": "bob@company.com",
"name": "Bob Johnson",
"claims": {},
"data": {}
},
"action": {
"type": "delete",
"data": {}
},
"result": {
"status": "OK",
"message": "Object created successfully"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resource: {
id: 'dfedd8b9-7737-498a-883f-0162510c0d68',
name: 'my-workload',
type: 'workload',
data: {foo: 'bar'}
},
id: '7f2195ac-e003-42a3-8324-d4bb1f11d10e',
eventTime: '2021-01-02T13:01:02.345Z',
postedTime: '2021-01-02T13:01:03.123Z',
receivedTime: '2021-01-02T13:01:03.159Z',
requestId: 'd4e26a95-1988-4bf5-94fb-40d605cce0e9',
context: {
org: 'myorg',
name: 'audit-context-1',
remoteIp: '1.2.3.4',
eventSource: 'system',
location: 'aws-us-west-2',
gvcAlias: 'gm0b1e3a1vxjj',
podId: 'workload-00016-deployment-54b5b8f94f-jqkcn',
data: {}
},
subject: {email: 'bob@company.com', name: 'Bob Johnson', claims: {}, data: {}},
action: {type: 'delete', data: {}},
result: {status: 'OK', message: 'Object created successfully'}
})
};
fetch('https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'resource' => [
'id' => 'dfedd8b9-7737-498a-883f-0162510c0d68',
'name' => 'my-workload',
'type' => 'workload',
'data' => [
'foo' => 'bar'
]
],
'id' => '7f2195ac-e003-42a3-8324-d4bb1f11d10e',
'eventTime' => '2021-01-02T13:01:02.345Z',
'postedTime' => '2021-01-02T13:01:03.123Z',
'receivedTime' => '2021-01-02T13:01:03.159Z',
'requestId' => 'd4e26a95-1988-4bf5-94fb-40d605cce0e9',
'context' => [
'org' => 'myorg',
'name' => 'audit-context-1',
'remoteIp' => '1.2.3.4',
'eventSource' => 'system',
'location' => 'aws-us-west-2',
'gvcAlias' => 'gm0b1e3a1vxjj',
'podId' => 'workload-00016-deployment-54b5b8f94f-jqkcn',
'data' => [
]
],
'subject' => [
'email' => 'bob@company.com',
'name' => 'Bob Johnson',
'claims' => [
],
'data' => [
]
],
'action' => [
'type' => 'delete',
'data' => [
]
],
'result' => [
'status' => 'OK',
'message' => 'Object created successfully'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}"
payload := strings.NewReader("{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://audit.cpln.io/audit/org/{org}/auditctx/{contextName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resource\": {\n \"id\": \"dfedd8b9-7737-498a-883f-0162510c0d68\",\n \"name\": \"my-workload\",\n \"type\": \"workload\",\n \"data\": {\n \"foo\": \"bar\"\n }\n },\n \"id\": \"7f2195ac-e003-42a3-8324-d4bb1f11d10e\",\n \"eventTime\": \"2021-01-02T13:01:02.345Z\",\n \"postedTime\": \"2021-01-02T13:01:03.123Z\",\n \"receivedTime\": \"2021-01-02T13:01:03.159Z\",\n \"requestId\": \"d4e26a95-1988-4bf5-94fb-40d605cce0e9\",\n \"context\": {\n \"org\": \"myorg\",\n \"name\": \"audit-context-1\",\n \"remoteIp\": \"1.2.3.4\",\n \"eventSource\": \"system\",\n \"location\": \"aws-us-west-2\",\n \"gvcAlias\": \"gm0b1e3a1vxjj\",\n \"podId\": \"workload-00016-deployment-54b5b8f94f-jqkcn\",\n \"data\": {}\n },\n \"subject\": {\n \"email\": \"bob@company.com\",\n \"name\": \"Bob Johnson\",\n \"claims\": {},\n \"data\": {}\n },\n \"action\": {\n \"type\": \"delete\",\n \"data\": {}\n },\n \"result\": {\n \"status\": \"OK\",\n \"message\": \"Object created successfully\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "1234",
"message": "Published event with ID 1234 on primary transport"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Service account key can be used as API keys
Query Parameters
If true, don't wait for the forwarding audit service to send the event to the backend. This mode allows for processing new audit events at a higher volume.
Body
Show child attributes
Show child attributes
The event ID, assigned by the system
"7f2195ac-e003-42a3-8324-d4bb1f11d10e"
The time of the event's occurrence. This can be anytime before the event is posted to the system.
"2021-01-02T13:01:02.345Z"
The time the event is posted to the system, assigned automatically
"2021-01-02T13:01:03.123Z"
The time the event is received and processed by the system, assigned automatically
"2021-01-02T13:01:03.159Z"
The identifier of the request, the event is associated with. It is not related to the event's identifier. There can be zero, or one or more audit events associated with the same request ID.
"d4e26a95-1988-4bf5-94fb-40d605cce0e9"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes