Aviso de processamento do provedor de vídeo
curl --request POST \
--url https://api.weve.cx/webhooks/media/{token}import requests
url = "https://api.weve.cx/webhooks/media/{token}"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.weve.cx/webhooks/media/{token}', 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.weve.cx/webhooks/media/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.weve.cx/webhooks/media/{token}"
req, _ := http.NewRequest("POST", url, nil)
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.weve.cx/webhooks/media/{token}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/webhooks/media/{token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Conteúdo
Aviso do provedor de vídeo
A Bunny avisa quando termina de processar um vídeo. A rota é ANÔNIMA de
propósito — quem chama é uma máquina de terceiro, que não tem sessão — e
por isso não declara security; quem a protege é o segredo no caminho.
O corpo não é acreditado: a Bunny não o assina, então o aviso serve apenas como “vá olhar este vídeo”. O estado gravado vem da CONSULTA à API do provedor, o que torna inútil um aviso forjado.
Responde 202 sempre que o aviso for aceito, inclusive para vídeo que não é nosso: um provedor que recebe erro repetido desativa o webhook.
POST
/
webhooks
/
media
/
{token}
Aviso de processamento do provedor de vídeo
curl --request POST \
--url https://api.weve.cx/webhooks/media/{token}import requests
url = "https://api.weve.cx/webhooks/media/{token}"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.weve.cx/webhooks/media/{token}', 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.weve.cx/webhooks/media/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.weve.cx/webhooks/media/{token}"
req, _ := http.NewRequest("POST", url, nil)
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.weve.cx/webhooks/media/{token}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/webhooks/media/{token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Path Parameters
O segredo da rota, combinado no painel da Bunny.
Response
Aviso aceito