Submitting a New Job to a Hosted Workflow

Submitting a new job to a specific Hosted Workflow involves utilizing a portion of the parametric details obtained in the previous section (Retrieving Workflow Details) formatted with specific values pertinent to the new job.
The actual message to submit a new job is a HTTPS Post request:

843

The POST method operates by targeting a specific workflow id and providing a ‘completed’ version of the JSON data blob returned by the previous GET method as the post data.

To interact with the same workflow referenced above, the Request URL target would be (note the use of the same workflow ID below ( 912d15b040e2d3f784e9ea89d5b2bee2 ):

https://api.cloud.telestream.net/vantage-cloud-port/v2.0/workflows/912d15b040e2d3f784e9ea89d5b2bee2/workflow-jobs

The POST data associated with this

{
	"name": "Test API",
	"inputs":
	{
		"variables":
  	{
			"Video Height": "360",
			"Video Width": "640"
		},

		"sources":
  	{
      "Original" : "https://johnkoctopus.s3-us-west-1.amazonaws.com/demo1.mpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJUCSYT27AMWGFZQ/20200408/us-west-1/s3/aws4_request&X-Amz-Date=20200408T123537Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=88cc727ffb81561dc8650c2f07f66f56c4ee062e299ef8197925e591610538c0"

		}
	},

	"storage_references": 
	{
		"9dff864e-045c-4b58-8cb1-12221bd89c6b": 
		{
			"store_id": "240f042bfc4bee58a965c7d79e17c45c",
			"folder_offset": "/folder1/project1/"
		}

	}

}

A few important rules associated with Variables

The variables that are ‘advertised’ by a workflow should ALWAYS be included in the POST data during the submit phase to a workflow. Excluding the variables will NOT result in the DEFAULT values being utilized. Rather, excluding variables results in the workflow NOT having access to those variables in any form.

As such, it is important to always include references to expected variables in the POST (submit) query. The default value should be specified as the value if the user does not wish to provide a custom value.

For example, consider the GET call above in which the following is returned for the variables json object:

"variables": 
      {
            "Video Height":
            {
                "identifier": "409cf8c1-b4f9-41cb-b075-4bb028257d57",
                "name": "Video Height",
                "typecode": "Int32",
                "default": "480",
                "value": "480"
            },

            "Video Width": 
            {
                "identifier": "6ccc4b35-9abf-421d-9f3d-d92b48cfc8e8",
                "name": "Video Width",
                "typecode": "Int32",
                "default": "720",
                "value": "720"
            }
      }

Within the corresponding POST (Submit) call; the following is specified:

"variables": 
{
	"Video Height": "360",
	"Video Width": "640"
},

If these values are NOT specified, it is important to understand that the DEFAULT value of 480 for the height and 720 for the width: "default": "480", and "default": "720", are not utilized.

❗️

Do Not Omit Variables

Do NOT simply omit variables from a POST (Submit) call with the expectation that the DEFAULT values are automatically applied.

The response to this POST call shall be a JSON object, which shall contain the original submitted parameters AND that contains the JOB ID:

{
    "id": "82971554f9dde5e0d91878124c08c9db",
    "name": "Test API",
    "inputs": 
    {
        "sources": 
        {
            "Original": "https://johnkoctopus.s3-us-west-1.amazonaws.com/demo1.mpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJUCSYT27AMWGFZQ/20200408/us-west-1/s3/aws4_request&X-Amz-Date=20200408T123537Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=88cc727ffb81561dc8650c2f07f66f56c4ee062e299ef8197925e591610538c0"
        },

        "variables": 
        {
            "Video Height": "360",
            "Video Width": "640"
        }
    },

    "storage_references": 
    {
        "9dff864e-045c-4b58-8cb1-12221bd89c6b": 
        {
            "store_id": "240f042bfc4bee58a965c7d79e17c45c",
            "folder_offset": "/folder1/project1/"
        }
    },

    "state": "created",
    "status": "queued",
    "workflow_version": 0,
    "created_at": "2020-04-10T17:01:48.090967591Z",
    "updated_at": "2020-04-10T17:01:48.090967822Z"
}

📘

JOB Id

The Job Identifier: "id": "82971554f9dde5e0d91878124c08c9db" (from above) is used in all subsequent calls to query information about the newly created job.