### Generate Example n8n Credential from Schema Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Generates an example credential configuration based on a provided credential schema. It takes a schema object and the credential type name as input, outputting a YAML-formatted example suitable for configuration files. ```python from credential_schemas import generate_credential_example, get_schema import yaml # Load a schema schema = get_schema('telegramApi') # Generate example configuration example = generate_credential_example(schema, 'telegramApi') # Print as YAML for credentials.yaml print(yaml.dump(example, default_flow_style=False)) # Output: # environments: # production: # name: Production Environment # postfix: Prod # credentials: # telegramapi: # type: telegramApi # name: Example telegramApi Credential # data: # accessToken: example_string_value # baseUrl: example_string_value ``` -------------------------------- ### Example n8n Credentials Configuration Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md This YAML structure represents an example configuration for n8n credentials, organized by environment (production and development). It demonstrates the expected format for defining credential types, names, and their specific data fields, including placeholders for sensitive information and comments explaining each field's purpose. ```yaml environments: production: name: Production Environment postfix: Prod credentials: telegramapi: type: telegramApi name: Example telegramApi Credential data: # accessToken: The Telegram Bot API access token accessToken: example_string_value # baseUrl: The base URL for the Telegram API baseUrl: example_string_value # additionalParameters: Any additional parameters to include in requests additionalParameters: {} development: name: Development Environment postfix: Dev credentials: telegramapi: type: telegramApi name: Example telegramApi Credential data: # accessToken: The Telegram Bot API access token accessToken: example_string_value # baseUrl: The base URL for the Telegram API baseUrl: example_string_value # additionalParameters: Any additional parameters to include in requests additionalParameters: {} ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md This command installs the required Python packages for the n8n Porter tool, as listed in the `requirements.txt` file. Ensure you have Python 3.6 or higher installed before running this command. ```bash pip install -r requirements.txt ``` -------------------------------- ### n8n Credential Schema Management Tool (Bash) Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt A command-line tool for managing n8n credential schemas using Python. It allows downloading schemas from a server, viewing example configurations, and generating credential examples for `credentials.yaml`. ```bash # Run the credential schema tool python credential_schemas.py # Menu options: # 1. Download credential schemas from server # - Select server from servers.yaml # - Downloads schemas for known types # - Saves to credential_schemas/ directory # # 2. View example credential configurations # - Select credential type # - Displays YAML example # - Copy directly into credentials.yaml # # 3. Exit ``` -------------------------------- ### Example n8n Server Configuration Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md This YAML configuration defines the n8n server instances that the n8n Porter tool will interact with. It includes details such as server name, URL, API key, and a flag indicating whether the instance supports projects. This file is crucial for setting up different environments for migration. ```yaml servers: local: name: "Local n8n" url: "http://localhost:5678" api_key: "your-api-key" supports_projects: true production: name: "Production n8n" url: "https://n8n.your-domain.com" api_key: "your-api-key" supports_projects: true ``` -------------------------------- ### Run Credential Schema Management Script Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md This command initiates the credential schema management feature of the n8n Porter tool. It allows users to download credential schemas from an n8n instance or view example credential configurations based on these schemas. The output is formatted for the `credentials.yaml` file. ```bash python credential_schemas.py ``` -------------------------------- ### Get All Projects from n8n Enterprise Instance Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Retrieves a list of all projects from an n8n Enterprise instance using the provided API key and base URL. It iterates through the returned projects and prints their names and IDs. No external dependencies beyond the 'main' module are required. ```python from main import get_all_projects api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" projects = get_all_projects(api_key, base_url) for project in projects: print(f"Project: {project['name']} (ID: {project['id']})") # Expected output: # Project: Marketing Automation (ID: abc123) # Project: Customer Support (ID: def456) ``` -------------------------------- ### Get All Projects Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Retrieve all available projects from an n8n Enterprise instance. This is useful for understanding the project structure before migrating workflows. ```APIDOC ## Get All Projects ### Description Retrieve all available projects from an n8n Enterprise instance. ### Method GET ### Endpoint `/projects` (Assumed, as the Python function `get_all_projects` likely interacts with an endpoint like this) ### Parameters #### Query Parameters - **api_key** (string) - Required - Your n8n API key for authentication. - **base_url** (string) - Required - The base URL of your n8n instance (e.g., "https://n8n.example.com"). ### Request Example ```python from main import get_all_projects api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" projects = get_all_projects(api_key, base_url) for project in projects: print(f"Project: {project['name']} (ID: {project['id']})") ``` ### Response #### Success Response (200) - **projects** (array) - A list of project objects. - **id** (string) - The unique identifier for the project. - **name** (string) - The name of the project. #### Response Example ```json [ { "id": "abc123", "name": "Marketing Automation" }, { "id": "def456", "name": "Customer Support" } ] ``` ``` -------------------------------- ### Get Workflows Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Retrieve workflows from a specific project or the entire n8n instance. This is useful for backing up or analyzing existing workflows. ```APIDOC ## Get Workflows ### Description Retrieve workflows from a specific project or the entire n8n instance. ### Method GET ### Endpoint `/workflows` (Assumed, as the Python function `get_workflows` likely interacts with an endpoint like this) ### Parameters #### Query Parameters - **api_key** (string) - Required - Your n8n API key for authentication. - **base_url** (string) - Required - The base URL of your n8n instance (e.g., "https://n8n.example.com"). - **project_id** (string) - Optional - The ID of the project to retrieve workflows from. If `null` or omitted, all workflows from the instance are returned. ### Request Example ```python from main import get_workflows api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" project_id = "abc123" # Or None for all workflows workflows = get_workflows(api_key, base_url, project_id) for workflow in workflows: print(f"Workflow: {workflow['name']}") print(f" ID: {workflow['id']}") print(f" Active: {workflow.get('active', False)}") print(f" Nodes: {len(workflow.get('nodes', []))}") ``` ### Response #### Success Response (200) - **workflows** (array) - A list of workflow objects. - **id** (string) - The unique identifier for the workflow. - **name** (string) - The name of the workflow. - **active** (boolean) - Indicates if the workflow is currently active. - **nodes** (array) - A list of nodes within the workflow. #### Response Example ```json [ { "id": "xyz789", "name": "My Workflow", "active": true, "nodes": [ { "id": "node1", "type": "telegram:send" }, { "id": "node2", "type": "set" } ] } ] ``` ``` -------------------------------- ### Get Environment Replacements Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Extract environment-specific string replacements from a configuration, used for modifying workflow settings during migration. ```APIDOC ## Get Environment Replacements ### Description Extract string replacements for environment-specific values from a configuration file (e.g., `credentials.yaml`). This is crucial for adapting workflows to different environments. ### Method (N/A - This is a programmatic function, not a direct API endpoint call) ### Endpoint (N/A) ### Parameters (These are parameters for the Python function `get_environment_replacements`) #### Input Data - **creds_config** (object) - Required - The loaded configuration object (e.g., from a YAML file) containing environment-specific settings. - **env_type** (string) - Required - The target environment (e.g., 'production', 'staging') for which to retrieve replacements. ### Request Example ```python from main import get_environment_replacements import yaml with open('credentials.yaml') as f: creds_config = yaml.safe_load(f) # Get replacements for production environment replacements = get_environment_replacements(creds_config, 'production') print("String Replacements:") for old_value, new_value in replacements.items(): print(f" '{old_value}' → '{new_value}'") ``` ### Response (N/A - This function returns a dictionary, not a direct API response) #### Output Example ``` String Replacements: 'http://127.0.0.1' → 'https://api.example.com' 'feedback-channel-dev' → 'feedback-channel' ``` ``` -------------------------------- ### Get n8n Credential Schemas Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Downloads credential schemas from an n8n instance for known credential types and saves them locally. It also provides functionality to list all downloaded schemas. Requires API key and base URL. ```python from credential_schemas import get_credential_schemas, list_available_schemas api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" # Download schemas for known credential types get_credential_schemas(api_key, base_url) # Schemas saved to: credential_schemas/telegramApi.json # credential_schemas/postgres.json # credential_schemas/openAiApi.json # List downloaded schemas available = list_available_schemas() print("Available schemas:", available) ``` -------------------------------- ### Get Environment-Specific String Replacements Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Extracts environment-specific string replacements from a YAML configuration file. It takes the loaded credentials configuration and the target environment type as input, returning a dictionary where keys are the old string values and values are their corresponding new values for the specified environment. ```python from main import get_environment_replacements import yaml with open('credentials.yaml') as f: creds_config = yaml.safe_load(f) # Get replacements for production environment replacements = get_environment_replacements(creds_config, 'production') print("String Replacements:") for old_value, new_value in replacements.items(): print(f" '{old_value}' → '{new_value}'") # Example output: # 'http://127.0.0.1' → 'https://api.example.com' # 'feedback-channel-dev' → 'feedback-channel' ``` -------------------------------- ### Get Workflows from n8n Instance or Project Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Retrieves workflows from an n8n instance. It can fetch all workflows if no project_id is provided, or workflows associated with a specific project. The function returns a list of workflow objects, each containing details like name, ID, active status, and node count. ```python from main import get_workflows api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" project_id = "abc123" # Or None for all workflows workflows = get_workflows(api_key, base_url, project_id) for workflow in workflows: print(f"Workflow: {workflow['name']}") print(f" ID: {workflow['id']}") print(f" Active: {workflow.get('active', False)}") print(f" Nodes: {len(workflow.get('nodes', []))}") ``` -------------------------------- ### Save and Get n8n Resource Mapping Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Tracks created n8n resources like workflows and credentials for safe cleanup operations. It involves saving individual resources using their type, ID, and name, and later retrieving all tracked resources for a given instance URL. This is crucial for automated cleanup processes. ```python from main import save_resource_mapping, get_instance_resources base_url = "https://n8n.example.com" # Save resource when creating save_resource_mapping( instance_url=base_url, resource_type='workflows', resource_id='wf_123', resource_name='Customer Onboarding' ) save_resource_mapping( instance_url=base_url, resource_type='credentials', resource_id='cred_456', resource_name='Telegram Bot Prod' ) # Later, retrieve all tracked resources resources = get_instance_resources(base_url) print("Tracked Workflows:", resources['workflows']) print("Tracked Credentials:", resources['credentials']) # Output: # Tracked Workflows: {'wf_123': 'Customer Onboarding', ...} # Tracked Credentials: {'cred_456': 'Telegram Bot Prod', ...} ``` -------------------------------- ### Create Workflow Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Create a workflow in an n8n instance, supporting automatic credential mapping and environment-specific string replacements. ```APIDOC ## Create Workflow ### Description Create a workflow with automatic credential mapping and string replacements. This function is designed for migrating workflows between environments. ### Method POST ### Endpoint `/workflows` (Assumed, as the Python function `create_workflow` likely interacts with an endpoint like this) ### Parameters #### Query Parameters - **api_key** (string) - Required - Your n8n API key for authentication. - **base_url** (string) - Required - The base URL of your n8n instance (e.g., "https://n8n.example.com"). - **project_id** (string) - Optional - The ID of the project to create the workflow in. Required if `supports_projects` is true and the instance uses projects. #### Request Body - **workflow_data** (object) - Required - The JSON object representing the workflow to be created (typically loaded from a backup file). - **credential_mapping** (object) - Optional - A mapping of old credential names to new credential IDs (e.g., `{"Telegram Bot": "cred_new_123"}`). - **env_type** (string) - Optional - The target environment type (e.g., 'production', 'staging') to apply environment-specific settings. - **supports_projects** (boolean) - Optional - Indicates if the target n8n instance supports projects. Defaults to `false`. - **env_postfix** (string) - Optional - A postfix to append to the workflow name or other resources for environment specificity. ### Request Example ```python from main import create_workflow import json api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" project_id = "abc123" # Load workflow from backup with open('data/backup_prod_20231115/workflows/My_Workflow_xyz789.json') as f: workflow_data = json.load(f) # Credential mapping from old names to new IDs credential_mapping = { "Telegram Bot": "cred_new_123", "postgres_main": "cred_new_456" } # Create workflow with environment settings new_workflow_id = create_workflow( api_key=api_key, base_url=base_url, workflow_data=workflow_data, project_id=project_id, credential_mapping=credential_mapping, env_type='production', supports_projects=True, env_postfix="Prod" ) if new_workflow_id: print(f"Created workflow with ID: {new_workflow_id}") ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier of the newly created workflow. #### Response Example ```json { "id": "new_workflow_789" } ``` ``` -------------------------------- ### Create Credential with Environment Postfix Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Creates a new credential in an n8n instance, appending an environment-specific postfix to its name. It requires the n8n API key, base URL, credential data, credential type, and the environment postfix. The function returns the ID of the newly created credential. ```python from main import create_credential api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" credential_data = { "name": "Telegram Bot", "data": { "accessToken": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz", "baseUrl": "https://api.telegram.org" } } credential_id = create_credential( api_key, base_url, credential_data, credential_type="telegramApi", env_postfix="Prod" ) if credential_id: print(f"Created credential with ID: {credential_id}") # Credential name becomes "Telegram Bot Prod" ``` -------------------------------- ### n8n Porter Main Migration Script (Bash) Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Launches the main n8n workflow migration tool interactively via Python script. Provides options for backing up, restoring, and deleting tracked resources across n8n servers and projects. ```bash # Start the migration tool python main.py # Menu options: # 1. Backup workflows # - Select source server # - Select project (if Enterprise) # - Creates timestamped backup directory # # 2. Restore workflows # - Select target server # - Select target project # - Choose environment (production/development) # - Select backup to restore # - Creates credentials and workflows # # 3. Delete tracked resources # - Select server # - Deletes only tool-created resources # - Safe operation (tracked resources only) # # 4. Exit ``` -------------------------------- ### Python Script Execution for n8n-porter Tool Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md Executes the main script for the n8n-porter tool. This command-line interface allows users to interact with the tool's functionalities for managing n8n backups and restores. ```bash python main.py ``` -------------------------------- ### Create Workflow with Credential Mapping and Replacements Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Creates a workflow in n8n, supporting automatic credential mapping and environment-specific string replacements. It requires the workflow data, project ID, a mapping of old credential names to new IDs, the environment type, and an optional environment postfix. The function returns the ID of the newly created workflow. ```python from main import create_workflow import json api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" project_id = "abc123" # Load workflow from backup with open('data/backup_prod_20231115/workflows/My_Workflow_xyz789.json') as f: workflow_data = json.load(f) # Credential mapping from old names to new IDs credential_mapping = { "Telegram Bot": "cred_new_123", "postgres_main": "cred_new_456" } # Create workflow with environment settings new_workflow_id = create_workflow( api_key=api_key, base_url=base_url, workflow_data=workflow_data, project_id=project_id, credential_mapping=credential_mapping, env_type='production', supports_projects=True, env_postfix="Prod" ) if new_workflow_id: print(f"Created workflow with ID: {new_workflow_id}") ``` -------------------------------- ### Create Credential Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Create a new credential in an n8n instance. This function allows for environment-specific credential naming using an `env_postfix`. ```APIDOC ## Create Credential ### Description Create a new credential in an n8n instance with optional environment-specific postfixes. ### Method POST ### Endpoint `/credentials` (Assumed, as the Python function `create_credential` likely interacts with an endpoint like this) ### Parameters #### Query Parameters - **api_key** (string) - Required - Your n8n API key for authentication. - **base_url** (string) - Required - The base URL of your n8n instance (e.g., "https://n8n.example.com"). #### Request Body - **credential_data** (object) - Required - The data for the credential. - **name** (string) - Required - The base name of the credential. - **data** (object) - Required - The actual credential details (e.g., API keys, tokens). - **credential_type** (string) - Required - The type of credential to create (e.g., "telegramApi"). - **env_postfix** (string) - Optional - A postfix to append to the credential name for environment specificity (e.g., "Prod"). ### Request Example ```python from main import create_credential api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" credential_data = { "name": "Telegram Bot", "data": { "accessToken": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz", "baseUrl": "https://api.telegram.org" } } credential_id = create_credential( api_key, base_url, credential_data, credential_type="telegramApi", env_postfix="Prod" ) if credential_id: print(f"Created credential with ID: {credential_id}") # Credential name becomes "Telegram Bot Prod" ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier of the newly created credential. #### Response Example ```json { "id": "cred_new_123" } ``` ``` -------------------------------- ### n8n Credentials and Replacements Configuration (YAML) Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Manages environment-specific credentials (e.g., Telegram, PostgreSQL) and string replacements for service URLs and channel names across different deployment environments. ```yaml environments: production: name: "Production Environment" postfix: "Prod" credentials: telegram_bot: type: telegramApi name: "Telegram Bot" data: accessToken: "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz" baseUrl: "https://api.telegram.org" postgres_main: type: postgres name: "Main Database" data: host: "db.example.com" database: "production_db" user: "prod_user" password: "secure_password" port: 5432 ssl: "require" development: name: "Development Environment" postfix: "Dev" credentials: telegram_bot: type: telegramApi name: "Telegram Bot" data: accessToken: "9876543210:ZYXwvuTSRqponMLKjihGFEdcba" baseUrl: "https://api.telegram.org" postgres_main: type: postgres name: "Main Database" data: host: "localhost" database: "dev_db" user: "dev_user" password: "dev_password" port: 5432 ssl: "disable" replacements: web_service_url: description: "The base URL of the web service" values: production: "https://api.example.com" development: "http://127.0.0.1:3000" staging: "https://staging.api.example.com" telegram_channel: description: "Telegram channel for notifications" values: production: "production-alerts" development: "dev-alerts" ``` -------------------------------- ### Perform Backup of n8n Workflows Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Backs up all workflows from a specified n8n project to local storage. It requires API credentials, base URL, and project details. The output is organized into a timestamped directory structure. ```python from main import perform_backup api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" server_name = "production" project = { 'id': 'abc123', 'name': 'Marketing Automation' } perform_backup( api_key=api_key, base_url=base_url, project=project, supports_projects=True, server_name=server_name ) # Creates: data/backup_production_Marketing_Automation_20231115_143022/ # ├── workflows/ # │ ├── Welcome_Email_abc123.json # │ ├── Lead_Scoring_def456.json # │ └── ... ``` -------------------------------- ### n8n Server Connections Configuration (YAML) Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Defines n8n server connections including API keys, URLs, and project support status for different environments like production, development, and local. ```yaml servers: production: name: "Production Server" api_key: "n8n_api_key_xxxxx" url: "https://n8n.example.com" supports_projects: true development: name: "Development Server" api_key: "n8n_api_key_yyyyy" url: "https://n8n-dev.example.com" supports_projects: true local: name: "Local Instance" api_key: "n8n_api_key_zzzzz" url: "http://localhost:5678" supports_projects: false # Community Edition ``` -------------------------------- ### YAML Configuration for n8n Credentials and Replacements Source: https://github.com/dataprospectors-at/n8n-porter/blob/main/README.md Defines environment-specific credentials and string replacements for n8n workflows. Manages distinct credential sets and values for different deployment environments like production and development, including optional postfixes for credential names and a flexible system for environment-specific string values. ```yaml environments: production: name: "Production Environment" postfix: "Prod" # Optional postfix for credential names credentials: telegram_bot: type: telegramApi name: "Telegram Bot" data: accessToken: "your-prod-token" baseUrl: "https://api.telegram.org" development: name: "Development Environment" postfix: "Dev" credentials: telegram_bot: type: telegramApi name: "Telegram Bot" data: accessToken: "your-dev-token" baseUrl: "https://api.telegram.org" # String replacements between environments replacements: web_service_url: description: "The base URL of the web service" values: production: "https://api.example.com" development: "http://127.0.0.1" staging: "https://staging.api.example.com" ``` -------------------------------- ### Analyze Workflow Dependencies and Determine Creation Order Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Analyzes workflow dependencies to determine the correct creation order, preventing issues with inter-workflow dependencies. It involves loading workflow JSON files, building a dependency graph, and then calculating the topological sort for the creation sequence. Handles potential circular dependencies by raising a ValueError. ```python from main import analyze_workflow_dependencies, build_dependency_graph, get_workflow_order import json from pathlib import Path # Load workflows workflows = [] for workflow_file in Path('data/backup_prod/workflows').glob('*.json'): with open(workflow_file) as f: workflows.append(json.load(f)) # Build dependency graph dependency_graph = build_dependency_graph(workflows) print("Dependency Graph:") for workflow_id, deps in dependency_graph.items(): print(f" {workflow_id} depends on: {deps}") # Get correct creation order try: creation_order = get_workflow_order(dependency_graph) print("\nCreation Order:") for i, workflow_id in enumerate(creation_order, 1): print(f" {i}. {workflow_id}") except ValueError as e: print(f"Error: {e}") # Circular dependency detected ``` -------------------------------- ### Analyze Workflow Dependencies Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Analyze the dependencies between workflows to determine the correct order for creation or migration, preventing issues with inter-workflow references. ```APIDOC ## Analyze Workflow Dependencies ### Description Detect workflow dependencies to determine the correct creation order. This helps in migrating workflows that rely on each other. ### Method (N/A - This is a programmatic analysis function, not a direct API endpoint call) ### Endpoint (N/A) ### Parameters (These are parameters for the Python functions `build_dependency_graph` and `get_workflow_order`) #### Input Data - **workflows** (array of objects) - A list of workflow objects, typically loaded from backup files. #### Functions - **build_dependency_graph(workflows)**: Takes a list of workflow objects and returns a dictionary representing the dependency graph. - **get_workflow_order(dependency_graph)**: Takes the dependency graph and returns a list of workflow IDs in the correct creation order. ### Request Example ```python from main import analyze_workflow_dependencies, build_dependency_graph, get_workflow_order import json from pathlib import Path # Load workflows workflows = [] for workflow_file in Path('data/backup_prod/workflows').glob('*.json'): with open(workflow_file) as f: workflows.append(json.load(f)) # Build dependency graph dependency_graph = build_dependency_graph(workflows) print("Dependency Graph:") for workflow_id, deps in dependency_graph.items(): print(f" {workflow_id} depends on: {deps}") # Get correct creation order try: creation_order = get_workflow_order(dependency_graph) print("\nCreation Order:") for i, workflow_id in enumerate(creation_order, 1): print(f" {i}. {workflow_id}") except ValueError as e: print(f"Error: {e}") # Circular dependency detected ``` ### Response (N/A - This function provides programmatic output, not a direct API response) #### Output Example ``` Dependency Graph: workflow_A depends on: ['workflow_B'] workflow_B depends on: [] workflow_C depends on: ['workflow_A', 'workflow_B'] Creation Order: 1. workflow_B 2. workflow_A 3. workflow_C ``` ``` -------------------------------- ### Perform Restore of n8n Workflows Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Restores workflows to a target n8n environment, supporting credential mapping and string replacements. This function requires API credentials, the target base URL, and project details. It can apply development credentials and maintain dependency order. ```python from main import perform_restore api_key = "n8n_api_key_xxxxx" base_url = "https://n8n-dev.example.com" target_project = { 'id': 'xyz789', 'name': 'Marketing Automation Dev' } # Restores workflows with: # - Development credentials # - String replacements applied # - Dependency order maintained perform_restore( api_key=api_key, base_url=base_url, project=target_project, supports_projects=True, target_env='development' ) # Output shows: # - Credentials created with "Dev" postfix # - Workflows created in dependency order # - String replacements applied (prod URLs → dev URLs) ``` -------------------------------- ### Test n8n API Connection Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Verifies connectivity to an n8n instance using provided API key and base URL before proceeding with operations. It returns a boolean indicating success or failure, allowing for conditional execution. ```python from main import test_api_connection api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" if test_api_connection(api_key, base_url): print("Connection successful, proceeding with operations") else: print("Connection failed, check API key and server URL") ``` -------------------------------- ### Delete n8n Workflow and Credential Source: https://context7.com/dataprospectors-at/n8n-porter/llms.txt Removes specified workflows and credentials from an n8n instance, ensuring automatic cleanup of associated resource mappings. It requires API key, base URL, and the resource IDs. Error handling is included for deletion failures. ```python from main import delete_workflow, delete_credential api_key = "n8n_api_key_xxxxx" base_url = "https://n8n.example.com" try: # Delete workflow delete_workflow(api_key, base_url, 'wf_123') print("Workflow deleted successfully") # Delete credential delete_credential(api_key, base_url, 'cred_456') print("Credential deleted successfully") except Exception as e: print(f"Deletion failed: {e}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.