Update a monitor
Update a data diff monitor via the Datafold API.
curl --request PATCH \
--url https://us.datafold.com/api/v1/monitors/{id}/update \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"primary_key": [
"<string>"
],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>"
}
],
"columns_to_compare": [
"<string>"
],
"compare_duplicates": true,
"empty_tables_match": true,
"exclude_columns": [
"<string>"
],
"ignore_string_case": true,
"include_columns": [
"<string>"
],
"null_equals_empty_string": true,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": true,
"tolerance": {
"datetime": {},
"float": {
"column_tolerance": {},
"default": {
"value": 1
}
}
}
},
"description": "<string>",
"enabled": true,
"name": "<string>",
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"hour": 11
},
"type": "none"
},
"slug": "<string>",
"tags": [
"<string>"
],
"type": "diff"
}
'import requests
url = "https://us.datafold.com/api/v1/monitors/{id}/update"
payload = {
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": True,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": True,
"query": "<string>",
"table": "<string>"
},
"primary_key": ["<string>"],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>"
}
],
"columns_to_compare": ["<string>"],
"compare_duplicates": True,
"empty_tables_match": True,
"exclude_columns": ["<string>"],
"ignore_string_case": True,
"include_columns": ["<string>"],
"null_equals_empty_string": True,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": True,
"tolerance": {
"datetime": {},
"float": {
"column_tolerance": {},
"default": { "value": 1 }
}
}
},
"description": "<string>",
"enabled": True,
"name": "<string>",
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": { "hour": 11 },
"type": "none"
},
"slug": "<string>",
"tags": ["<string>"],
"type": "diff"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alert: {different_rows_count: 1, different_rows_percent: 50, match_ratio_min: 0.5},
datadiff: {
dataset_a: {
connection_id: 123,
filter: '<string>',
materialize: true,
query: '<string>',
table: '<string>'
},
dataset_b: {
connection_id: 123,
filter: '<string>',
materialize: true,
query: '<string>',
table: '<string>'
},
primary_key: ['<string>'],
column_remapping: {},
column_rules: [{equal_if: '<string>', column: '<string>'}],
columns_to_compare: ['<string>'],
compare_duplicates: true,
empty_tables_match: true,
exclude_columns: ['<string>'],
ignore_string_case: true,
include_columns: ['<string>'],
null_equals_empty_string: true,
sampling: {confidence: 50, max_rows: 1, rate: 0.5, threshold: 1, tolerance: 0.5},
sort_array_columns: true,
tolerance: {datetime: {}, float: {column_tolerance: {}, default: {value: 1}}}
},
description: '<string>',
enabled: true,
name: '<string>',
owner: '<string>',
schedule: {cron: '<string>', interval: {hour: 11}, type: 'none'},
slug: '<string>',
tags: ['<string>'],
type: 'diff'
})
};
fetch('https://us.datafold.com/api/v1/monitors/{id}/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.datafold.com/api/v1/monitors/{id}/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'alert' => [
'different_rows_count' => 1,
'different_rows_percent' => 50,
'match_ratio_min' => 0.5
],
'datadiff' => [
'dataset_a' => [
'connection_id' => 123,
'filter' => '<string>',
'materialize' => true,
'query' => '<string>',
'table' => '<string>'
],
'dataset_b' => [
'connection_id' => 123,
'filter' => '<string>',
'materialize' => true,
'query' => '<string>',
'table' => '<string>'
],
'primary_key' => [
'<string>'
],
'column_remapping' => [
],
'column_rules' => [
[
'equal_if' => '<string>',
'column' => '<string>'
]
],
'columns_to_compare' => [
'<string>'
],
'compare_duplicates' => true,
'empty_tables_match' => true,
'exclude_columns' => [
'<string>'
],
'ignore_string_case' => true,
'include_columns' => [
'<string>'
],
'null_equals_empty_string' => true,
'sampling' => [
'confidence' => 50,
'max_rows' => 1,
'rate' => 0.5,
'threshold' => 1,
'tolerance' => 0.5
],
'sort_array_columns' => true,
'tolerance' => [
'datetime' => [
],
'float' => [
'column_tolerance' => [
],
'default' => [
'value' => 1
]
]
]
],
'description' => '<string>',
'enabled' => true,
'name' => '<string>',
'owner' => '<string>',
'schedule' => [
'cron' => '<string>',
'interval' => [
'hour' => 11
],
'type' => 'none'
],
'slug' => '<string>',
'tags' => [
'<string>'
],
'type' => 'diff'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.datafold.com/api/v1/monitors/{id}/update"
payload := strings.NewReader("{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://us.datafold.com/api/v1/monitors/{id}/update")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.datafold.com/api/v1/monitors/{id}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}"
response = http.request(request)
puts response.read_body{
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"id": 123,
"managed_in_code": true,
"modified_at": "2023-11-07T05:31:56Z",
"monitor_type": "diff",
"name": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"every": "hour",
"hour": 11
},
"type": "none"
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"primary_key": [
"<string>"
],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>",
"type": "boolean"
}
],
"columns_to_compare": [
"<string>"
],
"compare_duplicates": true,
"diff_type": "inmem",
"empty_tables_match": true,
"exclude_columns": [
"<string>"
],
"ignore_string_case": true,
"include_columns": [
"<string>"
],
"null_equals_empty_string": true,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": true,
"tolerance": {
"datetime": {
"default": "1s"
},
"float": {
"column_tolerance": {},
"default": {
"type": "absolute",
"value": 1
}
}
}
},
"description": "<string>",
"last_run": "2023-11-07T05:31:56Z",
"next_run": "2023-11-07T05:31:56Z",
"owner": "<string>",
"slug": "<string>",
"state": "ok",
"tags": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Authorizations
Use the 'Authorization' header with the format 'Key '
Path Parameters
The unique identifier of the monitor.
Body
A partial update. Only the keys present in the body are touched.
Unlike the as-code path — where the file is the whole truth, so an omitted threshold CLEARS the column — an omitted key here leaves the stored value alone. That asymmetry is the difference between declaring a monitor and editing one, and it is the pre-fork behaviour on both surfaces.
The thresholds. Names are the pre-fork ones; units are documented per field.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
One of three shapes, mirroring the pre-fork spec: cron, interval, or none.
Show child attributes
Show child attributes
"diff"Response
Successful Response
The list row plus the definition, in exactly the shape create and update accept.
What makes a run alert.
Show child attributes
Show child attributes
When the monitor was created.
Whether the schedule fires.
Unique identifier for the monitor.
True when the monitor's definition lives in a repo. Update and delete are refused for such a monitor — change its YAML instead.
When the monitor was last modified.
Type of the monitor.
"diff"Name of the monitor.
When the monitor runs.
Show child attributes
Show child attributes
The diff the monitor runs. Null only for a monitor whose stored definition has gone missing, which cannot happen for one this API created.
Show child attributes
Show child attributes
Free-text description.
When the monitor last started a run.
When the schedule fires next.
Email of the monitor owner.
Stable identifier.
Outcome of the latest run, once it has one.
ok, alert, error, cancelled Tags on the monitor.
curl --request PATCH \
--url https://us.datafold.com/api/v1/monitors/{id}/update \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"primary_key": [
"<string>"
],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>"
}
],
"columns_to_compare": [
"<string>"
],
"compare_duplicates": true,
"empty_tables_match": true,
"exclude_columns": [
"<string>"
],
"ignore_string_case": true,
"include_columns": [
"<string>"
],
"null_equals_empty_string": true,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": true,
"tolerance": {
"datetime": {},
"float": {
"column_tolerance": {},
"default": {
"value": 1
}
}
}
},
"description": "<string>",
"enabled": true,
"name": "<string>",
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"hour": 11
},
"type": "none"
},
"slug": "<string>",
"tags": [
"<string>"
],
"type": "diff"
}
'import requests
url = "https://us.datafold.com/api/v1/monitors/{id}/update"
payload = {
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": True,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": True,
"query": "<string>",
"table": "<string>"
},
"primary_key": ["<string>"],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>"
}
],
"columns_to_compare": ["<string>"],
"compare_duplicates": True,
"empty_tables_match": True,
"exclude_columns": ["<string>"],
"ignore_string_case": True,
"include_columns": ["<string>"],
"null_equals_empty_string": True,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": True,
"tolerance": {
"datetime": {},
"float": {
"column_tolerance": {},
"default": { "value": 1 }
}
}
},
"description": "<string>",
"enabled": True,
"name": "<string>",
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": { "hour": 11 },
"type": "none"
},
"slug": "<string>",
"tags": ["<string>"],
"type": "diff"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alert: {different_rows_count: 1, different_rows_percent: 50, match_ratio_min: 0.5},
datadiff: {
dataset_a: {
connection_id: 123,
filter: '<string>',
materialize: true,
query: '<string>',
table: '<string>'
},
dataset_b: {
connection_id: 123,
filter: '<string>',
materialize: true,
query: '<string>',
table: '<string>'
},
primary_key: ['<string>'],
column_remapping: {},
column_rules: [{equal_if: '<string>', column: '<string>'}],
columns_to_compare: ['<string>'],
compare_duplicates: true,
empty_tables_match: true,
exclude_columns: ['<string>'],
ignore_string_case: true,
include_columns: ['<string>'],
null_equals_empty_string: true,
sampling: {confidence: 50, max_rows: 1, rate: 0.5, threshold: 1, tolerance: 0.5},
sort_array_columns: true,
tolerance: {datetime: {}, float: {column_tolerance: {}, default: {value: 1}}}
},
description: '<string>',
enabled: true,
name: '<string>',
owner: '<string>',
schedule: {cron: '<string>', interval: {hour: 11}, type: 'none'},
slug: '<string>',
tags: ['<string>'],
type: 'diff'
})
};
fetch('https://us.datafold.com/api/v1/monitors/{id}/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.datafold.com/api/v1/monitors/{id}/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'alert' => [
'different_rows_count' => 1,
'different_rows_percent' => 50,
'match_ratio_min' => 0.5
],
'datadiff' => [
'dataset_a' => [
'connection_id' => 123,
'filter' => '<string>',
'materialize' => true,
'query' => '<string>',
'table' => '<string>'
],
'dataset_b' => [
'connection_id' => 123,
'filter' => '<string>',
'materialize' => true,
'query' => '<string>',
'table' => '<string>'
],
'primary_key' => [
'<string>'
],
'column_remapping' => [
],
'column_rules' => [
[
'equal_if' => '<string>',
'column' => '<string>'
]
],
'columns_to_compare' => [
'<string>'
],
'compare_duplicates' => true,
'empty_tables_match' => true,
'exclude_columns' => [
'<string>'
],
'ignore_string_case' => true,
'include_columns' => [
'<string>'
],
'null_equals_empty_string' => true,
'sampling' => [
'confidence' => 50,
'max_rows' => 1,
'rate' => 0.5,
'threshold' => 1,
'tolerance' => 0.5
],
'sort_array_columns' => true,
'tolerance' => [
'datetime' => [
],
'float' => [
'column_tolerance' => [
],
'default' => [
'value' => 1
]
]
]
],
'description' => '<string>',
'enabled' => true,
'name' => '<string>',
'owner' => '<string>',
'schedule' => [
'cron' => '<string>',
'interval' => [
'hour' => 11
],
'type' => 'none'
],
'slug' => '<string>',
'tags' => [
'<string>'
],
'type' => 'diff'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.datafold.com/api/v1/monitors/{id}/update"
payload := strings.NewReader("{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://us.datafold.com/api/v1/monitors/{id}/update")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.datafold.com/api/v1/monitors/{id}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"datadiff\": {\n \"dataset_a\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"dataset_b\": {\n \"connection_id\": 123,\n \"filter\": \"<string>\",\n \"materialize\": true,\n \"query\": \"<string>\",\n \"table\": \"<string>\"\n },\n \"primary_key\": [\n \"<string>\"\n ],\n \"column_remapping\": {},\n \"column_rules\": [\n {\n \"equal_if\": \"<string>\",\n \"column\": \"<string>\"\n }\n ],\n \"columns_to_compare\": [\n \"<string>\"\n ],\n \"compare_duplicates\": true,\n \"empty_tables_match\": true,\n \"exclude_columns\": [\n \"<string>\"\n ],\n \"ignore_string_case\": true,\n \"include_columns\": [\n \"<string>\"\n ],\n \"null_equals_empty_string\": true,\n \"sampling\": {\n \"confidence\": 50,\n \"max_rows\": 1,\n \"rate\": 0.5,\n \"threshold\": 1,\n \"tolerance\": 0.5\n },\n \"sort_array_columns\": true,\n \"tolerance\": {\n \"datetime\": {},\n \"float\": {\n \"column_tolerance\": {},\n \"default\": {\n \"value\": 1\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"enabled\": true,\n \"name\": \"<string>\",\n \"owner\": \"<string>\",\n \"schedule\": {\n \"cron\": \"<string>\",\n \"interval\": {\n \"hour\": 11\n },\n \"type\": \"none\"\n },\n \"slug\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"type\": \"diff\"\n}"
response = http.request(request)
puts response.read_body{
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"id": 123,
"managed_in_code": true,
"modified_at": "2023-11-07T05:31:56Z",
"monitor_type": "diff",
"name": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"every": "hour",
"hour": 11
},
"type": "none"
},
"datadiff": {
"dataset_a": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"dataset_b": {
"connection_id": 123,
"filter": "<string>",
"materialize": true,
"query": "<string>",
"table": "<string>"
},
"primary_key": [
"<string>"
],
"column_remapping": {},
"column_rules": [
{
"equal_if": "<string>",
"column": "<string>",
"type": "boolean"
}
],
"columns_to_compare": [
"<string>"
],
"compare_duplicates": true,
"diff_type": "inmem",
"empty_tables_match": true,
"exclude_columns": [
"<string>"
],
"ignore_string_case": true,
"include_columns": [
"<string>"
],
"null_equals_empty_string": true,
"sampling": {
"confidence": 50,
"max_rows": 1,
"rate": 0.5,
"threshold": 1,
"tolerance": 0.5
},
"sort_array_columns": true,
"tolerance": {
"datetime": {
"default": "1s"
},
"float": {
"column_tolerance": {},
"default": {
"type": "absolute",
"value": 1
}
}
}
},
"description": "<string>",
"last_run": "2023-11-07T05:31:56Z",
"next_run": "2023-11-07T05:31:56Z",
"owner": "<string>",
"slug": "<string>",
"state": "ok",
"tags": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}