import requests
url = "https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id}"
payload = {
"name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"condition": {
"condition_type": "app_metric",
"threshold": 1,
"hold_minutes": 30,
"route": None,
"operator": "gt"
},
"send_to": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
environment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
condition: {
condition_type: 'app_metric',
threshold: 1,
hold_minutes: 30,
route: null,
operator: 'gt'
},
send_to: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id} \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '
{
"name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"condition": {
"condition_type": "app_metric",
"threshold": 1,
"hold_minutes": 30,
"route": null,
"operator": "gt"
},
"send_to": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'{
"alert_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"own": true,
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"says": "<string>",
"condition": {
"condition_type": "app_metric",
"metric": "failed_share_pct",
"threshold": 1,
"hold_minutes": 30,
"route": null,
"operator": "gt"
},
"severity": "<string>",
"send_to": [
{
"integration_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"label": "<string>"
}
],
"enabled": true,
"last_firing": {
"trigger_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"triggered_at": "2023-11-07T05:31:56Z",
"resolved_at": "2023-11-07T05:31:56Z",
"acknowledged_by": {
"user_id": "<string>",
"name": "<string>"
},
"acknowledged_after_seconds": 1,
"resolved_by": "itself",
"resolution_note": "<string>"
},
"evaluated_at": "2023-11-07T05:31:56Z",
"evaluation": "ok",
"unknown_reason": "<string>"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Update an application alert (browser session)
Replaces the name, environment, condition and places to send to of an alert the application’s own routes made; severity is kept when left out, and what the evaluator recorded on the rule is kept. An organisation alert, or another application’s, answers 409. Requires alerts.manage, or applications.write on the application; a viewer is refused whatever the RBAC rollout mode. Audited.
import requests
url = "https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id}"
payload = {
"name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"condition": {
"condition_type": "app_metric",
"threshold": 1,
"hold_minutes": 30,
"route": None,
"operator": "gt"
},
"send_to": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
environment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
condition: {
condition_type: 'app_metric',
threshold: 1,
hold_minutes: 30,
route: null,
operator: 'gt'
},
send_to: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://api.platform.ankra.app/org/applications/{application_id}/alerts/{alert_id} \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--data '
{
"name": "<string>",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"condition": {
"condition_type": "app_metric",
"threshold": 1,
"hold_minutes": 30,
"route": null,
"operator": "gt"
},
"send_to": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'{
"alert_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"own": true,
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"says": "<string>",
"condition": {
"condition_type": "app_metric",
"metric": "failed_share_pct",
"threshold": 1,
"hold_minutes": 30,
"route": null,
"operator": "gt"
},
"severity": "<string>",
"send_to": [
{
"integration_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"label": "<string>"
}
],
"enabled": true,
"last_firing": {
"trigger_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"triggered_at": "2023-11-07T05:31:56Z",
"resolved_at": "2023-11-07T05:31:56Z",
"acknowledged_by": {
"user_id": "<string>",
"name": "<string>"
},
"acknowledged_after_seconds": 1,
"resolved_by": "itself",
"resolution_note": "<string>"
},
"evaluated_at": "2023-11-07T05:31:56Z",
"evaluation": "ok",
"unknown_reason": "<string>"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Body
A create or a full update of one application alert. No other key is accepted.
Response
The updated alert
One alert of an application's list: an own alert, which these routes made and may change, or an organisation alert rule that watches the environment, which is changed under Alerts.
ok: the rule was read on its last run. unknown: the evaluator holds it unread (the metric store did not answer or lacks the metric, or the environment's installations cannot be resolved). not_evaluated: no run recorded a state yet.
ok, unknown, not_evaluated Why the evaluator holds the rule, only while evaluation is unknown. no_installations: nothing of the application runs on the environment, or only on a stopped cluster. application_not_found or environment_not_found: what the alert watched is gone; the evaluator then closes the alert's open firing with a resolution_note, since nothing can report it resolved. Any other value names a read that failed or a metric the store lacks.