diff --git a/src/OpencastApi/Rest/OcIngest.php b/src/OpencastApi/Rest/OcIngest.php index e0fe098..b18873e 100644 --- a/src/OpencastApi/Rest/OcIngest.php +++ b/src/OpencastApi/Rest/OcIngest.php @@ -431,10 +431,11 @@ public function addTrackUrl($mediaPackage, $flavor, $url, $tags = '') * @param string $mediaPackage The media package * @param string $workflowDefinitionId (optional) Workflow definition id * @param string $workflowInstanceId (optional) The workflow instance ID to associate this ingest with scheduled events. + * @param array $workflowConfiguration Workflow configuration * * @return array the response result ['code' => 200, 'body' => '{XML (text) media package}'] */ - public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInstanceId = '') + public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInstanceId = '', $workflowConfiguration = []) { $uri = self::URI . "/ingest"; if (!empty($workflowDefinitionId) && empty($workflowInstanceId)) { @@ -450,6 +451,13 @@ public function ingest($mediaPackage, $workflowDefinitionId = '', $workflowInsta $formData['workflowInstanceId'] = $workflowInstanceId; } + if (!empty($workflowConfiguration)) { + // Adding workflow configuration params into the form data one by one. + foreach ($workflowConfiguration as $config => $value) { + $formData[$config] = $value; + } + } + $options = $this->restClient->getFormParams($formData); return $this->restClient->performPost($uri, $options); diff --git a/tests/Unit/OcIngestTest.php b/tests/Unit/OcIngestTest.php index e02a9e8..7daa48a 100644 --- a/tests/Unit/OcIngestTest.php +++ b/tests/Unit/OcIngestTest.php @@ -206,7 +206,11 @@ public function add_attachment_all(array $ingestData): array public function ingest(array $ingestData): void { $workflowDefinitionId = 'schedule-and-upload'; - $responseIngest = $this->ocIngest->ingest($ingestData['mediaPackage'], $workflowDefinitionId); + // Add workflow configuration params. + $workflowConfiguration = [ + 'straightToPublishing' => false + ]; + $responseIngest = $this->ocIngest->ingest($ingestData['mediaPackage'], $workflowDefinitionId, '', $workflowConfiguration); $this->assertSame(200, $responseIngest['code'], 'Failure to ingest'); $mediaPackage = $responseIngest['body']; $this->assertNotEmpty($mediaPackage);