Create a data diff monitor
Create a data diff monitor via the Datafold API.
curl --request POST \
--url https://us.datafold.com/api/v1/monitors/create/diff \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"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
}
}
}
},
"name": "<string>",
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"description": "<string>",
"enabled": true,
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"hour": 11
},
"type": "none"
},
"slug": "<string>",
"tags": [
"<string>"
]
}
'import requests
url = "https://us.datafold.com/api/v1/monitors/create/diff"
payload = {
"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 }
}
}
},
"name": "<string>",
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"description": "<string>",
"enabled": True,
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": { "hour": 11 },
"type": "none"
},
"slug": "<string>",
"tags": ["<string>"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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}}}
},
name: '<string>',
alert: {different_rows_count: 1, different_rows_percent: 50, match_ratio_min: 0.5},
description: '<string>',
enabled: true,
owner: '<string>',
schedule: {cron: '<string>', interval: {hour: 11}, type: 'none'},
slug: '<string>',
tags: ['<string>']
})
};
fetch('https://us.datafold.com/api/v1/monitors/create/diff', 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/create/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]
]
],
'name' => '<string>',
'alert' => [
'different_rows_count' => 1,
'different_rows_percent' => 50,
'match_ratio_min' => 0.5
],
'description' => '<string>',
'enabled' => true,
'owner' => '<string>',
'schedule' => [
'cron' => '<string>',
'interval' => [
'hour' => 11
],
'type' => 'none'
],
'slug' => '<string>',
'tags' => [
'<string>'
]
]),
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/create/diff"
payload := strings.NewReader("{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}")
req, _ := http.NewRequest("POST", 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.post("https://us.datafold.com/api/v1/monitors/create/diff")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.datafold.com/api/v1/monitors/create/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}"
response = http.request(request)
puts response.read_body{
"id": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Authorizations
Use the 'Authorization' header with the format 'Key '
Body
A monitor definition. The as-code spec, with name required.
Named as the pre-fork schema was so the published OpenAPI component keeps its
identifier; the fields are DiffMonitorSpec's, minus the removed features.
The diff the monitor runs.
Show child attributes
Show child attributes
The name of the monitor.
What makes a run alert.
Show child attributes
Show child attributes
Free-text description.
Whether the schedule fires.
Email of the monitor owner. Resolved best-effort — an address matching no user in the org leaves the owner unset rather than failing the call.
When the monitor runs.
Show child attributes
Show child attributes
Stable identifier, and the identity monitors-as-code reconciles on. Optional, but a monitor without one cannot be exported as YAML.
Tags on the monitor.
Response
Successful Response
Unique identifier for the created monitor.
curl --request POST \
--url https://us.datafold.com/api/v1/monitors/create/diff \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"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
}
}
}
},
"name": "<string>",
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"description": "<string>",
"enabled": true,
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": {
"hour": 11
},
"type": "none"
},
"slug": "<string>",
"tags": [
"<string>"
]
}
'import requests
url = "https://us.datafold.com/api/v1/monitors/create/diff"
payload = {
"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 }
}
}
},
"name": "<string>",
"alert": {
"different_rows_count": 1,
"different_rows_percent": 50,
"match_ratio_min": 0.5
},
"description": "<string>",
"enabled": True,
"owner": "<string>",
"schedule": {
"cron": "<string>",
"interval": { "hour": 11 },
"type": "none"
},
"slug": "<string>",
"tags": ["<string>"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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}}}
},
name: '<string>',
alert: {different_rows_count: 1, different_rows_percent: 50, match_ratio_min: 0.5},
description: '<string>',
enabled: true,
owner: '<string>',
schedule: {cron: '<string>', interval: {hour: 11}, type: 'none'},
slug: '<string>',
tags: ['<string>']
})
};
fetch('https://us.datafold.com/api/v1/monitors/create/diff', 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/create/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]
]
],
'name' => '<string>',
'alert' => [
'different_rows_count' => 1,
'different_rows_percent' => 50,
'match_ratio_min' => 0.5
],
'description' => '<string>',
'enabled' => true,
'owner' => '<string>',
'schedule' => [
'cron' => '<string>',
'interval' => [
'hour' => 11
],
'type' => 'none'
],
'slug' => '<string>',
'tags' => [
'<string>'
]
]),
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/create/diff"
payload := strings.NewReader("{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}")
req, _ := http.NewRequest("POST", 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.post("https://us.datafold.com/api/v1/monitors/create/diff")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.datafold.com/api/v1/monitors/create/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\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 \"name\": \"<string>\",\n \"alert\": {\n \"different_rows_count\": 1,\n \"different_rows_percent\": 50,\n \"match_ratio_min\": 0.5\n },\n \"description\": \"<string>\",\n \"enabled\": true,\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}"
response = http.request(request)
puts response.read_body{
"id": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}