Logging

Logging

/api/stats/

Additional filters for alerts.

Support for filters that are related to more than one field or provides unusual query.

Supported actions and methods:

/api/stats/alerts/

Methods: GET, POST

Supported fields for creation:

  • alert_typestring
  • messagestring
  • severitychoice('Debug', 'Error', 'Info', 'Warning')
  • scopelink to any: /api/users/<uuid>/, /api/keys/<uuid>/, /api/quotas/<uuid>/, /api/customers/<uuid>/, /api/projects/<uuid>/, /api/service-settings/<uuid>/, /api/price-estimates/<uuid>/
  • acknowledged – boolean

To get a list of alerts, run GET against /api/alerts/ as authenticated user.

Alert severity field can take one of this values: “Error”, “Warning”, “Info”, “Debug”. Field scope will contain link to object that cause alert. Context - dictionary that contains information about all related to alert objects.

Alerts can be filtered by:
  • ?severity=<severity> (can be list)
  • ?alert_type=<alert_type> (can be list)
  • ?scope=<url> concrete alert scope
  • ?scope_type=<string> name of scope type (Ex.: instance, service_project_link, project...) DEPRECATED use ?content_type instead
  • ?created_from=<timestamp>
  • ?created_to=<timestamp>
  • ?closed_from=<timestamp>
  • ?closed_to=<timestamp>
  • ?from=<timestamp> - filter alerts that was active from given date
  • ?to=<timestamp> - filter alerts that was active to given date
  • ?opened - if this argument is in GET request endpoint will return only alerts that are not closed
  • ?closed - if this argument is in GET request endpoint will return only alerts that are closed
  • ?aggregate=aggregate_model_name (default: ‘customer’. Have to be from list: ‘customer’, project’)
  • ?uuid=uuid_of_aggregate_model_object (not required. If this parameter will be defined - result ill contain only object with given uuid)
  • ?acknowledged=True|False - show only acknowledged (non-acknowledged) alerts
  • ?content_type=<string> name of scope content type in format <app_name>.<scope_type> (Ex.: structure.project, openstack.instance...)
  • ?exclude_features=<feature> (can be list) - exclude alert from output if it’s type corresponds o one of given features

Alerts can be ordered by:

-?o=severity - order by severity -?o=created - order by creation time
GET /api/alerts/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

[
    {
        "url": "http://example.com/api/alerts/e80e48a4e58b48ff9a1320a0aa0d68ab/",
        "uuid": "e80e48a4e58b48ff9a1320a0aa0d68ab",
        "alert_type": "first_alert",
        "message": "message#1",
        "severity": "Debug",
        "scope": "http://example.com/api/instances/9d1d7e03b0d14fd0b42b5f649dfa3de5/",
        "created": "2015-05-29T14:24:27.342Z",
        "closed": null,
        "context": {
            'customer_abbreviation': 'customer_abbreviation',
            'customer_contact_details': 'customer details',
            'customer_name': 'Customer name',
            'customer_uuid': '53c6e86406e349faa7924f4c865b15ab',
            'quota_limit': '131072.0',
            'quota_name': 'ram',
            'quota_usage': '131071',
            'quota_uuid': 'f6ae2f7ca86f4e2f9bb64de1015a2815',
            'scope_name': 'project X',
            'scope_uuid': '0238d71ee1934bd2839d4e71e5f9b91a'
        }
        "acknowledged": true,
    }
]

Run POST against /api/alerts/ to create or update alert. If alert with posted scope and alert_type already exists - it will be updated. Only users with staff privileges can create alerts.

Request example:

POST /api/alerts/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "scope": "http://testserver/api/projects/b9e8a102b5ff4469b9ac03253fae4b95/",
    "message": "message#1",
    "alert_type": "first_alert",
    "severity": "Debug"
}

/api/hooks/

Use /api/hooks/ to get a list of all the hooks of any type that a user can see.

Supported actions and methods:

/api/hooks/

Methods: GET

Use /api/hooks/ to get a list of all the hooks of any type that a user can see.

/api/hooks-web/

Supported actions and methods:

/api/hooks-web/

Methods: GET, POST

Supported fields for creation:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • destination_urlURL
  • content_type – choice('form', 'json')

To create new web hook issue POST against /api/hooks-web/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-web/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["resource_start_succeeded"],
    "event_groups": ["users"],
    "destination_url": "http://example.com/"
}

When hook is activated, POST request is issued against destination URL with the following data:

