Youtube · Arazzo Workflow

YouTube Upload and Update a Caption Track

Version 1.0.0

Upload a draft caption track for a video, then publish it by updating its draft status.

1 workflow 1 source API 1 provider
View Spec View on GitHub GoogleMediaSocialStreamingVideoVideosArazzoWorkflows

Provider

youtube

Workflows

upload-update-caption
Insert a draft caption track and then publish it.
Inserts a caption resource as a draft for a video, then updates that caption resource to set isDraft to false.
2 steps inputs: apiKey, language, name, videoId outputs: captionId, isDraft
1
insertCaption
youtube.captions.insert
Upload the caption track as a draft and capture its id.
2
publishCaption
youtube.captions.update
Update the caption track to clear the draft flag so it becomes visible.

Source API Descriptions

Arazzo Workflow Specification

youtube-upload-update-caption-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: YouTube Upload and Update a Caption Track
  summary: Upload a draft caption track for a video, then publish it by updating its draft status.
  description: >-
    A two-stage captioning flow. It uploads a caption track for a video as a
    draft, captures the new caption id, and then updates the caption resource to
    clear the draft flag so the track becomes visible. Note the YouTube captions
    endpoints also support resumable media upload of the caption file; this
    workflow handles the JSON caption resource the OpenAPI description models.
    Every step spells out its request inline so the flow can be read and executed
    without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: youtubeDataApi
  url: ../openapi/youtube-data-api-openapi.yml
  type: openapi
workflows:
- workflowId: upload-update-caption
  summary: Insert a draft caption track and then publish it.
  description: >-
    Inserts a caption resource as a draft for a video, then updates that caption
    resource to set isDraft to false.
  inputs:
    type: object
    required:
    - apiKey
    - videoId
    - language
    - name
    properties:
      apiKey:
        type: string
        description: The Google API key used to authorize each YouTube Data API request.
      videoId:
        type: string
        description: The id of the video the caption track belongs to.
      language:
        type: string
        description: The BCP-47 language code of the caption track.
      name:
        type: string
        description: The display name of the caption track.
  steps:
  - stepId: insertCaption
    description: Upload the caption track as a draft and capture its id.
    operationId: youtube.captions.insert
    parameters:
    - name: part
      in: query
      value: snippet
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        snippet:
          videoId: $inputs.videoId
          language: $inputs.language
          name: $inputs.name
          isDraft: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      captionId: $response.body#/id
  - stepId: publishCaption
    description: Update the caption track to clear the draft flag so it becomes visible.
    operationId: youtube.captions.update
    parameters:
    - name: part
      in: query
      value: snippet
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        id: $steps.insertCaption.outputs.captionId
        snippet:
          videoId: $inputs.videoId
          language: $inputs.language
          name: $inputs.name
          isDraft: false
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      captionId: $response.body#/id
      isDraft: $response.body#/snippet/isDraft
  outputs:
    captionId: $steps.publishCaption.outputs.captionId
    isDraft: $steps.publishCaption.outputs.isDraft