Publicar eventos
curl --request POST \
--url https://api.coupons.piixan.ai/v1/eventos \
--header 'Content-Type: application/json' \
--data '
{
"eventos": [
{}
]
}
'import requests
url = "https://api.coupons.piixan.ai/v1/eventos"
payload = { "eventos": [{}] }
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({eventos: [{}]})
};
fetch('https://api.coupons.piixan.ai/v1/eventos', 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/eventos",
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([
'eventos' => [
[
]
]
]),
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/eventos"
payload := strings.NewReader("{\n \"eventos\": [\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://api.coupons.piixan.ai/v1/eventos")
.header("Content-Type", "application/json")
.body("{\n \"eventos\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coupons.piixan.ai/v1/eventos")
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 \"eventos\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"aceptados": "<unknown>",
"duplicados": "<unknown>",
"rechazados": "<unknown>"
}{
"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"
}eventos
Publicar eventos
Hasta 1.000 eventos y 1 MB por lote. Idempotente por event_id: reenviar un
lote no duplica nada. La respuesta dice cuántos se aceptaron, cuántos eran
duplicados y cuáles se rechazaron, con posición, campo y motivo.
POST
/
v1
/
eventos
Publicar eventos
curl --request POST \
--url https://api.coupons.piixan.ai/v1/eventos \
--header 'Content-Type: application/json' \
--data '
{
"eventos": [
{}
]
}
'import requests
url = "https://api.coupons.piixan.ai/v1/eventos"
payload = { "eventos": [{}] }
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({eventos: [{}]})
};
fetch('https://api.coupons.piixan.ai/v1/eventos', 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/eventos",
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([
'eventos' => [
[
]
]
]),
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/eventos"
payload := strings.NewReader("{\n \"eventos\": [\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://api.coupons.piixan.ai/v1/eventos")
.header("Content-Type", "application/json")
.body("{\n \"eventos\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coupons.piixan.ai/v1/eventos")
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 \"eventos\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"aceptados": "<unknown>",
"duplicados": "<unknown>",
"rechazados": "<unknown>"
}{
"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
El sobre de POST /v1/eventos. Cada evento se valida por separado: los que
fallan vuelven en rechazados con su posición, y los demás se guardan.
Required array length:
1 - 1000 elements