thousandeyes-sdk-python/thousandeyes-sdk-alerts/docs/AlertsApi.md
Miguel Pragosa c7906591dc [GitHub Bot] Generated python SDK (#80)
Co-authored-by: API Team <api-team@thousandeyes.com>
(cherry picked from commit cafc4e63c7)
2024-10-15 15:31:40 +01:00

9.4 KiB

thousandeyes_sdk.alerts.AlertsApi

All URIs are relative to https://api.thousandeyes.com/v7

Method HTTP request Description
get_alert GET /alerts/{alertId} Retrieve alert details
get_alerts GET /alerts List active alerts

get_alert

AlertDetail get_alert(alert_id, aid=aid)

Retrieve alert details

Returns detailed information about an alert using its ID.

Example

  • Bearer Authentication (BearerAuth):
import thousandeyes_sdk.alerts
from thousandeyes_sdk.alerts.models.alert_detail import AlertDetail
from thousandeyes_sdk.alerts.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
# See configuration.py for a list of all supported configuration parameters.
configuration = thousandeyes_sdk.core.Configuration(
    host = "https://api.thousandeyes.com/v7"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = thousandeyes_sdk.core.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = thousandeyes_sdk.alerts.AlertsApi(api_client)
    alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569' # str | Unique alert ID.
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # Retrieve alert details
        api_response = api_instance.get_alert(alert_id, aid=aid)
        print("The response of AlertsApi->get_alert:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AlertsApi->get_alert: %s\n" % e)

Parameters

Name Type Description Notes
alert_id str Unique alert ID.
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

AlertDetail

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_alerts

Alerts get_alerts(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, state=state)

List active alerts

Returns a list of active alerts. If no alerts are active within the specified time range, an empty response is returned. Note that time filters (window, startDate, or endDate) are only applied to cleared alerts.

Example

  • Bearer Authentication (BearerAuth):
import thousandeyes_sdk.alerts
from thousandeyes_sdk.alerts.models.alerts import Alerts
from thousandeyes_sdk.alerts.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
# See configuration.py for a list of all supported configuration parameters.
configuration = thousandeyes_sdk.core.Configuration(
    host = "https://api.thousandeyes.com/v7"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = thousandeyes_sdk.core.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = thousandeyes_sdk.alerts.AlertsApi(api_client)
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)
    window = '12h' # str | A dynamic time interval up to the current time of the request. Specify the interval as a number followed by an optional type: `s` for seconds (default if no type is specified), `m` for minutes, `h` for hours, `d` for days, and `w` for weeks. For a precise date range, use `startDate` and `endDate`. (optional)
    start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    end_date = '2022-07-18T22:00:54Z' # datetime | Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    max = 5 # int | (Optional) Maximum number of objects to return. (optional)
    state = thousandeyes_sdk.alerts.State() # State | Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. (optional)

    try:
        # List active alerts
        api_response = api_instance.get_alerts(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, state=state)
        print("The response of AlertsApi->get_alerts:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AlertsApi->get_alerts: %s\n" % e)

Parameters

Name Type Description Notes
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]
window str A dynamic time interval up to the current time of the request. Specify the interval as a number followed by an optional type: `s` for seconds (default if no type is specified), `m` for minutes, `h` for hours, `d` for days, and `w` for weeks. For a precise date range, use `startDate` and `endDate`. [optional]
start_date datetime Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
end_date datetime Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
max int (Optional) Maximum number of objects to return. [optional]
state State Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. [optional]

Return type

Alerts

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]