Saltar al contenido principal
POST
/
webhooks
Registrar una suscripción de webhook
curl --request POST \
  --url https://slc.sandbox.lerian.net/webhooks \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "events": [
    "<string>"
  ],
  "url": "<string>",
  "active": true,
  "description": "<string>",
  "headers": {},
  "secret": "<string>",
  "timeoutSeconds": 2
}
'
import requests

url = "https://slc.sandbox.lerian.net/webhooks"

payload = {
"events": ["<string>"],
"url": "<string>",
"active": True,
"description": "<string>",
"headers": {},
"secret": "<string>",
"timeoutSeconds": 2
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: ['<string>'],
url: '<string>',
active: true,
description: '<string>',
headers: {},
secret: '<string>',
timeoutSeconds: 2
})
};

fetch('https://slc.sandbox.lerian.net/webhooks', 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://slc.sandbox.lerian.net/webhooks",
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([
'events' => [
'<string>'
],
'url' => '<string>',
'active' => true,
'description' => '<string>',
'headers' => [

],
'secret' => '<string>',
'timeoutSeconds' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://slc.sandbox.lerian.net/webhooks"

payload := strings.NewReader("{\n \"events\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"active\": true,\n \"description\": \"<string>\",\n \"headers\": {},\n \"secret\": \"<string>\",\n \"timeoutSeconds\": 2\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<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://slc.sandbox.lerian.net/webhooks")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"active\": true,\n \"description\": \"<string>\",\n \"headers\": {},\n \"secret\": \"<string>\",\n \"timeoutSeconds\": 2\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://slc.sandbox.lerian.net/webhooks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n \"<string>\"\n ],\n \"url\": \"<string>\",\n \"active\": true,\n \"description\": \"<string>\",\n \"headers\": {},\n \"secret\": \"<string>\",\n \"timeoutSeconds\": 2\n}"

response = http.request(request)
puts response.read_body
{
  "active": true,
  "createdAt": "<string>",
  "description": "<string>",
  "events": [
    "<string>"
  ],
  "failureCount": 123,
  "id": "<string>",
  "lastDeliveryAt": "<string>",
  "lastDeliveryStatus": 123,
  "successCount": 123,
  "updatedAt": "<string>",
  "url": "<string>"
}
{
"code": "<string>",
"details": {},
"message": "<string>",
"title": "<string>"
}
{
"code": "<string>",
"details": {},
"message": "<string>",
"title": "<string>"
}
{
"code": "<string>",
"details": {},
"message": "<string>",
"title": "<string>"
}
{
"code": "<string>",
"details": {},
"message": "<string>",
"title": "<string>"
}
{
"code": "<string>",
"details": {},
"message": "<string>",
"title": "<string>"
}

Autorizaciones

Authorization
string
header
requerido

Bearer token authentication (format: "Bearer {token}")

Cuerpo

application/json

Webhook subscription to create

events
string[]
requerido
url
string
requerido
active
boolean
description
string
headers
object
secret
string
timeoutSeconds
integer
Rango requerido: x >= 1

Respuesta

Created

active
boolean
createdAt
string
description
string
events
string[]
failureCount
integer
id
string
lastDeliveryAt
string
lastDeliveryStatus
integer
successCount
integer
updatedAt
string
url
string