{
    "timestamp": "2015-07-14T12:12:56.000000",
    "message": "Customer ABC LLC has been updated.",
    "type": "customer_update_succeeded",
    "context": {
        "user_native_name": "Walter Lebrowski",
        "customer_contact_details": "",
        "user_username": "Walter",
        "user_uuid": "1c3323fc4ae44120b57ec40dea1be6e6",
        "customer_uuid": "4633bbbb0b3a4b91bffc0e18f853de85",
        "ip_address": "8.8.8.8",
        "user_full_name": "Walter Lebrowski",
        "customer_abbreviation": "ABC LLC",
        "customer_name": "ABC LLC"
    },
    "levelname": "INFO"
}

Note that context depends on event type.

/api/hooks-web/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • destination_urlURL
  • content_type – choice('form', 'json')

To create new web hook issue POST against /api/hooks-web/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-web/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["resource_start_succeeded"],
    "event_groups": ["users"],
    "destination_url": "http://example.com/"
}

When hook is activated, POST request is issued against destination URL with the following data:

{
    "timestamp": "2015-07-14T12:12:56.000000",
    "message": "Customer ABC LLC has been updated.",
    "type": "customer_update_succeeded",
    "context": {
        "user_native_name": "Walter Lebrowski",
        "customer_contact_details": "",
        "user_username": "Walter",
        "user_uuid": "1c3323fc4ae44120b57ec40dea1be6e6",
        "customer_uuid": "4633bbbb0b3a4b91bffc0e18f853de85",
        "ip_address": "8.8.8.8",
        "user_full_name": "Walter Lebrowski",
        "customer_abbreviation": "ABC LLC",
        "customer_name": "ABC LLC"
    },
    "levelname": "INFO"
}

Note that context depends on event type.

/api/hooks-push/

Supported actions and methods:

/api/hooks-push/

Methods: GET, POST

Supported fields for creation:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • typechoice('Android', 'iOS')
  • device_id – string
  • token – string
  • device_manufacturer – string
  • device_model – string

To create new push hook issue POST against /api/hooks-push/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-push/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["resource_start_succeeded"],
    "event_groups": ["users"],
    "type": "Android"
}

You may temporarily disable hook without deleting it by issuing following PATCH request against hook URL:

{
    "is_active": "false"
}

/api/hooks-push/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • typechoice('Android', 'iOS')
  • device_id – string
  • token – string
  • device_manufacturer – string
  • device_model – string

To create new push hook issue POST against /api/hooks-push/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-push/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["resource_start_succeeded"],
    "event_groups": ["users"],
    "type": "Android"
}

You may temporarily disable hook without deleting it by issuing following PATCH request against hook URL:

{
    "is_active": "false"
}

/api/hooks-email/

Supported actions and methods:

/api/hooks-email/

Methods: GET, POST

Supported fields for creation:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • emailemail

To create new email hook issue POST against /api/hooks-email/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-email/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["openstack_instance_start_succeeded"],
    "event_groups": ["users"],
    "email": "test@example.com"
}

You may temporarily disable hook without deleting it by issuing following PATCH request against hook URL:

{
    "is_active": "false"
}

/api/hooks-email/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • is_active – boolean
  • event_types – choice('auth_logged_in_with_username', 'auth_logged_out', 'auth_login_failed_with_username', 'custom_notification', 'customer_creation_succeeded', 'customer_deletion_succeeded', 'customer_price_limit_updated', 'customer_update_succeeded', 'project_creation_succeeded', 'project_deletion_succeeded', 'project_price_limit_updated', 'project_update_succeeded', 'resource_creation_failed', 'resource_creation_scheduled', 'resource_creation_succeeded', 'resource_deletion_failed', 'resource_deletion_scheduled', 'resource_deletion_succeeded', 'resource_import_succeeded', 'resource_restart_failed', 'resource_restart_scheduled', 'resource_restart_succeeded', 'resource_start_failed', 'resource_start_scheduled', 'resource_start_succeeded', 'resource_stop_failed', 'resource_stop_scheduled', 'resource_stop_succeeded', 'resource_update_succeeded', 'role_granted', 'role_revoked', 'ssh_key_creation_succeeded', 'ssh_key_deletion_succeeded', 'token_created', 'user_activated', 'user_creation_succeeded', 'user_deactivated', 'user_deletion_succeeded', 'user_organization_approved', 'user_organization_claimed', 'user_organization_rejected', 'user_organization_removed', 'user_password_updated', 'user_token_lifetime_updated', 'user_update_succeeded')
  • event_groups – choice('customers', 'projects', 'resources', 'ssh', 'users')
  • emailemail

