RPA.Robocorp.Process
module RPA.Process
class RPA.Robocorp.Process.Process
A library for interacting with Control Room (CR) Process API endpoints.
See Unattended processes for information about process run, step run and work item states.
See APIs and webhooks for information about Control Room APIs.
The Process API endpoint is defined by RC_API_PROCESS_HOST environment variable, which is available during Robocorp Workforce Agent runs.
Examples
Robot Framework
In the following example a task creates two input work items, and starts a process with those items. This results in 2 different process runs in the Control Room.
Robot Framework
In the following example a task creates work item with files. To include files in a work item, the item needs to be created before starting the process (note. different start keyword than above).
In this example I am using same keywords and settings from above example.
Download from process runs artifacts all matching files
Python
List work items in Control Room and retry failed items.
Download from process runs artifacts all โ.xlsxโ files
variable ROBOT_AUTO_KEYWORDS
variable ROBOT_LIBRARY_DOC_FORMAT
variable ROBOT_LIBRARY_SCOPE
property base_api : str
method create_input_work_item
Create an input work item for a process
Parameters
- payload โ work item data
- files โ absolute filepaths as single string or list
- process_id โ specific process to which item belongs to
- Returns: The integer that represents the work item id
method get_process_id_by_name
Get a process id of the process by name
Parameters
- process_name โ name of the process in the Control Room
- workspace_id โ specific Control Room workspace to which process belongs to
- Returns: the next iteration id or None
method get_process_run_status
Get a process run status by run id
Parameters
- process_run_id โ id of the process run
- step_run_id โ id of the process step run
- process_id โ specific process to which runs belongs to
- Returns: the response JSON
method get_robot_run_artifact
Get a download URL for a process run artifact
Parameters
- process_run_id โ id of the process run
- step_run_id โ id of the process step run
- artifact_id โ id of the run artifact
- filename โ filename of the run artifact
- process_id โ specific process to which runs belongs to
- Returns: url for file download
method get_work_item
Get work item from Control Room
Parameters
- workitem_id โ id of the work item
- include_data โ include work item payload and files in the response (default False)
- process_id โ specific process to which runs belongs to
- Returns: the JSON of the work items associated with a given process
property headers : Dict[str, str]
method list_process_run_work_items
List work items belonging to a specific process run
Parameters
- process_run_id โ specific process step run to which items belongs to
- process_id โ specific process to which items belongs to
- include_data โ include work item payload and files in the response (default False)
- item_state โ state of work items to return (default all)
method list_process_runs
List of runs related to a process
Parameters
- run_state โ state of runs to return (default all)
- limit โ number of runs to return (default 10)
- process_id โ specific process to which runs belongs to
- Returns: the JSON data of the process runs based on the provided parameters
method list_process_runs_in_workspace
List all process runs in a workspace
Parameters
- run_state โ state of runs to return (default all)
- limit โ number of runs to return (default 10)
- workspace_id โ specific Control Room workspace to which process belongs to
- Returns: the JSON data of the process runs based on the provided parameters
method list_process_work_items
List work items belonging to a process
Parameters
- include_data โ include work item payload and files in the response (default False)
- item_state โ state of work items to return (default all)
- process_id โ specific process to which items belongs to
- Returns: the JSON data of the process runs based on the provided parameters
method list_processes
List all processes in a workspace
- Parameters: workspace_id โ specific Control Room workspace to which process belongs to
- Returns: the JSON data of the process runs based on the provided parameters
method list_run_artifacts
List Robot run artifacts
Parameters
- process_run_id โ id of the process run
- step_run_id โ id of the process step run
- process_id โ specific process to which runs belongs to
- Returns: the response JSON
method process_api
method register_file_upload
method retry_work_item
Retry processing of work item in FAILED state
Parameters
- work_item_id โ ID of the work item to retry
- process_id โ specific process to start
- Returns: the response JSON
method set_apikey
Set Workspace API access key
- Parameters: apikey โ workspace API access key
method set_credentials
Set credentials needed by the Process API
Parameters
- workspace_id โ ID of the Control Room workspace
- process_id โ ID of the Control Room process
- apikey โ workspace API access key
method set_process_id
Set Control Room process ID
- Parameters: process_id โ ID of the Control Room process
method set_workspace_id
Set Control Room workspace ID
- Parameters: workspace_id โ ID of the Control Room workspace
method start_configured_process
Start a Control Room process with the provided configuration
Parameters
- config_type โ type of the start, (ConfigurationType.default)
- extra_info โ data to be sent with the start, for example. work item IDs
- process_id โ specific process to start
- Returns: string of the request response
method start_process
Start a Control Room process
Parameters
- work_items โ input work items for the process (default empty)
- batch โ set to True if sending list of workitems to start each as a separate run
- process_id โ specific process to start
- Returns: JSON of the request response
Table showing different results depending on parameter values.
work_items | batch | result |
---|---|---|
None | False | Trigger a process with empty a work item |
None | True | Error. work_items needs to be a list |
dict | False | Trigger a process with a work item containing payload of a dict |
dict | True | Error. work_items needs to be a list |
list | False | Trigger a process with a work item containing payload of a list |
list | True | Trigger multiple process runs with work items each containing payload of a dict |