curl --request POST \
--url https://app.trustivan.com/api/v1/notification-targets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"channel": "<string>",
"events": [
"<string>"
],
"url": "<string>",
"config": {},
"secret": "<string>",
"only_blocking": true,
"enabled": true
}
'import requests
url = "https://app.trustivan.com/api/v1/notification-targets"
payload = {
"name": "<string>",
"channel": "<string>",
"events": ["<string>"],
"url": "<string>",
"config": {},
"secret": "<string>",
"only_blocking": True,
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
channel: '<string>',
events: ['<string>'],
url: '<string>',
config: {},
secret: '<string>',
only_blocking: true,
enabled: true
})
};
fetch('https://app.trustivan.com/api/v1/notification-targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/notification-targets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"channel\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"config\": {},\n \"secret\": \"<string>\",\n \"only_blocking\": true,\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"target": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"channel": "<string>",
"configured": true,
"events": [
"<string>"
],
"only_blocking": true,
"enabled": true,
"consecutive_failures": 123,
"created_at": "2023-11-07T05:31:56Z",
"config": {},
"min_severity": "critical",
"disabled_at": "2023-11-07T05:31:56Z",
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"last_error": "<string>",
"secret_rotated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z"
}
}Register a notification destination
Requires webhooks:manage, which is not grantable to an API key: a
destination is somewhere every future event is copied to, so a machine
credential that could add one could stream a tenant’s findings
somewhere the tenant never chose.
secret is the destination’s one credential: a Slack incoming-webhook
URL, a Splunk HEC token, a Jira API token. For a vendor whose URL IS
the credential (Slack, Teams) send it as secret and omit url; it is
then stored encrypted rather than in a plaintext column.
A customer-named host is validated before it is stored (loopback, private, link-local and metadata-service addresses are refused) and re-validated at connection time on the resolved address.
curl --request POST \
--url https://app.trustivan.com/api/v1/notification-targets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"channel": "<string>",
"events": [
"<string>"
],
"url": "<string>",
"config": {},
"secret": "<string>",
"only_blocking": true,
"enabled": true
}
'import requests
url = "https://app.trustivan.com/api/v1/notification-targets"
payload = {
"name": "<string>",
"channel": "<string>",
"events": ["<string>"],
"url": "<string>",
"config": {},
"secret": "<string>",
"only_blocking": True,
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
channel: '<string>',
events: ['<string>'],
url: '<string>',
config: {},
secret: '<string>',
only_blocking: true,
enabled: true
})
};
fetch('https://app.trustivan.com/api/v1/notification-targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/notification-targets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"channel\": \"<string>\",\n \"events\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"config\": {},\n \"secret\": \"<string>\",\n \"only_blocking\": true,\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"target": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"channel": "<string>",
"configured": true,
"events": [
"<string>"
],
"only_blocking": true,
"enabled": true,
"consecutive_failures": 123,
"created_at": "2023-11-07T05:31:56Z",
"config": {},
"min_severity": "critical",
"disabled_at": "2023-11-07T05:31:56Z",
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"last_error": "<string>",
"secret_rotated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Body
Response
Created.
One outbound notification destination. The stored secret is not
here and has no read path at all, in any response: it is the customer's
own credential and TRUSTIVAN has no business showing it back. url is
absent for the same reason (for Slack and Teams the destination URL IS
the credential), and configured reports only whether a secret is set.
Show child attributes
Show child attributes