To create new email hook issue POST against /api/hooks-email/ as an authenticated user. You should specify list of event_types or event_groups.

Example of a request:

POST /api/hooks-email/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "event_types": ["openstack_instance_start_succeeded"],
    "event_groups": ["users"],
    "email": "test@example.com"
}

You may temporarily disable hook without deleting it by issuing following PATCH request against hook URL:

{
    "is_active": "false"
}

/api/events/

Sorting is supported in ascending and descending order by specifying a field to an ?o= parameter. By default events are sorted by @timestamp in descending order.

  • ?o=@timestamp

Filtering of customer list is supported through HTTP query parameters, the following fields are supported:

  • ?event_type=<string> - type of filtered events. Can be list
  • ?search=<string> - text for FTS. FTS fields: ‘message’, ‘customer_abbreviation’, ‘importance’ ‘project_name’, ‘user_full_name’, ‘user_native_name’
  • ?scope=<URL> - url of object that is connected to event
  • ?scope_type=<string> - name of scope type of object that is connected to event
  • ?feature=<feature> (can be list) - include all event with type that belong to given features
  • ?exclude_features=<feature> (can be list) - exclude event from output if it’s type corresponds to one of listed features
  • ?user_username=<string> - user’s username
  • ?from=<timestamp> - beginning UNIX timestamp
  • ?to=<timestamp> - ending UNIX timestamp

Supported actions and methods:

/api/events/

Methods: GET, POST

Supported fields for creation:

  • levelchoice('debug', 'error', 'info', 'warning')
  • messagestring
  • scope – link to any: /api/users/<uuid>/, /api/keys/<uuid>/, /api/quotas/<uuid>/, /api/customers/<uuid>/, /api/projects/<uuid>/, /api/service-settings/<uuid>/, /api/price-estimates/<uuid>/

To get a list of events - run GET against /api/events/ as authenticated user. Note that a user can only see events connected to objects she is allowed to see.

Sorting is supported in ascending and descending order by specifying a field to an ?o= parameter. By default events are sorted by @timestamp in descending order.

Run POST against /api/events/ to create an event. Only users with staff privileges can create events. New event will be emitted with custom_notification event type. Request should contain following fields:

  • level: the level of current event. Following levels are supported: debug, info, warning, error
  • message: string representation of event message
  • scope: optional URL, which points to the loggable instance

Request example:

POST /api/events/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "level": "info",
    "message": "message#1",
    "scope": "http://example.com/api/customers/9cd869201e1b4158a285427fcd790c1c/"
}

/api/events/count/

Methods: GET

To get a count of events - run GET against /api/events/count/ as authenticated user. Endpoint support same filters as events list.

Response example:

{"count": 12321}

/api/events/count_history/

Methods: GET

To get a historical data of events amount - run GET against /api/events/count/history/. Endpoint support same filters as events list. More about historical data - read at section Historical data.

Response example:

[
    {
        "point": 141111111111,
        "object": {
            "count": 558
        }
    }
]

/api/events/event_groups/

Methods: GET

Returns a list of groups with event types. Group is used in exclude_features query param.

/api/events/scope_types/

Methods: GET

Returns a list of scope types acceptable by events filter.

/api/events/count/history/

Methods: GET, POST

/api/alerts/

Additional filters for alerts.

Support for filters that are related to more than one field or provides unusual query.

Supported actions and methods:

/api/alerts/

Methods: GET, POST

Supported fields for creation:

  • alert_typestring
  • messagestring
  • severitychoice('Debug', 'Error', 'Info', 'Warning')
  • scopelink to any: /api/users/<uuid>/, /api/keys/<uuid>/, /api/quotas/<uuid>/, /api/customers/<uuid>/, /api/projects/<uuid>/, /api/service-settings/<uuid>/, /api/price-estimates/<uuid>/
  • acknowledged – boolean

To get a list of alerts, run GET against /api/alerts/ as authenticated user.

Alert severity field can take one of this values: “Error”, “Warning”, “Info”, “Debug”. Field scope will contain link to object that cause alert. Context - dictionary that contains information about all related to alert objects.

