Skip to main content
The HTTP Request command (Command Type: 1001) enables you to make HTTP/HTTPS requests to APIs and web services. This command is essential for fetching data from REST APIs, web services, and other HTTP-based endpoints.

Overview

The HTTP Request command provides functionality for:
  • Making GET, POST, PUT, DELETE, and other HTTP method requests
  • Configuring request headers, query parameters, and request bodies
  • Handling authentication and authorization
  • Managing timeouts and error handling
  • Processing HTTP responses

Command Type

Command Type ID: 1001

Parameters

ParameterTypeDescriptionRequired
urlstringThe target URL for the HTTP requestYes
methodstringHTTP method (GET, POST, PUT, DELETE, PATCH, etc.)No (defaults to GET)
headersobjectHTTP headers to include in the requestNo
bodystring/objectRequest body for POST/PUT requestsNo
timeoutnumberMaximum wait time in millisecondsNo
queryParamsobjectURL query parametersNo
followRedirectsbooleanWhether to follow HTTP redirectsNo (defaults to true)

Usage Examples

Basic GET Request

{
  "command": "http-request",
  "params": {
    "url": "https://api.example.com/data",
    "method": "GET",
    "timeout": 10000
  }
}

POST Request with Body

{
  "command": "http-request",
  "params": {
    "url": "https://api.example.com/data",
    "method": "POST",
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "name": "Example",
      "value": 123
    },
    "timeout": 15000
  }
}

GET Request with Query Parameters

{
  "command": "http-request",
  "params": {
    "url": "https://api.example.com/search",
    "method": "GET",
    "queryParams": {
      "q": "search term",
      "limit": 10,
      "offset": 0
    }
  }
}

Request with Authentication

{
  "command": "http-request",
  "params": {
    "url": "https://api.example.com/protected",
    "method": "GET",
    "headers": {
      "Authorization": "Bearer %{API_TOKEN}",
      "X-API-Key": "%{API_KEY}"
    }
  }
}

Request with Project Variables

{
  "command": "http-request",
  "params": {
    "url": "https://api.example.com/data?project=@{PROJECT_ID}&run=@{RUN_ID}",
    "method": "GET",
    "headers": {
      "X-Request-ID": "@{RUN_ID}",
      "X-Timestamp": "@{START_TIMESTAMP}"
    }
  }
}

Variable Support

The HTTP Request command supports variable interpolation in:
  • URLs: Use @{VARIABLE} in URLs
  • Headers: Use @{VARIABLE} or %{SECRET} in header values
  • Query Parameters: Use variables in query parameter values
  • Request Body: Use variables in request body content

Variable Types

  • Project Variables: @{PROJECT_ID}, @{RUN_ID}, @{START_TIMESTAMP}
  • Secrets: %{API_KEY}, %{API_TOKEN}, %{PROXY_PASSWORD}
  • Session Variables: #{UUID} for session tracking
  • Event Variables: ${event_id} for event-specific values

Response Handling

The HTTP Request command returns the HTTP response which can be used by subsequent commands:

Response Structure

{
  "status": 200,
  "statusText": "OK",
  "headers": {},
  "body": {},
  "data": {}
}

Using Response Data

The response from HTTP Request can be used as input for subsequent commands:
{
  "command": "json-path",
  "params": {
    "jsonPath": "$.data.items[*].id",
    "input": "@{PREVIOUS_OUTPUT}"
  }
}

Error Handling

The HTTP Request command handles various error scenarios:
  • Timeout Errors: Returns error if request exceeds timeout
  • Network Errors: Handles connection failures
  • HTTP Errors: Returns error status for non-2xx responses
  • Invalid URLs: Validates URL format before request

Best Practices

  • Use Secrets for Credentials: Always use %{SECRET_NAME} for API keys and passwords
  • Set Appropriate Timeouts: Configure timeouts based on expected response times (default: 30 seconds)
  • Handle Errors: Implement error handling for failed requests
  • Use Project Variables: Leverage @{PROJECT_ID} and @{RUN_ID} for tracking
  • Validate Responses: Always validate response structure before processing
  • Use HTTPS: Prefer HTTPS URLs for secure communication
  • Set Content-Type: Explicitly set Content-Type header for POST/PUT requests

Common Use Cases

  • API Integration: Fetch data from REST APIs
  • Web Scraping: Retrieve HTML content from web pages
  • Data Synchronization: Pull data from external services
  • Authentication: Handle API authentication flows
  • Webhook Processing: Send data to webhook endpoints

Troubleshooting

Request Timeout

If requests are timing out:
  • Increase the timeout parameter value
  • Check network connectivity
  • Verify the target server is accessible

Authentication Errors

If authentication fails:
  • Verify secrets are correctly configured
  • Check API key/token format
  • Ensure headers are properly formatted

Invalid Response

If response structure is unexpected:
  • Check response status code
  • Verify Content-Type header
  • Validate response body format