Subir JSON del Flow
Sube el Flow JSON de un Flow que sigue en DRAFT.
Meta responde 200 con sus rechazos listados dentro del cuerpo; este endpoint no. POST /flows/{id}/assets devuelve HTTP 200 con validation_errors cuando rechaza el documento, y un cliente que solo lee el status concluye que la subida fue aceptada: el editor muestra “guardado”, el Flow conserva el JSON ANTERIOR, y la divergencia aparece cuando un cliente abre el formulario viejo en producción. Por eso este handler ignora el status del Graph y lee la lista: una lista no vacía es 422 FLOW_JSON_INVALID con validationErrors adjunto. Un 200 nuestro siempre trae validationErrors: [], y el campo se emite explícitamente en caso de éxito para que el cliente que decide por el status y el que decide por la lista lleguen a la misma conclusión.
flowJson es un string, nunca un objeto anidado: Meta compila los bytes exactos, y volver a serializar movería las posiciones a las que apuntan sus errores. La lista se devuelve tal cual, sin traducir: su forma es la de Meta. El cuerpo solo acepta flowJson. Permiso flows:manage.
Requiere una clave con alcance de número. Una clave con alcance de tenant debe indicar el número con el header x-whatsapp-number-id, o recibe 403 TENANT_SCOPE_NOT_ALLOWED.
curl --request POST \
--url https://pilotstatus.com.br/v1/flows/{id}/json \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"flowJson": "{\"version\":\"7.1\",\"screens\":[]}"
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/json"
payload = { "flowJson": "{\"version\":\"7.1\",\"screens\":[]}" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({flowJson: '{"version":"7.1","screens":[]}'})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}/json', 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://pilotstatus.com.br/v1/flows/{id}/json",
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([
'flowJson' => '{"version":"7.1","screens":[]}'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/flows/{id}/json"
payload := strings.NewReader("{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://pilotstatus.com.br/v1/flows/{id}/json")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}"
response = http.request(request)
puts response.read_bodyParámetros de ruta
Cuerpo
Respuesta
Aceptado. validationErrors siempre está presente y siempre vacío aquí
¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/flows/{id}/json \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"flowJson": "{\"version\":\"7.1\",\"screens\":[]}"
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/json"
payload = { "flowJson": "{\"version\":\"7.1\",\"screens\":[]}" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({flowJson: '{"version":"7.1","screens":[]}'})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}/json', 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://pilotstatus.com.br/v1/flows/{id}/json",
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([
'flowJson' => '{"version":"7.1","screens":[]}'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/flows/{id}/json"
payload := strings.NewReader("{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://pilotstatus.com.br/v1/flows/{id}/json")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flowJson\": \"{\\\"version\\\":\\\"7.1\\\",\\\"screens\\\":[]}\"\n}"
response = http.request(request)
puts response.read_body