Personalized Alerts API Code Samples

Selection of code samples that demonstrate the use of the Personalized Alerts API. Copy and edit these code samples to suit your needs.

When using the code samples, remember to replace:

  • {vanity_name} with your tenant name
  • {api_key} with your API key
  • {security_token} with a valid security token

These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Personalized Alerts" in API Reference.

Retrieve personalized alerts

Use this sample request to retrieve all the personalized alerts you have access to.

Copy
cURL sample request: Retrieve all personalized alerts
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns your personalized alerts.

Retrieve a personalized alert

Use this sample request to retrieve a specific personalized alert.

Copy
cURL sample request: Retrieve alert 00000000-0000-0000-0000-000000000000
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts/00000000-0000-0000-0000-000000000000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the personalized alert details.

Create a personalized alert

Use this sample request to create a new personalized alert.

Copy
cURL sample request: Create an alert
curl -X POST --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "displayName": "API Critical Employee Alert",
    "triggerCriteria": {
        "groupedMetricValueThreshold": {
            "metric": {
                "id": "Exit_Model.Rate.Exit",
                "parameterValues": [],
                "timeHandling": {
                    "trailingPeriods": {
                        "periodType": "M",
                        "periodsBack": 6
                    }
                }
            },
            "filters": [
                {
                    "conceptReference": {
                        "id": "Employee.isCriticalEmployee",
                        "qualifyingPath": "Employee_Exit.Employee"
                    }
                }
            ],
            "dimension": {
                "id": "Organization_Hierarchy",
                "qualifyingPath": "Employee_Exit.Employee"
            },
            "relativeTimePeriod": {
                "allowPartialPeriod": false,
                "periodType": "QUARTER",
                "periodCount": 1,
                "direction": "BACKWARD"
            },
            "ruleSet": {
                "compareTo": {
                    "noComparison": {}
                },
                "rules": [
                    {
                        "relativeToValueRule": {
                            "rulePredicate": "GREATER_THAN",
                            "comparand": 0.1
                        }
                    }
                ]
            }
        }
    }
}'

The response returns the personalized alert details.

Update a personalized alert

Use this sample request to update an existing personalized alert.

Copy
cURL sample request: Update alert 00000000-0000-0000-0000-000000000000
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts/00000000-0000-0000-0000-000000000000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "displayName": "Updated API Critical Employee Alert",
    "triggerCriteria": {
        "groupedMetricValueThreshold": {
            "metric": {
                "id": "Exit_Model.Rate.Exit",
                "parameterValues": [],
                "timeHandling": {
                    "trailingPeriods": {
                        "periodType": "M",
                        "periodsBack": 6
                    }
                }
            },
            "filters": [
                {
                    "conceptReference": {
                        "id": "Employee.isCriticalEmployee",
                        "qualifyingPath": "Employee_Exit.Employee"
                    }
                }
            ],
            "dimension": {
                "id": "Organization_Hierarchy",
                "qualifyingPath": "Employee_Exit.Employee"
            },
            "relativeTimePeriod": {
                "allowPartialPeriod": false,
                "periodType": "QUARTER",
                "periodCount": 1,
                "direction": "BACKWARD"
            },
            "ruleSet": {
                "compareTo": {
                    "noComparison": {}
                },
                "rules": [
                    {
                        "relativeToValueRule": {
                            "rulePredicate": "GREATER_THAN",
                            "comparand": 0.1
                        }
                    }
                ]
            }
        }
    }
}'

The response returns the personalized alert details.

Enable or disable a personalized alert

Use this sample request to disable an existing personalized alert.

Copy
cURL sample request: Disable alert 00000000-0000-0000-0000-000000000000
curl -X PUT --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts/00000000-0000-0000-0000-000000000000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "status": "PAUSED"
}'

The response returns the personalized alert's status.

Delete a personalized alert

Use this sample request to delete an existing personalized alert.

Copy
cURL sample request: Delete alert 00000000-0000-0000-0000-000000000000
curl -X DELETE --url 'https://{vanity_name}.api.visier.io/v1alpha/alerts/00000000-0000-0000-0000-000000000000' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the deleted personalized alert's ID.

Retrieve personalized alerts notifications

Use this sample request to retrieve all the notifications for your personalized alerts.

Copy
cURL sample request: Retrieve alert notifications
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/notifications' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns any notifications for your personalized alerts in the last 30 days, including the criteria that triggered the alert.