Alerts can be filtered by:
  • ?severity=<severity> (can be list)
  • ?alert_type=<alert_type> (can be list)
  • ?scope=<url> concrete alert scope
  • ?scope_type=<string> name of scope type (Ex.: instance, service_project_link, project...) DEPRECATED use ?content_type instead
  • ?created_from=<timestamp>
  • ?created_to=<timestamp>
  • ?closed_from=<timestamp>
  • ?closed_to=<timestamp>
  • ?from=<timestamp> - filter alerts that was active from given date
  • ?to=<timestamp> - filter alerts that was active to given date
  • ?opened - if this argument is in GET request endpoint will return only alerts that are not closed
  • ?closed - if this argument is in GET request endpoint will return only alerts that are closed
  • ?aggregate=aggregate_model_name (default: ‘customer’. Have to be from list: ‘customer’, project’)
  • ?uuid=uuid_of_aggregate_model_object (not required. If this parameter will be defined - result ill contain only object with given uuid)
  • ?acknowledged=True|False - show only acknowledged (non-acknowledged) alerts
  • ?content_type=<string> name of scope content type in format <app_name>.<scope_type> (Ex.: structure.project, openstack.instance...)
  • ?exclude_features=<feature> (can be list) - exclude alert from output if it’s type corresponds o one of given features

Alerts can be ordered by:

-?o=severity - order by severity -?o=created - order by creation time
GET /api/alerts/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

[
    {
        "url": "http://example.com/api/alerts/e80e48a4e58b48ff9a1320a0aa0d68ab/",
        "uuid": "e80e48a4e58b48ff9a1320a0aa0d68ab",
        "alert_type": "first_alert",
        "message": "message#1",
        "severity": "Debug",
        "scope": "http://example.com/api/instances/9d1d7e03b0d14fd0b42b5f649dfa3de5/",
        "created": "2015-05-29T14:24:27.342Z",
        "closed": null,
        "context": {
            'customer_abbreviation': 'customer_abbreviation',
            'customer_contact_details': 'customer details',
            'customer_name': 'Customer name',
            'customer_uuid': '53c6e86406e349faa7924f4c865b15ab',
            'quota_limit': '131072.0',
            'quota_name': 'ram',
            'quota_usage': '131071',
            'quota_uuid': 'f6ae2f7ca86f4e2f9bb64de1015a2815',
            'scope_name': 'project X',
            'scope_uuid': '0238d71ee1934bd2839d4e71e5f9b91a'
        }
        "acknowledged": true,
    }
]

Run POST against /api/alerts/ to create or update alert. If alert with posted scope and alert_type already exists - it will be updated. Only users with staff privileges can create alerts.

Request example:

POST /api/alerts/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "scope": "http://testserver/api/projects/b9e8a102b5ff4469b9ac03253fae4b95/",
    "message": "message#1",
    "alert_type": "first_alert",
    "severity": "Debug"
}

/api/alerts/alert_groups/

Methods: GET

Returns a list of groups with alert types. Group is used in exclude_features query param.

/api/alerts/stats/

Methods: GET

To get count of alerts per severities - run GET request against /api/alerts/stats/. This endpoint supports all filters that are available for alerts list (/api/alerts/).

Response example:

{
    "debug": 2,
    "error": 1,
    "info": 1,
    "warning": 1
}

/api/alerts/<uuid>/

Methods: GET, POST

Run POST against /api/alerts/ to create or update alert. If alert with posted scope and alert_type already exists - it will be updated. Only users with staff privileges can create alerts.

Request example:

POST /api/alerts/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "scope": "http://testserver/api/projects/b9e8a102b5ff4469b9ac03253fae4b95/",
    "message": "message#1",
    "alert_type": "first_alert",
    "severity": "Debug"
}

/api/alerts/<uuid>/acknowledge/

Methods: POST

To acknowledge alert - run POST against /api/alerts/<alert_uuid>/acknowledge/. No payload is required. All users that can see alerts can also acknowledge it. If alert is already acknowledged endpoint will return error with code 409(conflict).

/api/alerts/<uuid>/cancel_acknowledgment/

Methods: POST

To cancel alert acknowledgment - run POST against /api/alerts/<alert_uuid>/cancel_acknowledgment/. No payload is required. All users that can see alerts can also cancel it acknowledgment. If alert is not acknowledged endpoint will return error with code 409 (conflict).

/api/alerts/<uuid>/close/

Methods: POST

To close alert - run POST against /api/alerts/<alert_uuid>/close/. No data is required. Only users with staff privileges can close alerts.