Laminar
  • Laminar
  • Platform
    • Overview
    • Getting Started
    • Advanced
      • Configurations
      • HTTP Request Batching
      • Workflow Exit Points
      • Invoke Secondary Workflows
      • Managing Notifications
    • Best Practices
    • Keywords
      • lam.resolveThenExecute
      • lam.exit
      • lam.execute
      • lam.asyncExecute
      • lam.httpRequest
      • lam.httpRequests
  • Concepts
    • Workflows
      • Global Workflow Object
    • Flows
      • Flow Types
        • HTTP Request
        • Data Transformations
      • Flow Runs
      • Supported Languages
    • API Key
    • Configurations
    • API
      • Reference
        • Workspaces
          • Issues
          • Users
          • Invitations
            • Decline
            • Accept
            • Received
            • Created
          • Workflows
          • Flows
          • Auth credentials
          • Api keys
          • Api descriptions
        • Workflow
          • Execute
            • External
          • Flows
          • Executions
        • Users
        • Flows
          • Runs
          • Versions
          • Stats
          • Recent runs
          • Read
        • Configurations
          • Properties
          • Flow credentials
          • Workspace
        • Auth credentials
        • Api descriptions
        • Api keys
        • Transform
          • Test
        • Lami
          • Public
          • Direct
        • Auth
          • Signin
          • Register
          • Refresh
          • Me
          • Users
            • Password
    • Changelog
  • External Links
    • Book a Demo
    • Playground
    • Sign In
  • Specification
Powered by GitBook
On this page
  • Overview
  • Source and Destination APIs
  • Direct HTTP Requests
  • Single Request
  • JavaScript
  • JQ
  • Parallel Requests
  • JavaScript
  • JQ
  • Request Components
  • Using Configuration Properties
  • Choosing an Approach
  • Related

Was this helpful?

  1. Platform
  2. Integration Design

API Requests

Making API requests in Laminar

Last updated 3 months ago

Was this helpful?

Overview

Laminar provides multiple ways to make API requests:

  1. Using source/destination APIs in flows

  2. Using the httpRequest keyword directly in transformations

Source and Destination APIs

Each flow can specify:

  • A source API to fetch data from at the start of the flow

  • A destination API to send transformed data to at the end of the flow

These are configured using and authenticated through the .

Responses and data transformations are stored in the during execution, and individual API request inputs and outputs are stored in .

Direct HTTP Requests

Single Request

Use lam.httpRequest to make a single HTTP request within a transformation:

JavaScript

(payload) => {
  const { input } = payload;
  
  return {
    "lam.httpRequest": {
      "method": "POST",
      "url": "{{props.baseUrl}}/orders",
      "headers": {
        "Authorization": "Bearer {{props.apiKey}}",
        "Content-Type": "application/json"
      },
      "body": {
        "orderId": input.orderId,
        "items": input.items
      }
    }
  };
}

JQ

.input |
{
  "lam.httpRequest": {
    "method": "POST",
    "url": "{{props.baseUrl}}/orders",
    "headers": {
      "Authorization": "Bearer {{props.apiKey}}",
      "Content-Type": "application/json"
    },
    "body": {
      "orderId": .orderId,
      "items": .items
    }
  }
}

Parallel Requests

Use lam.httpRequests to make multiple requests in parallel:

JavaScript

(payload) => {
  const { input } = payload;
  
  return {
    "lam.httpRequests": input.items.map(item => ({
      "method": "GET",
      "url": "{{props.baseUrl}}/inventory/{{itemId}}",
      "pathParams": {
        "itemId": item.id
      }
    }))
  };
}

JQ

.input.items |
{
  "lam.httpRequests": map({
    "method": "GET",
    "url": "{{props.baseUrl}}/inventory/{{itemId}}",
    "pathParams": {
      "itemId": .id
    }
  })
}

Request Components

Component
Description
Required

method

HTTP method (GET, POST, PUT, DELETE)

Yes

url

Request URL with optional templates

Yes

pathParams

URL path parameters

No

headers

HTTP headers

No

body

Request body

No

Using Configuration Properties

Reference configuration properties in URLs and headers using {{props.propertyName}} syntax:

{
  "url": "{{props.baseUrl}}/api/{{version}}/orders",
  "headers": {
    "Authorization": "Bearer {{props.apiKey}}"
  }
}

Choosing an Approach

  • Use Source/Destination APIs when:

    • You have a fixed API endpoint for input/output

    • You want to reuse API configurations

    • You need clear separation of data flow

  • Use HTTP Request Keywords when:

    • You need dynamic endpoint selection

    • You want to make requests mid-flow

    • You need to make parallel requests

Related

API Descriptions
Configuration Store
Global Workflow Object
Flow Runs
HTTP Request Keyword
HTTP Requests Keyword
API Descriptions
Configurations