curl --request POST \
--url http://localhost:4005/v1/templates/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"blocks": [
{
"type": "variable",
"variable": "account.id"
}
]
}
'import requests
url = "http://localhost:4005/v1/templates/validate"
payload = { "blocks": [
{
"type": "variable",
"variable": "account.id"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({blocks: [{type: 'variable', variable: 'account.id'}]})
};
fetch('http://localhost:4005/v1/templates/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4005",
CURLOPT_URL => "http://localhost:4005/v1/templates/validate",
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([
'blocks' => [
[
'type' => 'variable',
'variable' => 'account.id'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:4005/v1/templates/validate"
payload := strings.NewReader("{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:4005/v1/templates/validate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:4005/v1/templates/validate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"blockId": "customer-name",
"field": "variable",
"message": "variable must not be empty"
}
],
"valid": false
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Validar bloques de plantilla
Utiliza este endpoint para validar una secuencia de bloques de plantilla antes de guardar una plantilla.
Los problemas de validación se devuelven en la respuesta 200 con valid en false y una lista de mensajes por bloque. El código HTTP 400 se reserva para un cuerpo de solicitud mal formado.
curl --request POST \
--url http://localhost:4005/v1/templates/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"blocks": [
{
"type": "variable",
"variable": "account.id"
}
]
}
'import requests
url = "http://localhost:4005/v1/templates/validate"
payload = { "blocks": [
{
"type": "variable",
"variable": "account.id"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({blocks: [{type: 'variable', variable: 'account.id'}]})
};
fetch('http://localhost:4005/v1/templates/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4005",
CURLOPT_URL => "http://localhost:4005/v1/templates/validate",
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([
'blocks' => [
[
'type' => 'variable',
'variable' => 'account.id'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:4005/v1/templates/validate"
payload := strings.NewReader("{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:4005/v1/templates/validate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:4005/v1/templates/validate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"blocks\": [\n {\n \"type\": \"variable\",\n \"variable\": \"account.id\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"blockId": "customer-name",
"field": "variable",
"message": "variable must not be empty"
}
],
"valid": false
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}{
"code": "ERR-0001",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "body.templateId",
"message": "expected string to match 'uuid' format",
"value": "not-a-uuid"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Autorizaciones
Autenticación mediante token Bearer. Formato: 'Bearer {access_token}'. Solo es obligatoria cuando el plugin de autenticación está habilitado.
Cuerpo
Bloques de la plantilla que se deben validar.
Bloques del constructor de plantillas que se deben validar.
Show child attributes
Show child attributes
[
{
"type": "variable",
"variable": "account.id"
}
]
Respuesta
Correcto
Fallos de validación semántica, en el orden de recorrido de los bloques.
Show child attributes
Show child attributes
[
{
"blockId": "customer-name",
"field": "variable",
"message": "variable must not be empty"
}
]
Indica si todos los bloques proporcionados son semánticamente válidos.
false
¿Esta página le ayudó?

