Captions API in Wasabi AiR
    • 20 May 2024
    • 1 Minute to read
    • PDF

    Captions API in Wasabi AiR

    • PDF

    Article summary

    The Captions API enables you to view, add, or delete caption files from an item. This is useful for managing multiple caption files for a single item.

    Getting All Captions for an Item

    GET /api/data/v3/items/{item_id}/captions
    • {item_id} - (string) The ID of the item for which to set categories.

    Response

    {
        "captions": {
            "captions": [
                {
                    "id": "5b20557199bf28c679bbecbf1f94a2e0",
                    "source": "captions",
                    "language": {
                      "language" : "eng",
                      "confidence": 0.99
                    },
                    "added_at": 1570136199,
                    "transcript": [
                        {
                            "end_at": 3.269,
                            "start_at": 1.7349999999999999,
                            "text": "Mom,"
                        },
                        {
                            "end_at": 4.204,
                            "start_at": 3.304,
                            "text": "I may not have the words"
                        },
                        {
                            "end_at": 5.672,
                            "start_at": 4.2379999999999995,
                            "text": "to thank you for everything"
                        },
                        {
                            "end_at": 8.641,
                            "start_at": 5.7059999999999995,
                            "text": "you've done for me -"
                        },
                        {
                            "end_at": 10.943999999999999,
                            "start_at": 8.676,
                            "text": "the sacrifices you've made,"
                        },
                        {
                            "end_at": 13.947,
                            "start_at": 10.978,
                            "text": "the love and care you've given..."
                        },
                        {
                            "end_at": 15.482,
                            "start_at": 13.981,
                            "text": "But no matter what,"
                        },
                        {
                            "end_at": 17.884,
                            "start_at": 15.516,
                            "text": "you'll always have my respect,"
                        },
                        {
                            "end_at": 20.787,
                            "start_at": 17.918,
                            "text": "my gratitude"
                        },
                        {
                            "end_at": 23.423,
                            "start_at": 20.821,
                            "text": "and most especially,"
                        },
                        {
                            "end_at": 25.558,
                            "start_at": 23.457,
                            "text": "my love."
                        },
                        {
                            "end_at": 28.962,
                            "start_at": 25.593,
                            "text": "Happy Mother's day."
                        }
                    ]
                }
            ]
        }
    }

    Downloading a Caption File

    Captions that were extracted from the contents embedded in video files are downloaded as .SRT files. Captions that were uploaded to existing items are downloaded in the format of the original file.

    GET /api/data/v3/items/{item_id}/captions/download?caption_id={caption_id}
    • {item_id} - (string) The ID of the item for which to set categories.
    • {caption_id} - (string) The ID of the item captions to be downloaded.

    Adding a Caption File

    POST  /api/data/v3/items/{item_id}/captions
    form-data: (key="caption_file" file="caption.SRT")
    • {item_id} - (string) The ID of the item for which to set categories.

    Deleting a Caption File

    DELETE /api/data/v3/items/{item_id}/captions?caption_id={caption_id}
    • {item_id} - (string) The ID of the item for which to set categories.
    • {caption_id} - (string) The ID of the item captions to be deleted.