Registrar una decisión de respaldo
curl --request POST \
--url https://api.coupons.piixan.ai/v1/decisiones/respaldo \
--header 'Content-Type: application/json' \
--data '
{
"accion": 1,
"canal": "<string>",
"cliente_ref": "<string>",
"campana_id": "<string>"
}
'import requests
url = "https://api.coupons.piixan.ai/v1/decisiones/respaldo"
payload = {
"accion": 1,
"canal": "<string>",
"cliente_ref": "<string>",
"campana_id": "<string>"
}
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({accion: 1, canal: '<string>', cliente_ref: '<string>', campana_id: '<string>'})
};
fetch('https://api.coupons.piixan.ai/v1/decisiones/respaldo', 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://api.coupons.piixan.ai/v1/decisiones/respaldo",
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([
'accion' => 1,
'canal' => '<string>',
'cliente_ref' => '<string>',
'campana_id' => '<string>'
]),
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://api.coupons.piixan.ai/v1/decisiones/respaldo"
payload := strings.NewReader("{\n \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\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://api.coupons.piixan.ai/v1/decisiones/respaldo")
.header("Content-Type", "application/json")
.body("{\n \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coupons.piixan.ai/v1/decisiones/respaldo")
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 \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"codigo": "no_autenticado",
"mensaje": "token inválido o caducado"
}{
"codigo": "sin_permiso",
"mensaje": "la credencial no tiene el ámbito decisiones:pedir"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"codigo": "limite_excedido",
"mensaje": "límite de ritmo superado"
}decisiones
Registrar una decisión de respaldo
El SDK la envía cuando aplicó la regla del cliente porque el motor no respondió o estaba en pausa. Así el registro sigue completo (propensión 1).
POST
/
v1
/
decisiones
/
respaldo
Registrar una decisión de respaldo
curl --request POST \
--url https://api.coupons.piixan.ai/v1/decisiones/respaldo \
--header 'Content-Type: application/json' \
--data '
{
"accion": 1,
"canal": "<string>",
"cliente_ref": "<string>",
"campana_id": "<string>"
}
'import requests
url = "https://api.coupons.piixan.ai/v1/decisiones/respaldo"
payload = {
"accion": 1,
"canal": "<string>",
"cliente_ref": "<string>",
"campana_id": "<string>"
}
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({accion: 1, canal: '<string>', cliente_ref: '<string>', campana_id: '<string>'})
};
fetch('https://api.coupons.piixan.ai/v1/decisiones/respaldo', 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://api.coupons.piixan.ai/v1/decisiones/respaldo",
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([
'accion' => 1,
'canal' => '<string>',
'cliente_ref' => '<string>',
'campana_id' => '<string>'
]),
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://api.coupons.piixan.ai/v1/decisiones/respaldo"
payload := strings.NewReader("{\n \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\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://api.coupons.piixan.ai/v1/decisiones/respaldo")
.header("Content-Type", "application/json")
.body("{\n \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coupons.piixan.ai/v1/decisiones/respaldo")
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 \"accion\": 1,\n \"canal\": \"<string>\",\n \"cliente_ref\": \"<string>\",\n \"campana_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"codigo": "no_autenticado",
"mensaje": "token inválido o caducado"
}{
"codigo": "sin_permiso",
"mensaje": "la credencial no tiene el ámbito decisiones:pedir"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"codigo": "limite_excedido",
"mensaje": "límite de ritmo superado"
}Body
application/json
Cuerpo de POST /v1/decisiones/respaldo: el sistema aplicó su regla porque el
motor no respondió o estaba en pausa (§9.3). Se registra con propensión 1.
0 = nada; el resto, ids del catálogo
Required range:
x >= 0Required string length:
1 - 256Identificador seudonimizado del cliente (hash con sal del inquilino)
Required string length:
8 - 128Pattern:
^[A-Za-z0-9][A-Za-z0-9_.:\-]{0,127}$Required string length:
1 - 128Pattern:
^[A-Za-z0-9][A-Za-z0-9_.:\-]{0,127}$Response
Successful Response