Workflows

Workflows handle the orchestration of live stream resources of a scheduled event.

Workflows use Templates to define how a workflow will be executed. A Template specifies the resources, configuration desired states and order that resources are to be utilized.

A Workflow Instance is a concrete representation of a unique workflow based on a template and contains references to the actual resources and configuration needed to complete the process.

The Workflow system will use and update a worflow instance when completing a workflow for an event.

Currently, only programatic access via the API endpoints is available. The API requests and respones use the JSON:API specification.

The OpenAPI specificaton can be viewed here:

M2A Workflows API Version v1 Reference

Postman collection with Workflows Instance API endpoints for testing purposes: Click here to download

Creating a Workflow Instance

Prerequisites:

  • A valid M2A Auth token

  • The correct permissions associated to your M2A user account

  • A M2A Connect source ID e.g. 357fb3a6-9653-49db-a4bf-439854596b4c

  • A M2A Workflows Template reference name e.g. example_template_1

  • The Target Account ID e.g. e2a90190-a466-4736-b19b-58f2c3908e1e

Make a request to the Instances API using the URL, headers and payload below:

Headers:

Authorization

Bearer eyJraWQiOiJ6NXNFcjlHUmF4RFJ0cGNFRzY2Wlc4eGlBaUxG…

Accept

application/vnd.api+json

Content-Type

application/vnd.api+json

Method:

POST

URL:

http://cloud.m2amedia.tv/api/workflows/v1/instances?filter[instance][owner]=e2a90190-a466-4736-b19b-58f2c3908e1e

Payload:

{
    "data": {
        "type": "workflow-instance",
        "attributes": {
            "custom-status": "STARTING",
            "config": {
                "primary_source": "357fb3a6-9653-49db-a4bf-439854596b4c",
                "meta": {
                    "labels": [
                        {
                            "key": "m2amedia.tv:name",
                            "value": "Example Workflow Template 1"
                        }
                    ]
                }
            }
        },
        "relationships": {
            "template": {
                "data": {
                    "type": "workflow-template",
                    "resource-name": "example_template_1"
                }
            }
        }
    }
}