Skip to content

Establecer webhook

POST
/api/user/set-webhook

Establece un webhook para recibir notificaciones de actualizaciones de precios.

El token_secret es una clave secreta que se utilizará para verificar la autenticidad de las solicitudes entrantes. Y sera enviado en el header Authorization como Bearer <token_secret>.

Autorizaciones

Cuerpo de la petición

JSON
{
"url": "string",
"certificate_ssl": true,
"token_secret": "string",
"monitors": [
{
"page": "string",
"currency": "string",
"monitor": "string"
}
]
}

Respuestas

Webhook establecido correctamente.
JSON
{
"message": "string"
}

Ejemplos

cURL
curl -X POST \
'https://pydolarve.org/api/user/set-webhook' \
 -H "Content-Type: application/json" \
 --data '{
  "url": "string",
  "certificate_ssl": true,
  "token_secret": "string",
  "monitors": [
    {
      "page": "string",
      "currency": "string",
      "monitor": "string"
    }
  ]
}'
JavaScript
fetch('https://pydolarve.org/api/user/set-webhook', {method:'POST',headers:{'Content-Type':'application/json'},body:'{"url":"string","certificate_ssl":true,"token_secret":"string","monitors":[{"page":"string","currency":"string","monitor":"string"}]}'})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://pydolarve.org/api/user/set-webhook';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];
$body = json_encode({"url":"string","certificate_ssl":true,"token_secret":"string","monitors":[{"page":"string","currency":"string","monitor":"string"}]});

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://pydolarve.org/api/user/set-webhook'

headers = {
    'Content-Type': 'application/json'
}
data = {
    'url': 'string',
    'certificate_ssl': true,
    'token_secret': 'string',
    'monitors': [
        {
            'page': 'string',
            'currency': 'string',
            'monitor': 'string'
        }
    ]
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
Powered by VitePress OpenAPI