diff --git a/api-reference/workflow/overview.mdx b/api-reference/workflow/overview.mdx index 0f7d930e..7dc73a4d 100644 --- a/api-reference/workflow/overview.mdx +++ b/api-reference/workflow/overview.mdx @@ -1825,13 +1825,6 @@ the `POST` method to call the `/workflows//run` endpoint (for `curl - - If the target workflow was originally created programmatically by the Unstructured Python SDK or with a REST API client such as `curl` or Postman, - and the workflow uses a local source connector, you can run the workflow only with a REST API client such as `curl` or Postman, - as described later in this section. - You cannot run the workflow with the Python SDK or the Unstructured user interface (UI), even though the workflow is visible in the UI. - - ```python import os @@ -1852,13 +1845,6 @@ the `POST` method to call the `/workflows//run` endpoint (for `curl ``` - - If the target workflow was originally created programmatically by the Unstructured Python SDK or with a REST API client such as `curl` or Postman, - and the workflow uses a local source connector, you can run the workflow only with a REST API client such as `curl` or Postman, - as described later in this section. - You cannot run the workflow with the Python SDK or the Unstructured user interface (UI), even though the workflow is visible in the UI. - - ```python import os import asyncio @@ -1882,6 +1868,88 @@ the `POST` method to call the `/workflows//run` endpoint (for `curl asyncio.run(run_workflow()) ``` + + In the following code, replace `` with a relative or absolute path to a local input file for Unstructured to process. You can add multiple files, with one entry per file. + + ```python + import os + + from unstructured_client import UnstructuredClient + from unstructured_client.models.operations import RunWorkflowRequest + from unstructured_client.models.shared import InputFiles + + input_files = [] + + for filename in [ + "", + "" + ]: + with open(filename, "rb") as f: + input_files.append( + InputFiles( + content=f.read(), + file_name=filename + ) + ) + + with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client: + response = client.workflows.run_workflow( + request={ + "workflow_id": "" + "body_run_workflow": { + "input_files": input_files + } + } + ) + + print(response.raw_response) + ``` + + For a local destination, to access the processed files' data, [download a processed local file](#download-a-processed-local-file-from-a-job) from the workflow's job run. + + + In the following code, replace `` with a relative or absolute path to a local input file for Unstructured to process. You can add multiple files, with one entry per file. + + ```python + import os + import asyncio + + from unstructured_client import UnstructuredClient + from unstructured_client.models.operations import RunWorkflowRequest + from unstructured_client.models.shared import InputFiles + + async def run_workflow(): + input_files = [] + + for filename in [ + "", + "" + ]: + with open(filename, "rb") as f: + input_files.append( + InputFiles( + content=f.read(), + file_name=filename + ) + ) + + with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client: + response = client.workflows.run_workflow( + request={ + "workflow_id": "" + "body_run_workflow": { + "input_files": input_files + } + } + ) + + print(response.raw_response) + + asyncio.run(run_workflow()) + ``` + + For a local destination, to access the processed files' data, [download a processed local file](#download-a-processed-local-file-from-a-job) from the workflow's job run. + ```bash curl --request 'POST' --location \ diff --git a/api-reference/workflow/workflows.mdx b/api-reference/workflow/workflows.mdx index c0d66f55..64779dbf 100644 --- a/api-reference/workflow/workflows.mdx +++ b/api-reference/workflow/workflows.mdx @@ -116,9 +116,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). ```python @@ -198,9 +198,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). ```python @@ -363,9 +363,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). ```python @@ -449,9 +449,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` or Postman. [Learn how](/api-reference/workflow/overview#run-a-workflow). ```python @@ -565,9 +565,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` (or Postman). [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` (or Postman). [Learn how](/api-reference/workflow/overview#run-a-workflow). ```bash @@ -602,9 +602,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as `curl` (or Postman). [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as `curl` (or Postman). [Learn how](/api-reference/workflow/overview#run-a-workflow). ```bash @@ -680,9 +680,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as Postman (or `curl`). [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as Postman (or `curl`). [Learn how](/api-reference/workflow/overview#run-a-workflow). 1. In the method drop-down list, select **POST**. @@ -728,9 +728,9 @@ specify the settings for the workflow, as follows: A workflow with a local source has the following limitations: - The workflow cannot be set to run on a repeating schedule. - - The workflow cannot be run with the Unstructured Python SDK or from the Unstructured user interface (UI), - even though the workflows is visible in the UI. However, you can - run the workflow with REST API clients such as Postman (or `curl`). [Learn how](/api-reference/workflow/overview#run-a-workflow). + - The workflow cannot be run from the Unstructured user interface (UI), + even though the workflow is visible in the UI. However, you can + run the workflow with the Unstructured Python SDK, or REST API clients such as Postman (or `curl`). [Learn how](/api-reference/workflow/overview#run-a-workflow). 1. In the method drop-down list, select **POST**.