Skip to content

OcWorkflow

FarbodZamani edited this page Mar 29, 2022 · 1 revision

This class contains all REST API calls to the /workflow endpoint.

Namespace

It is accessible under OpencastApi\Rest namespace.

How to use

  1. In OpencastApi\OpenCast as its property with OpenCast properties naming convention:
use OpencastApi\OpenCast;
$opencastApi = new OpenCast($config);
$ocWorkflow = $opencastApi->workflow;
...
  1. Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcWorkflow;
$ocRestClient = new OcRestClient($config);
$ocWorkflow = new OcWorkflow($ocRestClient);
...

Functions

Consumable functions are listed below:

getConfigurationPanel($definitionId = '')

Get the configuration panel for a specific workflow. More Detail

  • $definitionId (string) (optional) The workflow definition identifier.

  • Returns an array: ['code' => 200, 'body' => '{The HTML workflow configuration panel}']

getCount($state = '', $operation = '')

Returns the number of workflow instances in a specific state and operation. More Detail

  • $state (string) (optional) The workflow state.

  • $operation (string) (optional) The current operation.

  • Returns an array: ['code' => 200, 'body' => '{The number of workflow instances}']

getSingleDefinition($definitionId, $format = '')

Returns a single workflow definition as JSON by default or XML by demand. More Detail

  • $definitionId (string) The workflow definition identifier.

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{The workflow definition (object JSON| text XML)}']

getDefinitions($format = '')

List all available workflow definitions as JSON or XML on demand (default would be JSON) More Detail

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{The workflow definitions (object JSON| text XML)}']

getHandlers()

List all registered workflow operation handlers (implementations). More Detail

  • Returns an array: ['code' => 200, 'body' => '{A JSON (object) representation of the registered workflow operation handlers}']

getStateMappings()

Get all workflow state mappings JSON (Object). More Detail

  • Returns an array: ['code' => 200, 'body' => '{A JSON (object) representation of the workflow state mappings }']

getStatistics($format = '')

Returns the workflow statistics as JSON (Object) by default or XLM (text) More Detail

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{A JSON (object) | XML (text) representation of the workflow statistics }']

getInstance($instanceId, $format = '')

Get a specific workflow instance as JSON (Object) by default or XLM (text). More Detail

  • $instanceId (string) The workflow instance identifier.

  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{A JSON (object) | XML (text) representation of the workflow instance }']

getInstances($params = [], $format = '')

List all workflow instances matching the query parameters as JSON (Object) by default or XLM (text). More Detail

  • $params is an optional array that could contain the following:
[
    'state' => '{Filter results by workflows' current state}',
    'q' => '{Filter results by free text query}',
    'seriesId' => '{ Filter results by series identifier }',
    'seriesTitle' => '{ Filter results by series title }',
    'creator' => '{ Filter results by the mediapackage's creator }',
    'contributor' => '{Filter results by the mediapackage's contributor}',
    'fromdate' => '{Filter results by workflow start date}',
    'todate' => '{Filter results by workflow start date}',
    'language' => '{Filter results by mediapackage's language.}',
    'license' => '{Filter results by mediapackage's license}',
    'title' => '{Filter results by mediapackage's title}',
    'subject' => '{Filter results by mediapackage's subject}',
    'workflowdefinition' => '{Filter results by workflow definition}',
    'mp' => '{Filter results by mediapackage identifier.}',
    'op' => '{ Filter results by workflows' current operation}',
    'sort' => '{The sort order. May include any of the following: DATE_CREATED, TITLE, SERIES_TITLE, SERIES_ID, MEDIA_PACKAGE_ID, WORKFLOW_DEFINITION_ID, CREATOR, CONTRIBUTOR, LANGUAGE, LICENSE, SUBJECT. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC)}',
    'startPage' => '{(Default value=0): The paging offset }',
    'count' => '{(Default value=0): The number of results to return.}',
    'compact' => '{Whether to return a compact version of the workflow instance, with mediapackage elements, workflow and workflow operation configurations and non-current operations removed}',
]
  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{A JSON (object) | XML (text) representation of the workflow set }']

removeInstance($instanceId, $force = false)

(Danger!) Permenantly removes a workflow instance including all its child jobs. In most circumstances, /stop endpoint in stop($instanceId) method is what you should use. More Detail

  • $instanceId (string) The workflow instance identifier.

  • $force (boolean) (optional) If the workflow status should be ignored and the workflow removed anyway (Default value=false)

  • Returns an array: ['code' => 204, 'reason' => 'No Content'] (If workflow instance could be removed successfully, no content is returned)

replaceAndresume($instanceId, $mediapackage = '', $properties = '')

Replaces a suspended workflow instance with an updated version, and resumes the workflow. More Detail

  • $instanceId (string) The workflow instance identifier.

  • $mediapackage (array|string) (optional) The new Mediapackage

  • $properties (array|string) (optional) Properties

  • Returns an array: ['code' => 200, 'body' => '{An XML (as text) representation of the updated and resumed workflow instance}']

resume($instanceId)

Resumes a suspended workflow instance. More Detail

  • $instanceId (string) The workflow instance identifier.

  • Returns an array: ['code' => 200, 'body' => '{An XML (as text) representation of the resumed workflow instance.}']

start($definition, $mediapackage, $parent = '', $properties = '')

Start a new workflow instance. More Detail

  • $definition (string) The workflow definition ID or an XML representation of a workflow definition.

  • $mediapackage (string) The XML representation of a mediapackage.

  • $parent (string) (Optional) An optional parent workflow instance identifier.

  • $properties (string|array) (Optional) An optional set of key=value properties.

  • Returns an array: ['code' => 200, 'body' => '{An XML (as text) representation of the new workflow instance.}']

stop($instanceId)

Stops a workflow instance. More Detail

  • $instanceId (string) The workflow instance identifier.

  • Returns an array: ['code' => 200, 'body' => '{An XML (as text) representation of the stopped workflow instance.}']

suspend($instanceId)

Suspends a workflow instance. More Detail

  • $instanceId (string) The workflow instance identifier.

  • Returns an array: ['code' => 200, 'body' => '{An XML (as text) representation of the suspended workflow instance.}']

update($workflow)

Updates a workflow instance. More Detail

  • $workflow (string) The XML representation of the workflow instance.

  • Returns an array: ['code' => 204, 'body' => '', 'reason' => 'No Content'] (Workflow instance updated)