POST Validate a template without changing resources
/api/v1/templates/validate
Validates syntax, version, configuration and alarm choices without reserving resources. Ownership and capacity checks belong to plan and apply.
On this page
Access and permissions
Validates syntax, version, configuration and alarm choices without reserving resources. Ownership and capacity checks belong to plan and apply.
Browser session: __Host-mb_session cookie.
Machine management credentials in Authorization: Bearer. Check the permissions (scopes) required by the operation.
Parameters and headers
No path, query or additional request-header parameters.
Request body
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | TemplateRequest | Yes | — |
| $.activate_alarms | array<TemplateAlarmActivation>; {"maxItems":200} | No | Optional; only explicitly selected suggestions with complete conditions are created atomically. The run suggestion jointly monitors failed, cancelled, overdue and missing runs. |
| $.activate_alarms[] | TemplateAlarmActivation | Yes | — |
| $.activate_alarms[].clear | AlarmCondition | No | — |
| $.activate_alarms[].clear.operator | string; {"enum":["gt","lt","eq","ne","outside","inside"]} | Yes | — |
| $.activate_alarms[].clear.value | number | Yes | — |
| $.activate_alarms[].clear.value_high | number | No | Required for inside and outside; must be greater than value |
| $.activate_alarms[].clear (allOf 1) | JSON | No | — |
| $.activate_alarms[].clear_duration_seconds | integer; {"maximum":86400,"minimum":0} | No | — |
| $.activate_alarms[].kind | string; {"enum":["numeric","state","no_data","heartbeat","run"]} | Yes | Must match exactly one suggestion of the selected template version. |
| $.activate_alarms[].name | string; {"maxLength":128,"minLength":1} | Yes | Human-readable resource name. Follow the listed length limit. |
| $.activate_alarms[].no_data_seconds | integer; {"maximum":604800,"minimum":30} | No | — |
| $.activate_alarms[].severity | string; {"enum":["info","warning","critical"]} | Yes | Severity value from the listed vocabulary. |
| $.activate_alarms[].state_clear_samples | integer; {"default":2,"maximum":2,"minimum":1} | No | Number of distinct valid consecutive checks required for this state transition. |
| $.activate_alarms[].state_trigger_samples | integer; {"default":2,"maximum":2,"minimum":1} | No | Number of distinct valid consecutive checks required for this state transition. |
| $.activate_alarms[].suggestion_id | string; {"maxLength":256} | Yes | Stable suggestion ID from the current template or server profile; distinct rules may share the same kind. |
| $.activate_alarms[].target_state | string; {"maxLength":128} | No | — |
| $.activate_alarms[].trigger | AlarmCondition | No | — |
| $.activate_alarms[].trigger.operator | string; {"enum":["gt","lt","eq","ne","outside","inside"]} | Yes | — |
| $.activate_alarms[].trigger.value | number | Yes | — |
| $.activate_alarms[].trigger.value_high | number | No | Required for inside and outside; must be greater than value |
| $.activate_alarms[].trigger (allOf 1) | JSON | No | — |
| $.activate_alarms[].trigger_duration_seconds | integer; {"maximum":86400,"minimum":0} | No | — |
| $.config | object | No | For website_api, url and one to five authorized location_ids are required; for backup_cron, cron and timezone are required. HTTP configuration follows HTTPMonitorConfig. |
| $.external_id | string; {"maxLength":128,"minLength":1} | Yes | Stable client identifier for idempotent retries; changes to the original request return 409. |
| $.name | string; {"maxLength":128,"minLength":1} | Yes | Human-readable resource name. Follow the listed length limit. |
| $.paused | boolean; {"default":false} | No | Whether automatic monitor work is paused. Existing telemetry and historical data remain. |
| $.server_profile | ServerProfileRequest | No | — |
| $.server_profile.components | array<object>; {"maxItems":200} | null | No | Discovered or explicitly selected server components. |
| $.server_profile.components (anyOf 1) | array<object>; {"maxItems":200} | No | — |
| $.server_profile.components (anyOf 1)[] | object | Yes | — |
| $.server_profile.components (anyOf 1)[].address | string | No | — |
| $.server_profile.components (anyOf 1)[].family | string | No | — |
| $.server_profile.components (anyOf 1)[].id | string | Yes | UUID of this resource. Keep the returned identifier for subsequent operations. |
| $.server_profile.components (anyOf 1)[].kind | string | Yes | Resource kind or measurement type selected from the listed values. |
| $.server_profile.components (anyOf 1)[].label | string; {"maxLength":128,"minLength":1} | Yes | Display name for the component. |
| $.server_profile.components (anyOf 1)[].local_ref | string | No | — |
| $.server_profile.components (anyOf 1)[].name | string | No | Human-readable resource name. Follow the listed length limit. |
| $.server_profile.components (anyOf 1)[].path | string; {"maxLength":1024} | No | — |
| $.server_profile.components (anyOf 1)[].port | integer | No | — |
| $.server_profile.components (anyOf 1)[].project | string | No | — |
| $.server_profile.components (anyOf 1)[].protocol | string | No | — |
| $.server_profile.components (anyOf 1)[].text_languages | object | No | — |
| $.server_profile.components (anyOf 1)[].timeout_seconds | integer | No | — |
| $.server_profile.components (anyOf 1)[].translations | object; {"additionalProperties":false} | No | — |
| $.server_profile.components (anyOf 1)[].translations.de | object | No | — |
| $.server_profile.components (anyOf 1)[].translations.en | object | No | — |
| $.server_profile.components (anyOf 1)[].transport | string | No | — |
| $.server_profile.components (anyOf 1)[].filesystem_identity | string; {"maxLength":256} | No | Agent-reported volume identity. Keep it unchanged to prevent a replacement volume from continuing another volume’s history. |
| $.server_profile.components (anyOf 1)[].disk_identity | string; {"maxLength":256} | No | — |
| $.server_profile.components (anyOf 2) | null | No | — |
| $.server_profile.selections | array<object>; {"maxItems":200} | null | No | Selected component/parameter pairs and sampling intervals. |
| $.server_profile.selections (anyOf 1) | array<object>; {"maxItems":200} | No | — |
| $.server_profile.selections (anyOf 1)[] | object | Yes | — |
| $.server_profile.selections (anyOf 1)[].component_id | string | Yes | Stable identifier of the selected or discovered component. |
| $.server_profile.selections (anyOf 1)[].interval_seconds | integer; {"maximum":86400,"minimum":0} | No | Sampling or check interval in seconds within the stated bounds. |
| $.server_profile.selections (anyOf 1)[].parameter_key | string | Yes | Stable parameter identifier from the server catalog. |
| $.server_profile.selections (anyOf 2) | null | No | — |
| $.server_profile.version | JSON; {"const":2} | Yes | — |
| $.server_profile.overview | object; {"additionalProperties":false} | No | Explicit targets for the six-chart server overview; select all required readings. |
| $.server_profile.overview.system_id | string; {"maxLength":128} | Yes | — |
| $.server_profile.overview.filesystem_id | string; {"maxLength":128} | Yes | — |
| $.server_profile.overview.disk_id | string; {"maxLength":128} | Yes | — |
| $.server_profile.overview.network_id | string; {"maxLength":128} | Yes | — |
| $.server_profile.filesystem_discovery | object; {"additionalProperties":false} | No | Optional local filesystem discovery with a base interval of at least 10 seconds. New Server/NAS setups enable it. Existing profiles require explicit activation. Manually disabled measurements are preserved. |
| $.server_profile.filesystem_discovery.mode | string; {"enum":["off","local"]} | Yes | — |
| $.server_profile.filesystem_discovery.interval_seconds | integer; {"minimum":10,"maximum":86400} | Yes | — |
| $.server_profile.system_discovery | object; {"additionalProperties":false} | No | — |
| $.server_profile.system_discovery.mode | string; {"enum":["off","local"]} | Yes | — |
| $.server_profile.system_discovery.interval_seconds | integer; {"minimum":10,"maximum":86400} | Yes | — |
| $.server_profile.global_interval_seconds | integer; {"minimum":1,"maximum":86400} | No | Explicit global sampling choice. Each source still applies its platform minimum; individual fast rows never imply this choice. |
| $.template_id | string; {"enum":["server_nas","website_api","backup_cron","workflow_agent","sensor_energy","application_kpi","custom_data","tcp_port","udp_reply","dns_records","tls_certificate","host_ping","service_health","browser_journey"]} | Yes | — |
| $.version | integer; {"enum":[1,2]} | Yes | Server/NAS uses version 2; all other templates use version 1. |
| $.workspace_id | string; {"format":"uuid"} | Yes | UUID of the owning workspace. Access is checked against the authenticated account. |
| $ (allOf 1) | JSON | No | — |
| $ (allOf 2) | JSON | No | — |
Responses
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | object | Yes | — |
| $.alarm_suggestions | array<object> | Yes | — |
| $.alarm_suggestions[] | object | Yes | — |
| $.alarm_suggestions[].kind | string | Yes | Resource kind or measurement type selected from the listed values. |
| $.alarm_suggestions[].series_key | string | No | — |
| $.alarm_suggestions[].summary | string | Yes | — |
| $.alarm_suggestions[].summary_key | string | Yes | — |
| $.config | MonitorConfig | Yes | — |
| $.config (anyOf 1) | HTTPMonitorConfig | No | The type feature is available only when enabled. Credential headers are not accepted through this path. |
| $.config (anyOf 1).expected_status | JSON; {"const":0} | JSON; {"minimum":100,"maximum":599} | No | — |
| $.config (anyOf 1).expected_status (anyOf 1) | JSON; {"const":0} | No | — |
| $.config (anyOf 1).expected_status (anyOf 2) | JSON; {"minimum":100,"maximum":599} | No | — |
| $.config (anyOf 1).expected_text | string; {"maxLength":256} | No | — |
| $.config (anyOf 1).interval_seconds | integer; {"default":300,"maximum":86400,"minimum":10} | No | Sampling or check interval in seconds within the stated bounds. |
| $.config (anyOf 1).json_field | string; {"maxLength":64} | No | A top-level JSON field; alternative to expected_text. |
| $.config (anyOf 1).json_value | string; {"maxLength":256} | No | — |
| $.config (anyOf 1).method | string; {"default":"GET","enum":["GET","HEAD","OPTIONS","POST","PUT","PATCH","DELETE"]} | No | — |
| $.config (anyOf 1).url | string; {"format":"uri","maxLength":2048} | Yes | HTTP/HTTPS, ports 80/443 only; DNS and destination IP are checked on every attempt. |
| $.config (anyOf 1).location_ids | array<string; {"format":"uuid"}>; {"maxItems":4096,"minItems":1} | Yes | — |
| $.config (anyOf 1).location_ids[] | string; {"format":"uuid"} | Yes | — |
| $.config (anyOf 1).policy | JSON; {"enum":["any","all","quorum"],"default":"quorum"} | No | Defaults to quorum with two distinct locations. Select at least two compatible locations. Explicit any/all policies remain available; two failed confirmations per location are required by default. For Ping quorum checks with N locations and failure quorum Q, N−Q+1 freshly confirmed healthy locations establish availability; Q confirmed failed locations establish an outage. Other results remain unconfirmed or unknown. Ambiguous Ping results can trigger a fast follow-up at the same location, limited to two per monitor and one per location per minute, within the existing check budget. Manual tests never affect availability. Earlier coverage gaps remain unchanged. |
| $.config (anyOf 1).quorum | integer; {"maximum":4096,"minimum":1,"default":2} | No | — |
| $.config (anyOf 1).confirm_failures | integer; {"maximum":10,"minimum":1} | No | — |
| $.config (anyOf 1).confirm_successes | integer; {"maximum":10,"minimum":1} | No | — |
| $.config (anyOf 1).family | string; {"enum":["ipv4","ipv6","dual"],"default":"dual"} | No | — |
| $.config (anyOf 1).timeout_seconds | integer; {"minimum":1,"maximum":30,"default":8} | No | — |
| $.config (anyOf 1).expected_status_min | integer; {"minimum":100,"maximum":599} | No | — |
| $.config (anyOf 1).expected_status_max | integer; {"minimum":100,"maximum":599} | No | — |
| $.config (anyOf 1).follow_redirects | boolean; {"default":true} | No | — |
| $.config (anyOf 1).content_as_down | boolean | No | — |
| $.config (anyOf 1).actions_confirmed | boolean | No | — |
| $.config (anyOf 1).request_body_present | boolean | No | — |
| $.config (anyOf 2) | JobMonitorConfig | No | Choose a fixed UTC interval or a five-field cron expression with an IANA time zone. Use signal=heartbeat for simple accepted heartbeats, or signal=run for execution events. Without a schedule, runs are event-driven. Pause and configuration changes reset future expectations. |
| $.config (anyOf 2).cron | string | No | Five cron fields with lists, ranges, steps and supported month/weekday names. |
| $.config (anyOf 2).max_runtime_seconds | integer; {"maximum":604800,"minimum":60} | No | Optional; no runtime limit when omitted |
| $.config (anyOf 2).timezone | string | No | IANA time zone; required with cron |
| $.config (anyOf 2).tolerance_seconds | integer; {"maximum":86400,"minimum":5} | No | Allowed delay in seconds. Cron requires at least 30 seconds; fixed intervals allow at least five. Default: 300, or half the interval for intervals shorter than 600 seconds. |
| $.config (anyOf 2).interval_seconds | integer; {"minimum":30,"maximum":604800} | No | Fixed interval in seconds (30 to 604800), independent of daylight saving. Cannot be combined with cron or timezone. |
| $.config (anyOf 2).signal | string; {"enum":["run","heartbeat"],"default":"run"} | No | run expects start and completion events with stable run IDs. heartbeat accepts a bodyless request to its individual secret URL or the authenticated telemetry endpoint; it does not verify job completion. |
| $.config (anyOf 2) (allOf 1) | JSON | No | — |
| $.config (anyOf 2) (allOf 2) | JSON | No | — |
| $.config (anyOf 2) (allOf 3) | JSON | No | — |
| $.config (anyOf 2) (allOf 4) | JSON | No | — |
| $.config (anyOf 2) (allOf 5) | JSON | No | — |
| $.config (anyOf 3) | object | No | — |
| $.monitor_type | string | Yes | — |
| $.required_alarms | integer | Yes | — |
| $.required_monitors | integer | Yes | — |
| $.required_series | integer | Yes | — |
| $.template_id | string | Yes | — |
| $.version | integer | Yes | — |
{
"alarm_suggestions": [],
"config": {
"url": "https://example.com/callback",
"location_ids": [
"00000000-0000-4000-8000-000000000001"
],
"family": "dual",
"policy": "any",
"confirm_failures": 2,
"confirm_successes": 2,
"timeout_seconds": 8
},
"monitor_type": "demo",
"required_alarms": 0,
"required_monitors": 0,
"required_series": 0,
"template_id": "demo",
"version": 0
}| Stable error codes |
|---|
| invalid_credential |
| unauthorized |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 401,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| csrf |
| insufficient_scope |
| invalid_origin |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 403,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| invalid_payload |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 422,
"title": "Demo error",
"type": "about:blank"
}Retries and asynchronous work
This operation reads or validates without applying a resource mutation. Respect rate limits and credential lifetime.
Request examples
Replace demo IDs, timestamps and placeholders with your own values. For a retry, keep the same IDs, time and content. These examples do not run requests on this page.
Keep login links, codes, cookies and keys private. Do not print them in logs or share them in support requests.
curl --silent --show-error --output /dev/null --write-out "%{http_code}\n" \
--request POST \
--header @"$HOME/.config/metribeacon/headers.txt" \
--header "Content-Type: application/json" \
--data-binary '{"external_id":"demo","name":"demo","template_id":"server_nas","version":2,"workspace_id":"00000000-0000-4000-8000-000000000001"}' \
"https://metribeacon.com/api/v1/templates/validate"
import json
from pathlib import Path
from urllib.request import Request, HTTPRedirectHandler, build_opener
from urllib.error import HTTPError
headers = json.loads((Path.home() / ".config/metribeacon/headers.json").read_text())
headers["Content-Type"] = "application/json"
request = Request("https://metribeacon.com/api/v1/templates/validate", data="{\"external_id\":\"demo\",\"name\":\"demo\",\"template_id\":\"server_nas\",\"version\":1,\"workspace_id\":\"00000000-0000-4000-8000-000000000001\"}".encode("utf-8"), headers=headers, method="POST")
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, request, fp, code, message, headers, target):
return None
opener = build_opener(NoRedirect())
try:
with opener.open(request, timeout=10) as response:
print(response.status)
except HTTPError as error:
print(error.code)
error.close()
import { readFile } from "node:fs/promises";
import { homedir } from "node:os";
import { join } from "node:path";
const headers = JSON.parse(await readFile(join(homedir(), ".config/metribeacon/headers.json"), "utf8"));
headers["Content-Type"] = "application/json";
const response = await fetch("https://metribeacon.com/api/v1/templates/validate", {
method: "POST", headers, redirect: "manual",
signal: AbortSignal.timeout(10000), body: "{\"external_id\":\"demo\",\"name\":\"demo\",\"template_id\":\"server_nas\",\"version\":1,\"workspace_id\":\"00000000-0000-4000-8000-000000000001\"}",
});
console.log(response.status);
await response.body?.cancel();
package main
import (
"fmt"
"net/http"
"time"
"encoding/json"
"os"
"path/filepath"
"strings"
)
func main() {
home, err := os.UserHomeDir(); if err != nil { panic("request failed; credentials and response omitted") }
raw, err := os.ReadFile(filepath.Join(home, ".config/metribeacon/headers.json")); if err != nil { panic("request failed; credentials and response omitted") }
var headers map[string]string
if json.Unmarshal(raw, &headers) != nil { panic("invalid local headers") }
request, err := http.NewRequest("POST", "https://metribeacon.com/api/v1/templates/validate", strings.NewReader("{\"external_id\":\"demo\",\"name\":\"demo\",\"template_id\":\"server_nas\",\"version\":1,\"workspace_id\":\"00000000-0000-4000-8000-000000000001\"}"))
if err != nil { panic("request failed; credentials and response omitted") }
for name, value := range headers { request.Header.Set(name, value) }
request.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 10*time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
response, err := client.Do(request)
if err != nil { panic("request failed; credentials and response omitted") }
defer response.Body.Close()
fmt.Println(response.StatusCode)
}
Related guides
- HTTP API, OAuth and MCP
Find the user API endpoints, their permissions, fields, examples and response formats.
- GET Read the versioned template catalog
Suggestions do not activate alarms automatically. Applying HTTP and run templates also requires the corresponding feature flags.
- POST Apply a template atomically in your workspace
Atomically applies a template within account limits. Server/NAS v2 reserves the monitor, series and selected alarm slots and returns a resumable job; other templates are applied immediately. Repeated normalized requests replay the existing monitor.
- POST Check template capacity without reserving it
Preview the resources and capacity needed by a template without creating them. A preview does not reserve slots; apply checks the available capacity again.