Sign up for free

Retrieve a chapter

Retrieve a chapter for by video id in a specific language.

get /videos/{videoId}/chapters/{language}
videoId string

required

The unique identifier for the video you want to show a chapter for.

Example
"vi4k0jvEUuaTdRAEjQ4Jfrgz"
language string

required

A valid BCP 47 language representation.

Example
"en"

Requests

// 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)
}

Responses

ExamplesSchema

Success

{
  "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/fr",
  "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/fr.vtt",
  "language": "fr"
}

Upload a chapter

Upload a VTT file to add chapters to your video. Chapters help break the video into sections. Read our tutorial for more details.

post /videos/{videoId}/chapters/{language}
file file

required

The VTT file describing the chapters you want to upload.

Requests

// 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)
}

Responses

ExamplesSchema

Success

{
  "uri": "/videos/vi3N6cDinStg3oBbN79GklWS/chapters/fr",
  "src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/chapters/fr.vtt",
  "language": "fr"
}

Delete a chapter

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.

delete /videos/{videoId}/chapters/{language}
videoId string

required

The unique identifier for the video you want to delete a chapter from.

Example
"vi4k0jvEUuaTdRAEjQ4Jfrgz"
language string

required

A valid BCP 47 language representation.

Example
"en"

Requests

// 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)
    }
}

Responses

ExamplesSchema

No Content

Empty response

List video chapters

Retrieve a list of all chapters for by video id.

get /videos/{videoId}/chapters
currentPage int

Choose the number of search results to return per page. Minimum value: 1

Default
1
Example
2
pageSize int

Results per page. Allowed values 1-100, default is 25.

Default
25
Example
30

Requests

// 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)
}

Responses

ExamplesSchema

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?