plugNflow

Unified API Integration. Simplified.

Why plugNflow?

Explore plugNflow API

plugNflow

plugNflow is a config-driven, FastAPI-based microservice that provides a unified, flexible API integration gateway for interacting with multiple external APIs through a single dynamically-configurable endpoint. plugNflow enables rapid onboarding of new providers via configuration changes only—no code modifications required.

Table of Contents

  1. Introduction
  2. Core Concepts & Architecture
  3. Deployment Overview
  4. Provider Configuration Schema
  5. Request & Response Flow
  6. Dynamic API Documentation
  7. Caching Mechanisms
  8. Advanced Features
  9. Example Usage Scenarios
  10. Security Considerations
  11. Extensibility & Next Steps
  12. Appendix: Sample Provider Configuration

Introduction

In a constantly evolving API landscape, integrating diverse third-party services can be challenging due to varying authentication schemes, request/response formats, and business-specific logic.

plugNflow simplifies this by providing:

This allows organizations to seamlessly add or update API integrations by modifying configuration rather than code, accelerating development while maintaining robustness and observability.

Core Concepts & Architecture

Deployment Overview

Provider Configuration Schema

Provider configs conform to a strongly typed Pydantic schema composed of:

Environment variables referenced as OSENV[VAR_NAME] in configs are resolved at runtime, keeping secrets secure.

Request & Response Flow

  1. Client sends a POST request to /api specifying:
    • "provider": provider name as configured
    • "transaction_payload": list of input data
  2. plugNflow validates the request as per provider schema.
  3. If present and configured, the transaction_id is used to fetch additional payload data from internal DB or services.
  4. Pre-processing hooks (local or external UDFs) transform the request.
  5. plugNflow authenticates to external APIs as configured, managing token caching.
  6. External API calls are made with constructed payloads.
  7. Post-processing runs to map and transform external responses.
  8. The unified response is assembled and returned to client.
  9. Caching reduces redundant external calls as configured.

Dynamic API Documentation

Caching Mechanisms

1. plugNflow Provider-Level Response Caching

2. External Service-Level Caching

Advanced Features

User-Defined Functions (UDFs)

Hierarchical Provider Configuration

Aggregator Providers

Example Usage Scenarios

Scenario 1: Basic Provider Call

Send a request to /api specifying provider child_service_example and payload:

{
  "provider": "child_service_example",
  "transaction_payload": [
    {
      "goods_desc": "cillum tempor quis elit2",
      "hs_code": "68056334",
      "transaction_id": "render_txn_1"
    }
  ]
}

Scenario 2: Transaction ID Lookup

Request includes a transaction_id; plugNflow queries internal DB (transaction_data collection) to build or enrich payload before sending to external APIs.

Scenario 3: Hierarchical Calls

Provider list_vessels returns vessel IDs; client calls provide_vessel_history_info with a parent_id referencing an ID from the previous response. plugNflow auto-fetches cached parent data for child request construction.

Scenario 4: Aggregator Provider

Security Considerations

Extensibility & Next Steps

Appendix: Sample Provider Configuration

{
  "name": "child_service_example",
  "description": "plugNflow example child service",
  "is_aggregator": false,
  "operations": {
    "internal": {
      "db_operations": {
        "transactionSource": [],
        "preProcess": [],
        "postProcess": []
      },
      "hashkeys": [],
      "main_response_schema": {
        "success_status": "OPEN",
        "default_status": "OPEN",
        "schema": {
          "title": "SnpFetchDug",
          "type": "object",
          "properties": {
            "id": {
              "title": "Id",
              "type": "string"
            },
            "parentId": {
              "title": "Id",
              "type": "string"
            },
            "service": {
              "title": "service",
              "type": "string"
            },
            "status": {
              "$ref": "#/definitions/Status"
            },
            "result": {
              "$ref": "#/definitions/SnpDugResult"
            }
          },
          "required": [
            "id",
            "status"
          ]
        }
      }
    },
    "external": {
      "Authentication": {
        "authenticationMethod": "Default",
        "httpMethod": "POST",
        "endpoint": "https://sam.ihsmarkit.com/",
        "slug": "sso/oauth2/access_token",
        "headers": {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        "requestPayload": {
          "type": "urlencoded",
          "params": {
            "client_id": "OSENV[plugNflow_EXAMPLE_CHILD_ID]",
            "client_secret": "OSENV[plugNflow_EXAMPLE_CHILD_SECRET]",
            "grant_type": "client_credentials",
            "scope": "openid"
          }
        },
        "responsePayload": {
          "token": "<access_token>"
        },
        "cacheConfig": {
          "enabled": true,
          "expiry": 0
        }
      },
      "Core": {
        "httpMethod": "POST",
        "endpoint": "https://www.dualusegoods.ihsmarkit.com/",
        "slug": "V2/dualusegoodsclassifier",
        "headers": {
          "Authorization": "<token>",
          "accept": "application/json",
          "Content-Type": "application/json"
        },
        "requestPayload": {
          "type": "json",
          "json": {
            "Input_Text": [
              "{hs_code}||{goods_description_compliance}||{goods_desc}"
            ],
            "Regions_Filter": "{region_code}||{region_options}"
          }
        },
        "responsePayload": {
          "type": "json",
          "params": {
            "input_description": "{Input_Description}",
            "dual_usage_code": "{Dual_Usage_Code}",
            "reason_for_match": "{Reason_for_Match}",
            "es_primary_keyword": "{ES_Primary_Keyword}",
            "dual_usage_flag": "{Dual_Usage_Flag}",
            "dual_usage_flag_prob": "{Dual_Usage_Flag_Prob}",
            "commodity_details": [
              {
                "commodity_source_pdf": "{Commodity_Details.Commodity_Source_PDF}",
                "commodity_source": "{Commodity_Details.Commodity_Source}",
                "country": "{Commodity_Details.Country}",
                "regional_code": "{Commodity_Details.Regional_Code}",
                "commodity_category_description": "{Commodity_Details.Commodity_Category_Description}"
              }
            ]
          }
        }
      }
    }
  }
}