Skip to content

Latest commit

 

History

History
226 lines (153 loc) · 7.74 KB

WebhooksAPI.md

File metadata and controls

226 lines (153 loc) · 7.74 KB

WebhooksAPI

All URIs are relative to https://ws.api.video

Method HTTP request Description
create POST /webhooks Create Webhook
get GET /webhooks/{webhookId} Retrieve Webhook details
delete DELETE /webhooks/{webhookId} Delete a Webhook
list GET /webhooks List all webhooks

create

    open class func create(webhooksCreationPayload: WebhooksCreationPayload, completion: @escaping (_ data: Webhook?, _ error: Error?) -> Void)
    open class func create(webhooksCreationPayload: WebhooksCreationPayload, completion: @escaping (_ result: Swift.Result<Response<Webhook>, ErrorResponse>) -> Void)

Create Webhook

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.

Example

// The following code samples are still beta. For any issue, please report via http:/OpenAPITools/openapi-generator/issues/new
import ApiVideoClient

let webhooksCreationPayload = WebhooksCreationPayload(events: ["events_example"], url: "url_example") // WebhooksCreationPayload | 

// Create Webhook
WebhooksAPI.create(webhooksCreationPayload: webhooksCreationPayload) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
webhooksCreationPayload WebhooksCreationPayload

Return type

Webhook

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get

    open class func get(webhookId: String, completion: @escaping (_ data: Webhook?, _ error: Error?) -> Void)
    open class func get(webhookId: String, completion: @escaping (_ result: Swift.Result<Response<Webhook>, ErrorResponse>) -> Void)

Retrieve Webhook details

Retrieve webhook details by id.

Example

// The following code samples are still beta. For any issue, please report via http:/OpenAPITools/openapi-generator/issues/new
import ApiVideoClient

let webhookId = "webhookId_example" // String | The unique webhook you wish to retreive details on.

// Retrieve Webhook details
WebhooksAPI.get(webhookId: webhookId) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
webhookId String The unique webhook you wish to retreive details on.

Return type

Webhook

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete

    open class func delete(webhookId: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void)
    open class func delete(webhookId: String, completion: @escaping (_ result: Swift.Result<Response<Void>, ErrorResponse>) -> Void)

Delete a Webhook

This method will delete the indicated webhook.

Example

// The following code samples are still beta. For any issue, please report via http:/OpenAPITools/openapi-generator/issues/new
import ApiVideoClient

let webhookId = "webhookId_example" // String | The webhook you wish to delete.

// Delete a Webhook
WebhooksAPI.delete(webhookId: webhookId) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
webhookId String The webhook you wish to delete.

Return type

Void (empty response body)

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

    open class func list(events: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ data: WebhooksListResponse?, _ error: Error?) -> Void)
    open class func list(events: String? = nil, currentPage: Int? = nil, pageSize: Int? = nil, completion: @escaping (_ result: Swift.Result<Response<WebhooksListResponse>, ErrorResponse>) -> Void)

List all webhooks

Thie method returns a list of your webhooks (with all their details).

You can filter what the webhook list that the API returns using the parameters described below.

Example

// The following code samples are still beta. For any issue, please report via http:/OpenAPITools/openapi-generator/issues/new
import ApiVideoClient

let events = "events_example" // String | The webhook event that you wish to filter on. (optional)
let currentPage = 987 // Int | Choose the number of search results to return per page. Minimum value: 1 (optional) (default to 1)
let pageSize = 987 // Int | Results per page. Allowed values 1-100, default is 25. (optional) (default to 25)

// List all webhooks
WebhooksAPI.list(events: events, currentPage: currentPage, pageSize: pageSize) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}

Parameters

Name Type Description Notes
events String The webhook event that you wish to filter on. [optional]
currentPage Int Choose the number of search results to return per page. Minimum value: 1 [optional] [default to 1]
pageSize Int Results per page. Allowed values 1-100, default is 25. [optional] [default to 25]

Return type

WebhooksListResponse

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]