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"
}
]
}
API de Webhooks
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 esté funcionando correctamente antes de recibir datos de producción en tiempo real.
Cuando invoques este endpoint, Benzinga enviará un payload de webhook de prueba a la URL de
destination que hayas configurado. Esta entrega de prueba sigue 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. - Payload de prueba: Tu endpoint de webhook recibe un payload de prueba con el mismo formato que los datos de producción.
- Encabezados de entrega: La entrega de prueba incluye el encabezado
X-BZ-Delivery, igual que las entregas de producción.
- Que tu endpoint de webhook sea públicamente accesible
- Que tu endpoint pueda analizar correctamente el formato del payload del webhook
- Que tu endpoint responda con los códigos de estado apropiados (2xx para una respuesta satisfactoria)
- Que tu endpoint responda dentro del tiempo de espera de 30 segundos
- Que tu lógica de idempotencia maneje 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 los códigos de estado
200o204 - Confirma que tu registro y monitoreo capturen la entrega de prueba
- Comprueba que tu lógica de desduplicació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 la carga de prueba a tu endpoint de destino. Causas habituales:
- 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 serNews/v1
{
"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"
}
]
}
Parámetros de consulta
Identifica el kind de mensaje para un payload de prueba
Opciones disponibles:
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 ¿Esta página le ayudó?