This page explains how to manage notifiers programmatically via the API.

Prerequisites

  • Create an API token in Axiom with permissions to create, read, update, and delete datasets.
  • In the code samples below, replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

Create notifiers

To create a notifier, send a POST request to the notifiers endpoint. In the body of the request, specify the following:

  • name of the notifier.
  • The properties field takes an object that defines the attributes of the notifier. The required attributes depend on the type of notifier you create. For example, to create an email notifier, specify the list of emails to be notified.

For example:

curl -X 'POST' 'https://api.axiom.co/v2/notifiers' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN' \
-d '{
    "name": "test_notifier",
    "properties": {
      "email": {
        "emails": [
          "example1@abc.com",
          "example2@abc.com"
        ]
      }
    }
  }'

The example response contains the notifier ID that you can later use to access the notifier programmatically.

{
  "createdAt":"2024-09-04T11:42:50.225Z",
  "disabledUntil": "0001-01-01T00:00:00Z",
  "id": "abc123",
  "name": "test_notifier",
  "properties": {
    "email": {
      "emails": [
        "example1@abc.com",
        "example2@abc.com"
      ]
    }
  }
}

For more information, see the API reference.

Get information about notifiers

Get information about all notifiers

To get information about all the notifiers in your Axiom organization, send a GET request to the notifiers endpoint. For example:

curl -X 'GET' 'https://api.axiom.co/v2/notifiers' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

The example response is a list of notifier objects. Each object contains a unique notifier ID that you can later use to access the notifier programmatically.

[
  {
    "createdAt":"2024-09-04T11:42:50.225Z",
    "disabledUntil": "0001-01-01T00:00:00Z",
    "id": "abc123",
    "name": "test_notifier1",
    "properties": {
      "email": {
        "emails": [
          "example1@abc.com",
          "example2@abc.com"
        ]
      }
    }
  },
  {
    "createdAt":"2024-09-04T11:42:50.225Z",
    "disabledUntil": "0001-01-01T00:00:00Z",
    "id": "abc321",
    "name": "test_notifier2",
    "properties": {
      "email": {
        "emails": [
          "example3@abc.com",
          "example4@abc.com"
        ]
      }
    }
  }
]

For more information, see the API reference.

Get information about specific notifier

To get information about a specific notifier, send a GET request to the notifiers/ID endpoint where ID is the unique ID of the notifier. For example:

curl -X 'GET' 'https://api.axiom.co/v2/notifiers/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

Example response:

{
  "createdAt":"2024-09-04T11:42:50.225Z",
  "disabledUntil": "0001-01-01T00:00:00Z",
  "id": "abc123",
  "name": "test_notifier",
  "properties": {
    "email": {
      "emails": [
        "example1@abc.com",
        "example2@abc.com"
      ]
    }
  }
}

For more information, see the API reference.

Update notifiers

To update a notifier, send a PUT request to the notifiers/ID endpoint where ID is the unique ID of the notifier. In the body of the request, specify the properties you want to update. Include the name field even if you don’t want to change it. For example:

curl -X 'PUT' 'https://api.axiom.co/v2/notifiers/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN' \
-d '{
    "name": "test_notifier",
    "properties": {
      "email": {
        "emails": [
          "example3@abc.com",
          "example4@abc.com"
        ]
      }
    }
  }'

Example response:

{
  "disabledUntil": "0001-01-01T00:00:00Z",
  "id": "abc123",
  "name": "test_notifier",
  "properties": {
    "email": {
      "emails": [
        "example3@abc.com",
        "example4@abc.com"
      ]
    }
  }
}

For more information, see the API reference.

Delete notifiers

To delete a notifier, send a DELETE request to the notifiers/ID endpoint where ID is the unique ID of the notifier. For example:

curl -X 'DELETE' 'https://api.axiom.co/v2/notifiers/abc123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

For more information, see the API reference.