/webhooks
Retrieve a list of all webhooks configured for the current workspace.
events
string
The webhook event that you wish to filter on.
currentPage
int
Choose the number of search results to return per page. Minimum value: 1
pageSize
int
Results per page. Allowed values 1-100, default is 25.
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/WebhooksApi.md#list
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
req := apivideosdk.WebhooksApiListRequest{}
req.Events("video.encoding.quality.completed") // string | The webhook event that you wish to filter on.
req.CurrentPage(int32(2)) // int32 | Choose the number of search results to return per page. Minimum value: 1 (default to 1)
req.PageSize(int32(30)) // int32 | Results per page. Allowed values 1-100, default is 25. (default to 25)
res, err := client.Webhooks.List(req)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Webhooks.List``: %v\
", err)
}
// response from `List`: WebhooksListResponse
fmt.Fprintf(os.Stdout, "Response from `Webhooks.List`: %v\
", res)
}
Success
{
"data": [
{
"webhookId": "webhook_XXXXXXXXXXXXXXX",
"createdAt": "2021-01-08T14:12:18+00:00",
"events": [
"video.encoding.quality.completed"
],
"url": "http://clientnotificationserver.com/notif?myquery=query",
"signatureSecret": "sig_sec_Abcd12348RLP7VPLi7nYVh"
},
{
"webhookId": "webhook_XXXXXXXXXYYYYYY",
"createdAt": "2021-01-12T12:12:12+00:00",
"events": [
"video.encoding.quality.completed"
],
"url": "http://clientnotificationserver.com/notif?myquery=query2",
"signatureSecret": "sig_sec_Abcd12358RLP7VPLi7nYVy"
}
],
"pagination": {
"currentPage": 1,
"pageSize": 25,
"pagesTotal": 1,
"itemsTotal": 2,
"currentPageItems": 2,
"links": [
{
"rel": "self",
"uri": "https://ws.api.video/webhooks?currentPage=1"
},
{
"rel": "first",
"uri": "https://ws.api.video/webhooks?currentPage=1"
},
{
"rel": "last",
"uri": "https://ws.api.video/webhooks?currentPage=1"
}
]
}
}
/webhooks
Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events:
video.encoding.quality.completed
Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like { "type": "video.encoding.quality.completed", "emittedAt": "2021-01-29T16:46:25.217+01:00", "videoId": "viXXXXXXXX", "encoding": "hls", "quality": "720p"}
. This request says that the 720p HLS encoding was completed.live-stream.broadcast.started
When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.live-stream.broadcast.ended
This event fires when a live stream has finished broadcasting.video.source.recorded
This event occurs when a live stream is recorded and submitted for encoding.events
array
required
A list of the webhooks that you are subscribing to. There are Currently four webhook options:
video.encoding.quality.completed
Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like { \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"}
. This request says that the 720p HLS encoding was completed.live-stream.broadcast.started
When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.live-stream.broadcast.ended
This event fires when a live stream has finished broadcasting.video.source.recorded
Occurs when a live stream is recorded and submitted for encoding.url
string
required
The the url to which HTTP notifications are sent. It could be any http or https URL.
{
"events": [
"video.encoding.quality.completed"
],
"url": "http://clientnotificationserver.com/notif?myquery=query"
}
Created
{
"webhookId": "webhook_XXXXXXXXXXXXXXX",
"createdAt": "2021-01-08T14:12:18+00:00",
"events": [
"video.encoding.quality.completed"
],
"url": "http://clientnotificationserver.com/notif?myquery=query"
}
/webhooks/{webhookId}
Retrieve webhook details by id.
webhookId
string
required
The unique webhook you wish to retreive details on.
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/WebhooksApi.md#get
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
webhookId := "webhookId_example" // string | The unique webhook you wish to retreive details on.
res, err := client.Webhooks.Get(webhookId)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Webhooks.Get``: %v\
", err)
}
// response from `Get`: Webhook
fmt.Fprintf(os.Stdout, "Response from `Webhooks.Get`: %v\
", res)
}
Success
{
"webhookId": "webhook_XXXXXXXXXXXXXXX",
"createdAt": "2021-01-08T14:12:18+00:00",
"events": [
"video.encoding.quality.completed"
],
"url": "http://clientnotificationserver.com/notif?myquery=query"
}
/webhooks/{webhookId}
This endpoint will delete the indicated webhook.
webhookId
string
required
The webhook you wish to delete.
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/WebhooksApi.md#delete
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
webhookId := "webhookId_example" // string | The webhook you wish to delete.
err := client.Webhooks.Delete(webhookId)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Webhooks.Delete``: %v\
", err)
}
}
No Content
Empty response
type
string
The name of the webhook event that occurred.
emittedAt
string
Returns the date-time when the webhook event occurred.
liveStreamId
string
The ID of the live stream that started broadcasting.
{
"type": "live-stream.broadcast.started",
"emittedAt": "2024-08-151T10:18:47+00:00",
"liveStreamId": "li400mYKSgQ6xs7taUeSaEap"
}
Your webhook server may return this response to api.video to signal that the webhook is accepted.
Empty response
type
string
The name of the webhook event that occurred.
emittedAt
string
Returns the date-time when the webhook event occurred.
liveStreamId
string
The ID of the live stream that ended broadcasting.
{
"type": "live-stream.broadcast.ended",
"emittedAt": "2024-08-151T10:18:47+00:00",
"liveStreamId": "li400mYKSgQ6xs7taUeSaEap"
}
Your webhook server may return this response to api.video to signal that the webhook is accepted.
Empty response
type
string
The name of the webhook event that occurred.
emittedAt
string
Returns the date-time when the webhook event occurred.
liveStreamId
string
The ID of the live stream that ended broadcasting.
videoId
string
The video ID of the live stream recording.
{
"type": "video.source.recorded",
"emittedAt": "2024-08-151T10:18:47+00:00",
"liveStreamId": "li400mYKSgQ6xs7taUeSaEap",
"videoId": "vi4blUQJFrYWbaG44NChkH11"
}
Your webhook server may return this response to api.video to signal that the webhook is accepted.
Empty response
type
string
The name of the webhook event that occurred.
emittedAt
string
Returns the date-time when the webhook event occurred.
videoId
string
The ID of the video where a certain quality version's encoding is finished.
encoding
string
The type of encoding that is finished.
quality
string
The quality version of encoding that is finished.
{
"type": "video.encoding.quality.completed",
"emittedAt": "2024-08-151T10:18:47+00:00",
"videoId": "vi4blUQJFrYWbaG44NChkH11",
"encoding": "hls",
"quality": "1080p"
}
Your webhook server may return this response to api.video to signal that the webhook is accepted.
Empty response
Was this page helpful?