REST – Return data lanes

This component enables the return of processed data from a workflow to external systems via REST API endpoints. It allows workflows to expose their outputs as API responses, making them accessible to other applications and services.

Use a REST – Return data lanes component in a flow

To use a REST – Return data lanes component in your workflow, follow these steps:

  1. Drag the component from the Other section onto your canvas
  2. Connect outputs from upstream processing nodes to the input ports
  3. Configure the REST response settings
  4. The component will make the connected data available as API responses

Inputs

  • Documents – Document objects to return in the response
  • Text – Text content to return in the response
  • Data – Structured data to return in the response
  • Answers – Answer objects to return in the response

Outputs

This component does not have output ports as it serves as an endpoint for returning data to external systems.

Configuration

Response Settings

  • Response Format – Format of the API response
    • Default – “json”
    • Options – json, xml, text
  • Status Code – HTTP status code for successful responses
    • Default – 200
    • Notes – Standard HTTP status codes
  • CORS – Enable Cross-Origin Resource Sharing
    • Default – true
    • Notes – For browser-based clients
  • Authentication – Require authentication for access
    • Default – false
    • Notes – Controls access to the endpoint

Data Transformation

  • Transform – Apply transformations to response data
    • Default – false
    • Notes – For customizing response format
  • Schema – Response schema definition
    • Default – null
    • Notes – For structured response formats
  • Include Metadata – Include document/data metadata
    • Default – true
    • Notes – Provides additional context

Advanced Settings

  • Cache Control – HTTP cache control header
    • Default – “no-cache”
    • Notes – Controls response caching
  • Rate Limiting – Enable rate limiting
    • Default – false
    • Notes – Limits requests per client
  • Custom Headers – Additional HTTP headers
    • Default – {}
    • Notes – For specialized response requirements

Example Usage

Basic JSON Response

This example shows how to configure the component for a basic JSON response:

{
"responseFormat": "json",
"statusCode": 200,
"cors": true,
"includeMetadata": true,
"cacheControl":
"no-cache"
}

Transformed API Response

For a more customized API response with transformations:

{
"responseFormat": "json",
"statusCode": 200,
"cors": true,
"transform": true,
"schema": { "type": "object","properties": { "results": { "type": "array","items": { "type": "object","properties": { "id": { "type": "string" },"content": { "type": "string" },"score": { "type": "number" },"source": { "type": "string" } } } },
"metadata": { "type": "object","properties": { "totalResults": { "type": "number" },"processingTime": { "type": "number" } } } } },
"includeMetadata": true,
"authentication": true,
"rateLimit": { "maxRequests": 100, "window": "1m" },
"customHeaders": { "X-Powered-By": "Aparavi", "X-Response-Time": "{processing_time}ms" }
}

Best Practices

Response Design

  • Design consistent response formats across your APIs
  • Include appropriate metadata for context
  • Use schemas to ensure response structure consistency
  • Consider versioning for evolving APIs

Performance Optimization

  • Enable caching for responses that don’t change frequently
  • Implement rate limiting for public-facing APIs
  • Consider pagination for large result sets
  • Monitor response times and optimize as needed

Troubleshooting

Response Problems

  • Malformed responses – Check schema definitions and transformations
  • Missing data – Verify input connections and data availability
  • CORS errors – Ensure CORS settings match client requirements

Performance Issues

  • Slow responses – Optimize upstream processing or response size
  • High memory usage – Limit response size or implement pagination
  • Rate limiting errors – Adjust rate limits based on client needs
Technical Reference

For detailed technical information, refer to:

  • REST Component Source Code /../../aparavi-connectors/connectors/rest/rest.py