Change a destination, or switch it off
curl --request PATCH \
--url https://app.trustivan.com/api/v1/notification-targets/{id} \
--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/{id}"
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.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/{id}', 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/{id}"
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("PATCH", 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"
}
}Change a destination, or switch it off
{"enabled": false} on its own is the disable, and keeps everything
else: a request that only switches a destination off does not have to
restate its name and event list.
The channel cannot be changed: a destination’s vendor is what its stored secret and settings mean, so “turn this Slack hook into a Jira project” is a new destination.
PATCH
/
notification-targets
/
{id}
Change a destination, or switch it off
curl --request PATCH \
--url https://app.trustivan.com/api/v1/notification-targets/{id} \
--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/{id}"
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.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/{id}', 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/{id}"
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("PATCH", 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
application/json
Response
The updated destination.
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