/videos/{videoId}/chapters/{language}
Retrieve a chapter for by video id in a specific language.
videoId
string
required
The unique identifier for the video you want to show a chapter for.
language
string
required
A valid BCP 47 language representation.
// 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/ChaptersApi.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()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz" // string | The unique identifier for the video you want to show a chapter for.
language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.
res, err := client.Chapters.Get(videoId, language)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Chapters.Get``: %v\
", err)
}
// response from `Get`: Chapter
fmt.Fprintf(os.Stdout, "Response from `Chapters.Get`: %v\
", res)
}
Success
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/fr",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/fr.vtt",
"language": "fr"
}
/videos/{videoId}/chapters/{language}
Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our tutorial for more details.
file
file
required
The VTT file describing the chapters you want to upload.
// 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/ChaptersApi.md#upload
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()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz" // string | The unique identifier for the video you want to upload a chapter for.
language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.
file := os.NewFile(1234, "some_file") // *os.File | The VTT file describing the chapters you want to upload.
res, err := client.Chapters.UploadFile(videoId, language, file)
// you can also use a Reader instead of a File:
// client.Chapters.Upload(videoId, language, fileName, fileReader)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Chapters.Upload``: %v\
", err)
}
// response from `Upload`: Chapter
fmt.Fprintf(os.Stdout, "Response from `Chapters.Upload`: %v\
", res)
}
Success
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/fr",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/fr.vtt",
"language": "fr"
}
/videos/{videoId}/chapters/{language}
Delete a chapter in a specific language by providing the video ID for the video you want to delete the chapter from and the language the chapter is in.
videoId
string
required
The unique identifier for the video you want to delete a chapter from.
language
string
required
A valid BCP 47 language representation.
// 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/ChaptersApi.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()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz" // string | The unique identifier for the video you want to delete a chapter from.
language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.
err := client.Chapters.Delete(videoId, language)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Chapters.Delete``: %v\
", err)
}
}
No Content
Empty response
/videos/{videoId}/chapters
Retrieve a list of all chapters for by video id.
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/ChaptersApi.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()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz" // string | The unique identifier for the video you want to show a chapter for.
language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.
res, err := client.Chapters.Get(videoId, language)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Chapters.Get``: %v\
", err)
}
// response from `Get`: Chapter
fmt.Fprintf(os.Stdout, "Response from `Chapters.Get`: %v\
", res)
}
Success
{
"data": [
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/fr",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/fr.vtt",
"language": "fr"
},
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/en",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/en.vtt",
"language": "en"
}
],
"pagination": {
"currentPage": 1,
"currentPageItems": 2,
"pageSize": 25,
"pagesTotal": 1,
"itemsTotal": 2,
"links": [
{
"rel": "self",
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters?currentPage=1&pageSize=25"
},
{
"rel": "first",
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters?currentPage=1&pageSize=25"
},
{
"rel": "last",
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters?currentPage=1&pageSize=25"
}
]
}
}
Was this page helpful?