Probar la entrega del webhook
curl --request GET \
--url https://api.benzinga.com/api/v1/webhook/test \
--header 'Key: <api-key>'import requests
url = "https://api.benzinga.com/api/v1/webhook/test"
headers = {"Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Key: '<api-key>'}};
fetch('https://api.benzinga.com/api/v1/webhook/test', 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.benzinga.com/api/v1/webhook/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.benzinga.com/api/v1/webhook/test"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.benzinga.com/api/v1/webhook/test")
.header("Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.benzinga.com/api/v1/webhook/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": "success"
}
{
"error": "Invalid destination URL"
}
{
"error": "Failed to deliver test payload to destination"
}
{
"ok": false,
"errors": [
{
"code": "auth_failed",
"id": "unauthorized",
"value": "Invalid or missing authentication token"
}
]
}
{
"ok": false,
"errors": [
{
"code": "no_data_found",
"id": "not_found",
"value": "No data found for the specified parameters"
}
]
}
{
"ok": false,
"errors": [
{
"code": "internal_server_error",
"id": "server_error",
"value": "An unexpected error occurred while processing your request"
}
]
}
Probar la entrega del webhook
Este endpoint enviará datos de prueba a tu webhook para que puedas verificar tu integración
GET
/
api
/
v1
/
webhook
/
test
Probar la entrega del webhook
curl --request GET \
--url https://api.benzinga.com/api/v1/webhook/test \
--header 'Key: <api-key>'import requests
url = "https://api.benzinga.com/api/v1/webhook/test"
headers = {"Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Key: '<api-key>'}};
fetch('https://api.benzinga.com/api/v1/webhook/test', 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.benzinga.com/api/v1/webhook/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.benzinga.com/api/v1/webhook/test"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.benzinga.com/api/v1/webhook/test")
.header("Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.benzinga.com/api/v1/webhook/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": "success"
}
{
"error": "Invalid destination URL"
}
{
"error": "Failed to deliver test payload to destination"
}
{
"ok": false,
"errors": [
{
"code": "auth_failed",
"id": "unauthorized",
"value": "Invalid or missing authentication token"
}
]
}
{
"ok": false,
"errors": [
{
"code": "no_data_found",
"id": "not_found",
"value": "No data found for the specified parameters"
}
]
}
{
"ok": false,
"errors": [
{
"code": "internal_server_error",
"id": "server_error",
"value": "An unexpected error occurred while processing your request"
}
]
}
Use este endpoint para activar el envío de un webhook de prueba a su endpoint configurado. Esto le permite verificar que su integración de webhook funciona correctamente antes de recibir datos de producción en tiempo real.
Cuando invoques este endpoint, Benzinga enviará una carga útil de webhook de prueba a la URL
destination que configuraste. Esta entrega de prueba utiliza el mismo formato y la misma lógica de reintentos que las entregas de webhooks en producción.
- Respuesta inmediata: La API devuelve un código de estado
200si la entrega de prueba se activó correctamente. - Carga útil de prueba: Tu endpoint de webhook recibe una carga útil de prueba en el mismo formato que los datos de producción.
- Encabezados de entrega: La entrega de prueba incluye el encabezado
X-BZ-Delivery, al igual que las entregas de producción.
- Que tu endpoint de webhook es accesible públicamente
- Que tu endpoint puede procesar correctamente el formato del payload del webhook
- Que tu endpoint responde con los códigos de estado adecuados (2xx para indicar éxito)
- Que tu endpoint responde dentro del límite de tiempo de 30 segundos
- Que tu lógica de idempotencia maneja correctamente el encabezado
X-BZ-Deliveryy el campoiddel payload
- Prueba primero con endpoints de webhook que no sean de producción
- Verifica que tu endpoint responda con códigos de estado
200o204 - Confirma que tu logging y monitoreo capturen la entrega de prueba
- Comprueba que tu lógica de deduplicación funcione con el ID de entrega de prueba
- Prueba escenarios de error devolviendo temporalmente códigos de estado de error
424, el sistema no pudo entregar el payload de prueba a tu endpoint de destino. Causas comunes:
- La URL de destino no es accesible públicamente
- El endpoint de destino está devolviendo códigos de estado de error
- Problemas de conectividad de red
- Errores de certificado SSL/TLS en el endpoint de destino
destinationdebe ser una URL HTTPS válidaversiondebe serwebhook/v1kinddebe ser uno de los tipos de evento admitidos (por ejemplo,News/v1,Earnings/v1,Ratings/v1, etc.)
{
"status": "success"
}
{
"error": "Invalid destination URL"
}
{
"error": "Failed to deliver test payload to destination"
}
{
"ok": false,
"errors": [
{
"code": "auth_failed",
"id": "unauthorized",
"value": "Invalid or missing authentication token"
}
]
}
{
"ok": false,
"errors": [
{
"code": "no_data_found",
"id": "not_found",
"value": "No data found for the specified parameters"
}
]
}
{
"ok": false,
"errors": [
{
"code": "internal_server_error",
"id": "server_error",
"value": "An unexpected error occurred while processing your request"
}
]
}
Query Parameters
Identifica el kind de mensaje para un payload de prueba
Available options:
News/v1, Signals/v1, Earnings/v1, Ratings/v1, Dividends/v1, IPOs/v1, Guidance/v1, Splits/v1, OptionActivity/v1, Conference/v1, Economics/v1, Offerings/v1, MA/v1, Retail/v1, FDA/v1, WIIMs/v1, SECInsiderTransaction/v1, GovernmentTrade/v1 Was this page helpful?