post https://app.bigeye.com/api/v1/metrics
To create a metric, leave out id or set it to 0. To edit a metric, leave the metric id in the payload.
{
"scheduleFrequency":{
"intervalType":"DAYS_TIME_INTERVAL_TYPE",
"intervalValue":1
},
"thresholds":[
{
"autoThreshold":{
"bound":{
"boundType":"UPPER_BOUND_SIMPLE_BOUND_TYPE",
"value":-1.0
},
"modelType":"UNDEFINED_THRESHOLD_MODEL_TYPE"
}
},
{
"autoThreshold":{
"bound":{
"boundType":"LOWER_BOUND_SIMPLE_BOUND_TYPE",
"value":-1.0
},
"modelType":"UNDEFINED_THRESHOLD_MODEL_TYPE"
}
}
],
"warehouseId":189,
"datasetId": 992,
"metricType":{
"predefinedMetric":{
"metricName":"PERCENT_NULL"
}
},
"parameters":[
{
"key":"arg1",
"columnName":"client_plan_tier"
}
],
"lookback":{
"intervalType":"DAYS_TIME_INTERVAL_TYPE",
"intervalValue":2
},
"grainSeconds": 86400,
"lookbackType":"METRIC_TIME_LOOKBACK_TYPE"
}
Below is a sample request body to create a template metric. As with the above non-template example, without a metricId will create a new metric. Leave in a metricId to update a metric.
{
"scheduleFrequency": {
"intervalType": "HOURS_TIME_INTERVAL_TYPE",
"intervalValue": 6
},
"thresholds": [
{
"autoThreshold": {
"bound": {
"boundType": "LOWER_BOUND_SIMPLE_BOUND_TYPE",
"value": -1.0
},
"modelType": "UNDEFINED_THRESHOLD_MODEL_TYPE",
"sensitivity": "AUTOTHRESHOLD_SENSITIVITY_WIDE"
}
},
{
"autoThreshold": {
"bound": {
"boundType": "UPPER_BOUND_SIMPLE_BOUND_TYPE",
"value": -1.0
},
"modelType": "UNDEFINED_THRESHOLD_MODEL_TYPE",
"sensitivity": "AUTOTHRESHOLD_SENSITIVITY_WIDE",
"forecastValue": -1.0
}
}
],
"warehouseId": 430,
"datasetId": 435148,
"metricType": {
"templateMetric": {
"templateId": 44,
"aggregationType": "COUNT_AGGREGATION_TYPE"
}
},
"parameters": [
{
"key": "fk_column",
"columnName": "metric_run_id"
},
{
"key": "tgt_column",
"stringValue": "id"
},
{
"key": "tg_table",
"stringValue": "metric_run"
}
]
}