Flows

Flows are our version of a workflow system. Our Flows are a powerful way to automate your video production pipeline. They allow you to create a series of job that will be executed either in order or in parallel. A flow is made up of two main components: jobs and deliverables. Jobs are the individual tasks that will be executed in your flow, while deliverables are the final output(s) of your workflow.

Let's walk through an example flow to get a better understanding of how they work.


Example flow

Imagine you have a video app that allows users to generate multiple videos at a single time. You want to be able to generate a video for each of the user's inputs, and then deliver them to the user once they are all complete. You can do this by creating a flow with two jobs, one for each video, and a single deliverable that will be created once both jobs are complete.

Setting up jobs

Jobs are the individual tasks that will be executed in your flow. There are several types of jobs that we can execute in a flow, but for this example we will use the runTemplate job type.

Job 1 configuration

{
  "type": "runTemplate",
  "template": {
    "name": "media_1x1",
    "inputs": {
      "image": "https://picsum.photos/1920/1080",
      "title": "Poddy McPodface",
      "subtitle": "001: The Podfather"
    }
  }
}

Job 2 configuration

{
  "type": "runTemplate",
  "template": {
    "name": "media_1x1",
    "inputs": {
      "image": "https://picsum.photos/1920/1080",
      "title": "Poddy McPodface",
      "subtitle": "002: Poddy's Revenge"
    }
  }
}

Setting up deliverables

In our example, we would like to generate a single deliverable consisting of our job's deliverables; in this case, videos. We can do this by creating a deliverable with the zip type. The zip type will take the deliverables of the jobs that are specified in the jobs array and zip them together into a single file.

Most deliverables will have a filename property that will be used to name the deliverable. If you do not specify a filename property, the deliverable will be named after the flow identifier.

Deliverable configuration

"zip": {
  "filename": "custom-zip-name"
}

Putting it all together

Now that we have our jobs and deliverables set up, we can put them together to complete our workflow.

  • Name
    deliverables
    Type
    object
    Description

    An object containing deliverable configurations. Defaults to an empty object.

  • Name
    jobs
    Type
    array
    required
    Description

    An array containing job configurations. Flows must have at least one job.

  • Name
    metadata
    Type
    object
    Description

    An object containing user-supplied metadata about the flow.

Running the flow

Once your flow has been configured, it can be executed with a simple POST request.

Request

GET
/v2/flows/run
curl --location --request POST 'https://api.editframe.com/v2/flows/run' \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  --data-raw 'CONFIG'

Complete flow configuration

{
  "deliverables": {
    "zip": {
      "filename": "custom-zip-name"
    }
  },
  "jobs": [
    {
      "type": "runTemplate",
      "template": {
        "name": "media_1x1",
        "inputs": {
          "image": "https://picsum.photos/1920/1080",
          "title": "Poddy McPodface",
          "subtitle": "001: The Podfather"
        }
      }
    },
    {
      "type": "runTemplate",
      "template": {
        "name": "media_1x1",
        "inputs": {
          "image": "https://picsum.photos/1920/1080",
          "title": "Poddy McPodface",
          "subtitle": "002: Poddy's Revenge"
        }
      }
    }
  ]
}