Alert Data
Rest API Overview
Refer to Appendix C: Available Alerts for more information on alerts available in the Powerhub API.
Command | Endpoint | Description |
---|---|---|
GET | alerts/last | Retrieve the most recent alerts |
GET | alerts/history | Retrieve historical alerts |
Request Parameters
- target_id: (Required) UUID of a site or group to query.
- active_only: True/false. Defaults to false. When true, only active alerts are returned.
- since_time: (Required for /last endpoint) Defines how far to look back for alerts.
- start_datetime: (Required for /history endpoint) Beginning time index to search. Must be in IS08601 date and time combined representation format. Example 2017-01-27T08:45:00Z. Should include the time zone offset (UTC time used here, as indicated by the Z), it may include milliseconds.
- end_datetime: (Required for /history endpoint) End time index to search. Must be in IS08601 date and time combined representation format. Example 2017-01-27T08:45:00Z. Should include the time zone offset (UTC time used here, as indicated by the Z), it may include milliseconds.
- alert_name: Filter alerts by name. Requires using the full and correct alert name. Refer to Appendix C for a list of all available alerts and their names.
- alert_severity: Filter alerts by severity level. Requires using the full and correct severity name. Refer to Appendix C for a list of all available alerts and their severities.
- page_size: Limit results returned by datastore. Default 100, min 10, max 1000.
- cursor: Use to fetch from a specific page of results from datastore.
Response Parameters
- din: See Device Identification.
- start_time: Time at which alert was detected.
- end_time: Time at which alert is no longer detected.
- status: Open or Closed. Alert is closed when it has an end_time.
- alert_name: Alert name.
- description: Alert description.
- is_active: True/False. True when status is open, false when status is closed.
- severity: Severity of alert.
Latest Alerts Endpoint Example Request and Response
TBD
Historical Alerts Endpoint Example Request and Response
Request
curl --location 'https://api.sn.tesla.services/alerts/history?target_id=a10b4ddd-02df-4be3-b045-c248ce9ad209&active_only=false&start_datetime=2024-07-01T00%3A00%3A00Z&end_datetime=2024-07-18T12%3A00%3A00Z&alert_severity=critical' \
--header 'Authorization: Bearer $TOKEN\
--header 'Accept-Encoding: gzip'
Response
{
"data": [
{
"din": "1707000-3X-K--TG1240480006MT",
"start_time": "2024-07-18T03:20:31.000Z",
"end_time": "2024-07-18T03:50:32.000Z",
"status": "Closed",
"alert_name": "Battery Fault",
"description": "One or more inverter blocks is in a faulted state. The inverter block will shut down to self-protect and not charge or discharge.Steps to Fix:Escalate to Tesla.Scope to Fix:Tesla",
"is_active": false,
"severity": "critical"
},
{
"din": "1707000-3X-K--TG1240480006MT",
"start_time": "2024-07-17T12:46:16.000Z",
"end_time": "2024-07-17T12:46:18.000Z",
"status": "Closed",
"alert_name": "Battery Fault",
"description": "One or more inverter blocks is in a faulted state. The inverter block will shut down to self-protect and not charge or discharge.Steps to Fix:Escalate to Tesla.Scope to Fix:Tesla",
"is_active": false,
"severity": "critical"
}
],
"metadata": {
"next_cursor": "eyJwYWdlTnVtYmVyIjoxfQ==",
"request_id": "5c06f3b86d93f394bea1e9dd3176a635"
}
}