Intermediate -- 1 hour

Build a Protocol Adapter

Use Translation Studio to transform a discovered legacy protocol into a modern REST or gRPC API, complete with auto-generated SDKs in Python, Go, and TypeScript.

Prerequisites

  • A discovered protocol specification (see Discover a Legacy Protocol)
  • QBITEL Bridge AI engine running with Translation Studio enabled
  • Node.js 20+ or Python 3.11+ (for testing the generated SDK)
1

Select the Protocol Specification

Start by listing your discovered protocol specifications and selecting the one you want to translate into a modern API.

# List all discovered protocol specs
curl http://localhost:8000/api/v1/marketplace/protocols/search | jq '.protocols[] | {id, name, confidence}'

# Output
{ "id": "proto_leg9100", "name": "LEGACY-9100", "confidence": 0.94 }
{ "id": "proto_scada01", "name": "SCADA-MODBUS-EXT", "confidence": 0.89 }
{ "id": "proto_fin3270", "name": "FIN-3270-CUSTOM", "confidence": 0.91 }
2

Configure Translation Settings

Tell Translation Studio what kind of API to generate. You can choose REST (OpenAPI 3.1), gRPC (Protocol Buffers), or both. Configure naming conventions, authentication requirements, and rate limiting.

# Create a translation job
curl -X POST http://localhost:8000/api/v1/translation/translate \
  -H "Content-Type: application/json" \
  -d '{
    "protocol_id": "proto_leg9100",
    "output_formats": ["openapi", "grpc"],
    "options": {
      "api_prefix": "/api/v1/legacy9100",
      "naming_convention": "snake_case",
      "authentication": "bearer_token",
      "rate_limiting": {
        "requests_per_minute": 1000
      },
      "generate_sdks": ["python", "go", "typescript"],
      "include_tests": true,
      "include_docs": true
    }
  }'
3

Review the Generated API

Translation Studio maps each discovered message type to REST endpoints. It infers request/response schemas from field layouts and creates proper HTTP methods based on the protocol state machine.

# Download the generated OpenAPI spec
curl http://localhost:8000/api/v1/translation/protocols \
  -o legacy9100-openapi.yaml

# Generated endpoints (example)
# POST /api/v1/legacy9100/sessions      -> HANDSHAKE_INIT
# GET  /api/v1/legacy9100/sessions/{id}  -> STATUS_QUERY
# POST /api/v1/legacy9100/data           -> DATA_TRANSFER
# DELETE /api/v1/legacy9100/sessions/{id} -> DISCONNECT

How it works: The Protocol Bridge sits between your modern API consumers and the legacy system. Incoming REST/gRPC calls are translated back into the original protocol wire format in real time by the Rust data plane.

4

Use the Generated SDK

Download and install the auto-generated SDK for your preferred language. Each SDK includes typed models, error handling, retry logic, and full documentation.

# Download the Python SDK
curl http://localhost:8000/api/v1/translation/statistics \
  -o legacy9100-sdk-python.tar.gz
tar xzf legacy9100-sdk-python.tar.gz
pip install ./legacy9100-sdk-python

Then use the SDK in your application code:

# Python example
from legacy9100_sdk import Legacy9100Client

client = Legacy9100Client(
    base_url="http://localhost:8000",
    api_key="your-api-key"
)

# Create a session (sends HANDSHAKE_INIT to the legacy system)
session = client.sessions.create(
    version=2,
    timeout_seconds=30
)

# Transfer data (sends DATA_TRANSFER message)
response = client.data.send(
    session_id=session.id,
    payload=b"transaction-record-001"
)

print(f"Transfer status: {response.status}")
print(f"Bytes transferred: {response.bytes_sent}")

# Close the session
client.sessions.delete(session.id)
5

Deploy the Protocol Bridge

Deploy the protocol bridge as a sidecar or standalone service. It handles the real-time translation between your modern API and the legacy wire protocol.

# Deploy the bridge for the translated protocol
curl -X POST http://localhost:8000/api/v1/translation/translate \
  -H "Content-Type: application/json" \
  -d '{
    "translation_id": "tr_abc123",
    "mode": "bridge",
    "listen_port": 8090,
    "upstream_host": "10.0.1.50",
    "upstream_port": 9100,
    "health_check_interval": "10s"
  }'

Production tip: In Kubernetes, deploy the protocol bridge as a sidecar container alongside your application pod. See the Deploy to Kubernetes tutorial for details.

Turn Any Legacy Protocol into a Modern API

Translation Studio generates production-ready APIs and SDKs from discovered protocol specifications.