Validar bloques de plantilla
curl --request POST \
--url https://reporter.sandbox.lerian.net/v1/templates/validate \
--header 'Content-Type: application/json' \
--data '
{
"blocks": [
{
"type": "loop",
"collection": "accounts",
"iterator": "account",
"children": [
{
"type": "field",
"field": "account.name"
}
]
}
]
}
'import requests
url = "https://reporter.sandbox.lerian.net/v1/templates/validate"
payload = { "blocks": [
{
"type": "loop",
"collection": "accounts",
"iterator": "account",
"children": [
{
"type": "field",
"field": "account.name"
}
]
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
blocks: [
{
type: 'loop',
collection: 'accounts',
iterator: 'account',
children: [{type: 'field', field: 'account.name'}]
}
]
})
};
fetch('https://reporter.sandbox.lerian.net/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_URL => "https://reporter.sandbox.lerian.net/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' => 'loop',
'collection' => 'accounts',
'iterator' => 'account',
'children' => [
[
'type' => 'field',
'field' => 'account.name'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://reporter.sandbox.lerian.net/v1/templates/validate"
payload := strings.NewReader("{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://reporter.sandbox.lerian.net/v1/templates/validate")
.header("Content-Type", "application/json")
.body("{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://reporter.sandbox.lerian.net/v1/templates/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"valid": false,
"errors": [
{
"blockId": "block-2",
"field": "collection",
"message": "collection is required for loop blocks"
}
]
}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.
POST
/
v1
/
templates
/
validate
Validar bloques de plantilla
curl --request POST \
--url https://reporter.sandbox.lerian.net/v1/templates/validate \
--header 'Content-Type: application/json' \
--data '
{
"blocks": [
{
"type": "loop",
"collection": "accounts",
"iterator": "account",
"children": [
{
"type": "field",
"field": "account.name"
}
]
}
]
}
'import requests
url = "https://reporter.sandbox.lerian.net/v1/templates/validate"
payload = { "blocks": [
{
"type": "loop",
"collection": "accounts",
"iterator": "account",
"children": [
{
"type": "field",
"field": "account.name"
}
]
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
blocks: [
{
type: 'loop',
collection: 'accounts',
iterator: 'account',
children: [{type: 'field', field: 'account.name'}]
}
]
})
};
fetch('https://reporter.sandbox.lerian.net/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_URL => "https://reporter.sandbox.lerian.net/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' => 'loop',
'collection' => 'accounts',
'iterator' => 'account',
'children' => [
[
'type' => 'field',
'field' => 'account.name'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://reporter.sandbox.lerian.net/v1/templates/validate"
payload := strings.NewReader("{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://reporter.sandbox.lerian.net/v1/templates/validate")
.header("Content-Type", "application/json")
.body("{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://reporter.sandbox.lerian.net/v1/templates/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"blocks\": [\n {\n \"type\": \"loop\",\n \"collection\": \"accounts\",\n \"iterator\": \"account\",\n \"children\": [\n {\n \"type\": \"field\",\n \"field\": \"account.name\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"valid": false,
"errors": [
{
"blockId": "block-2",
"field": "collection",
"message": "collection is required for loop blocks"
}
]
}Encabezados
El identificador único de la Organización asociada a la solicitud.
Cuerpo
application/json
Los bloques de plantilla que se van a validar.
¿Esta página le ayudó?
⌘I

