# ListAlertRecord - ListAlertRecord

## Overview

Get alarm records within a time period






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `ListAlertRecord`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |**Yes**|
| **StartAt** | int | StartAt，Query the alarm record start time (does not support querying data one year before the current time), Value is a 10 digit timestamp<br /> |**Yes**|
| **EndAt** | int | EndAt，Query the end time of the alarm record (the interval between the end time and the start time cannot exceed one month), Value is a 10 digit timestamp |**Yes**|
| **Fuzzy** | string | Fuzzy query (supports fuzzy search of resourceID and alarm content) |No|
| **Filter.ProductTypes.N** | int | ProductID, accurately search for corresponding alarm records based on product type， See[Product Introduce](https://docs.ucloud.cn/cloudwatch/metric/intro) |No|
| **Filter.Levels.N** | string | Alarm level, accurately search for corresponding alarm records according to the alarm level, The enumeration values are: P0, P1, P2, P3 |No|
| **Filter.Status.N** | string | Alarm status, accurately search for corresponding alarm records based on the alarm status，The enumeration values are: firing，resolved |No|
| **OrderType** | string | Sorting (by default, in reverse order of alarm occurrence time), The enumeration values are: asc,desc |No|
| **Limit** | int | The query returns the number of items，default value is 300, maximum value: 300. |No|
| **Offset** | int | Data Offset (Default 0)<br /> |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **Data** | array[[*AlertRecord*](#alertrecord)] | Alarm data set |No|
| **TotalCount** | int | Alarm total count |No|

#### Data Model


#### AlertRecord

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region |No|
| **RecordID** | int | Alert Record RecordID |No|
| **ProjectID** | int | ProjectID |No|
| **StrategyName** | string | Alarm Record Trigger Alarm Strategy Name |No|
| **ProductType** | int | Product Type |No|
| **ProductName** | string | Product Type Name |No|
| **ResourceID** | string | Resource ID |No|
| **MetricID** | int | Metric ID |No|
| **MetricName** | string | Metric Name |No|
| **UnitName** | string | Unit Name |No|
| **StrategyID** | int | Alarm Record Triggered Alarm Strategy Id |No|
| **RuleID** | int | Alarm Record Triggered Alarm Rule Id |No|
| **Tag** | array[string] | Alert Tag |No|
| **Value** | int | Alert Current Value |No|
| **ThresholdCompare** | int | Alert Threshold Compare |No|
| **ThresholdValue** | int | Alert Threshold Value |No|
| **ShieldRuleID** | int | Alarm shielding rule id (if a shielding rule is configured and conditions are met) |No|
| **Level** | string | Alarm Level |No|
| **Status** | string | Alarm Status |No|
| **StartAt** | int | Alarm Trigger Time |No|
| **EndAt** | int | Alarm Recovery Time |No|
| **ContentAttr** | object | Additional Product Attributes |No|

## Example

### Request Example
    
```
https://api.scloudsg.com/?Action=ListAlertRecord
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=lHbpbCJv
&RecordID=1
&StartAt=4
&EndAt=7
&Fuzzy=hAVEfaDE
&RecordID=6
&StartAt=5
&EndAt=8
&Fuzzy=jVymouaW
&Fuzzy=WYjEKfyo
&Filter.ProductTypes.N=6
&Filter.Levels.N=lxexxlZh
&Filter.Status.N=wakzNxlZ
&OrderType=JXKKXtZY
&Limit=3
&Offset=3
```

### Response Example
    
```json
{
  "Action": "ListAlertRecordResponse",
  "Data": [
    {
      "IsShield": false,
      "Level": "P2",
      "MetricID": 13333,
      "MetricName": "CPU使用率",
      "ProductName": "云主机",
      "ProductType": 1,
      "ProjectID": 23332,
      "RecordID": 1111,
      "Region": "cn-bj2",
      "ResourceID": "uhost-xxx",
      "RuleID": 1234,
      "ShieldRuleID": 0,
      "StartAt": 1755104487,
      "Status": "firing",
      "StrategyID": 3333,
      "StrategyName": "资源组告警",
      "Tag": [],
      "ThresholdCompare": 1,
      "ThresholdValue": 0,
      "UnitName": "%",
      "Value": 0,
      "Zone": "cn-bj2-05"
    }
  ],
  "RetCode": 0,
  "TotalCount": 1,
  "TraceId": "217e6c67-9c34-4c48-8c0e-c4ab7380e51c"
}
```





