Skip to content

Commit 8874c0b

Browse files
authored
Merge pull request #67 from stackrox/srcporter-alert-example
adding a set of simple alert examples
2 parents a8667d0 + 25fe4e0 commit 8874c0b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: api-examples/simple-alerts.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#Simple examples of ACS "alert" objects, the structure behind Violations in the UI
2+
3+
Simple curl examples
4+
5+
These examples all use environment variables for the Hostname of ACS Central (Control Plane) and for the contents of a StackRox API token that you can create from the UI under Platform Integration -> Integrations.
6+
7+
8+
Super simple alert retrieval:
9+
```bash
10+
curl -k -H "Authorization: Bearer ${TOKEN}" https://$CENTRAL/v1/alerts | jq -r '.'
11+
```
12+
13+
Using a search query for alerts:
14+
```bash
15+
curl -k -H "Authorization: Bearer ${TOKEN}" https://$CENTRAL/v1/alerts?query="Namespace:test" | jq -r '.'
16+
```
17+
18+
Combination search query:
19+
```bash
20+
curl -k -H "Authorization: Bearer ${TOKEN}" https://$CENTRAL/v1/alerts?query="Cluster:kube+Namespace:stackrox,kube-system" | jq -r '.'
21+
```
22+
23+
Combination search query with URL-safe encoding:
24+
```bash
25+
curl -k -H "Authorization: Bearer ${TOKEN}" https://$CENTRAL/v1/alerts?query=Severity%3AHIGH_SEVERITY%2BNamespace%3Apayments | jq -r '.'
26+
```
27+
28+
Search filter for time range:
29+
```bash
30+
curl -k -H "Authorization: Bearer ${TOKEN}" https://$CENTRAL/v1/alerts?query==Violation%20Time%3A%3E1d | jq -r '.'
31+
```

0 commit comments

Comments
 (0)