Data Rules
Preview a rule
Evaluates a condition against recent records and reports what would pass and what would fail, without saving anything. Use it to size an alert before committing to it.
A preview reports on the condition only. It does not compute the values a substitute rule’s method chain would produce.
POST
/
projects
/
{project_id}
/
rules
/
preview
Preview a rule
curl --request POST \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": {
"rule_text": "{{data-point.ambient-temperature-c}} < 0",
"target_type": "data_point"
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview"
payload = { "rule": {
"rule_text": "{{data-point.ambient-temperature-c}} < 0",
"target_type": "data_point"
} }
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({
rule: {
rule_text: '{{data-point.ambient-temperature-c}} < 0',
target_type: 'data_point'
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview', 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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview",
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([
'rule' => [
'rule_text' => '{{data-point.ambient-temperature-c}} < 0',
'target_type' => 'data_point'
]
]),
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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview"
payload := strings.NewReader("{\n \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview")
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 \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\n }\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"error": "<string>"
}{
"errors": [
{
"message": "A rule with the same expression already exists: 'Fill ambient temperature dropouts'",
"field": "rule_text",
"code": "duplicate_rule",
"duplicate_rule": {
"friendly_id": "rule_Qb3k9TzdL0pWnXyz",
"name": "Fill ambient temperature dropouts",
"effective_from": "2026-01-01",
"effective_to": null
}
}
],
"duplicate_rule": {
"friendly_id": "rule_Qb3k9TzdL0pWnXyz",
"name": "Fill ambient temperature dropouts",
"effective_from": "2026-01-01",
"effective_to": null
}
}⌘I
Preview a rule
curl --request POST \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": {
"rule_text": "{{data-point.ambient-temperature-c}} < 0",
"target_type": "data_point"
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview"
payload = { "rule": {
"rule_text": "{{data-point.ambient-temperature-c}} < 0",
"target_type": "data_point"
} }
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({
rule: {
rule_text: '{{data-point.ambient-temperature-c}} < 0',
target_type: 'data_point'
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview', 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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview",
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([
'rule' => [
'rule_text' => '{{data-point.ambient-temperature-c}} < 0',
'target_type' => 'data_point'
]
]),
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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview"
payload := strings.NewReader("{\n \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\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://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/rules/preview")
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 \"rule\": {\n \"rule_text\": \"{{data-point.ambient-temperature-c}} < 0\",\n \"target_type\": \"data_point\"\n }\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"error": "<string>"
}{
"errors": [
{
"message": "A rule with the same expression already exists: 'Fill ambient temperature dropouts'",
"field": "rule_text",
"code": "duplicate_rule",
"duplicate_rule": {
"friendly_id": "rule_Qb3k9TzdL0pWnXyz",
"name": "Fill ambient temperature dropouts",
"effective_from": "2026-01-01",
"effective_to": null
}
}
],
"duplicate_rule": {
"friendly_id": "rule_Qb3k9TzdL0pWnXyz",
"name": "Fill ambient temperature dropouts",
"effective_from": "2026-01-01",
"effective_to": null
}
}