WarpBuild LogoWarpBuild Docs
Utility Nodes

HTTP Node

Send HTTP requests with full control over methods, headers, and body content

HTTP Node

The HTTP node enables your workflows to communicate with external APIs and services through HTTP requests. It supports all standard HTTP methods with comprehensive request and response handling.

Configuration

Input Schema

FieldTypeRequiredDefaultDescription
methodstringNo"GET"HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
urlstringYes-Target URL (must be valid URL format)
headersRecord<string, string>No{}Custom headers for the request
bodyJsonValueNo-Request body (JSON, string, or null)

Output Schema

FieldTypeDescription
okbooleanWhether the request was successful
statusnumberHTTP status code
statusTextstringHTTP status message
headersRecord<string, string>Response headers
bodyJsonValueResponse body (parsed based on content-type)
error{message: string, code?: string}Error details (if request failed)

Basic Usage

GET Request

- id: fetch_user
  type: http
  input:
    method: "GET"
    url: "https://api.example.com/users/123"
    headers:
      Authorization: "Bearer {{ token }}"

POST Request

- id: create_user
  type: http
  input:
    method: "POST"
    url: "https://api.example.com/users"
    headers:
      Content-Type: "application/json"
      Authorization: "Bearer {{ token }}"
    body:
      name: "{{ user.name }}"
      email: "{{ user.email }}"

Advanced Examples

- id: api_call
  type: http
  input:
    method: "POST"
    url: "{{ api_endpoint }}"
    headers:
      Authorization: "Bearer {{ api_token }}"
      X-API-Version: "2023-01"
    body:
      data: "{{ processed_data }}"

- id: check_response
  type: condition
  input:
    if: "{{ api_call.output.ok }}"
    then: ["process_success"]
    else: ["handle_error"]

Perfect for robust API integrations with proper error handling and response validation.

- id: upload_file
  type: http
  input:
    method: "POST"
    url: "https://upload.example.com/files"
    headers:
      Authorization: "Bearer {{ upload_token }}"
      Content-Type: "multipart/form-data"
    body: "{{ file_data }}"

Essential for file upload workflows, document processing, and media management systems.

- id: api_with_retry
  type: loop
  input:
    forN: 3
  configuration:
    mode: "sequential"

- id: try_request
  type: http
  input:
    method: "GET"
    url: "{{ unreliable_endpoint }}"
    headers:
      Authorization: "Bearer {{ token }}"

- id: exponential_backoff
  type: suspend
  input:
    type: "duration"
    duration: "{{ 'PT' + (loop.iteration * 2) + 'S' }}"

Critical for reliable communication with external services that may experience temporary failures.

Response Handling

The HTTP node automatically handles different content types:

  • JSON: Automatically parsed into JavaScript objects
  • Text: Returned as strings
  • Binary: Encoded as base64 strings
  • Empty: Returns null

Error Handling

When requests fail, the node returns:

{
  "ok": false,
  "status": 0,
  "statusText": "Network Error",
  "headers": {},
  "error": {
    "message": "Connection timeout",
    "code": "NETWORK_ERROR"
  }
}

Best Practices

Authentication

Always store sensitive tokens securely:

headers:
  Authorization: "Bearer {{ secrets.api_token }}"

Retry Logic

Combine with control nodes for robust error handling:

- id: api_with_retry
  type: loop
  input:
    forN: 3
  configuration:
    mode: "sequential"

- id: try_request
  type: http
  input:
    url: "{{ api_url }}"
    
- id: check_success
  type: condition
  input:
    if: "{{ try_request.output.ok }}"
    then: ["success_handler"]
    else: ["retry_or_fail"]

Rate Limiting

Use suspend nodes to respect API rate limits:

- id: api_call
  type: http
  input:
    url: "{{ api_url }}"

- id: rate_limit_delay
  type: suspend
  input:
    type: "duration"
    duration: "PT1S"  # Wait 1 second between calls

Last updated on