Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.

Guidance on Adding Captions via the Rest API

I'm not seeing much documentation on how to attach a caption file to a session via the API. I'm able to do it through PostMan with form-data file. I have a few questions:

1. Is it possible to send as text rather than a file? Do I just base64 encode the vtt file contents and send that?

2. Can I overwrite an existing transcript? Right now I receive errors stating "only a single file is allowed"

3. How do I specify which language the caption file is in?

TIA

Answers

  • Kevin BaumKevin Baum Panopto Employee

    Hi Adam,

    1. Both the SOAP API and REST API endpoints for uploading captions to a session expect a file rather than a stream of text.
    2. If you are using the SOAP API, you can use the ISessionManagement.ReplaceMachineCaptionsAndUploadTranscript endpoint to replace the Panopto Automatic Machine Captions with the newly uploaded caption file. The REST API does not currently allow replacing existing captions, however.
    3. If you are using the REST API to upload captions to a session or to upload captions to a specific stream in a session, you can specify the language in the language parameter of the form post. The SOAP API does not allow you to specify a language, and any captions uploaded using the SOAP API will be in the default language. The REST API will also allow you to upload multiple caption files, as long as they are all different languages. You are still limited to only a single caption file per language, and the API will not replace any existing captions.

    I hope this helps. Please let me know if you have any other questions.

    Thanks,

    Kevin

  • I'm sure it's obvious, but I can't figure out where to actually specify the language in the body of the post call. Where would I add that in this call:

    {
    "$content-type": "multipart/form-data",
    "$multipart": [
    {
    "headers": {
    "Content-Disposition": "form-data; name=""; filename="testingtranscription.srt",
    "Content-Type": "text/plain"
    },
    "body": "@{outputs('ComposeContent3')}"
    }
    ]
    }

  • Kevin BaumKevin Baum Panopto Employee

    Hi Adam,

    The language should be sent as part of the multi-part form data that you would send in your request. I'm not sure which language you are using, but you can see a raw HTTP sample below:

    POST /Panopto/api/v1/sessions/<sessionId>/captions HTTP/1.1
    Authorization: Bearer <token>
    Content-Length: 326
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name=""; filename="/C:/Path/To/Your/Files/CaptionTest.srt"
    Content-Type: <Content-Type header here> (data)
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="language" English_USA
    ------WebKitFormBoundary7MA4YWxkTrZu0gW--

    This shows a sample request with both the file data containing the captions and the language in the multi-part form data of the body of the request.

    I hope that this helps. Please let me know if you have any other questions.

    Thanks,

    Kevin

Sign In or Register to comment.