Skip to main content

HTTP Request Node

The HTTP Request node enables making HTTP requests to external APIs and web services with full control over headers, methods, and request body.

Overview

This versatile node supports all standard HTTP methods (GET, POST, PUT, DELETE, PATCH) with comprehensive configuration options for headers, authentication, and request/response handling.

Configuration

Required Parameters

ParameterTypeDescription
urlStringTarget URL for the request
methodStringHTTP method (GET, POST, PUT, DELETE, etc.)

Optional Parameters

ParameterTypeDefaultDescription
headersObjectCustom headers for the request
bodyString/ObjectnullRequest body (for POST, PUT, PATCH)
timeoutNumber30000Request timeout in milliseconds
followRedirectsBooleantrueFollow HTTP redirects
maxRedirectsNumber5Maximum number of redirects
authObjectnullAuthentication configuration
retriesNumber0Number of retry attempts

Input Schema

{
"url": "https://api.example.com/users",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token123",
"User-Agent": "AxonOS/1.0"
},
"body": {
"name": "John Doe",
"email": "john@example.com"
},
"timeout": 10000,
"retries": 2
}

Output Schema

{
"status": 200,
"statusText": "OK",
"headers": {
"content-type": "application/json",
"content-length": "156"
},
"data": {
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"created_at": "2024-01-15T10:30:00Z"
},
"config": {
"url": "https://api.example.com/users",
"method": "POST"
},
"duration": 245
}

Authentication

Bearer Token

{
"auth": {
"type": "bearer",
"token": "your-access-token"
}
}

Basic Authentication

{
"auth": {
"type": "basic",
"username": "user",
"password": "pass"
}
}

API Key

{
"headers": {
"X-API-Key": "your-api-key"
}
}

Examples

GET Request

// Input
{
"url": "https://jsonplaceholder.typicode.com/posts/1",
"method": "GET",
"headers": {
"Accept": "application/json"
}
}

// Output
{
"status": 200,
"data": {
"userId": 1,
"id": 1,
"title": "sunt aut facere...",
"body": "quia et suscipit..."
}
}

POST with JSON Body

// Input
{
"url": "https://httpbin.org/post",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": {
"title": "New Post",
"content": "This is a new post"
}
}

File Upload (Multipart)

// Input
{
"url": "https://httpbin.org/post",
"method": "POST",
"headers": {
"Content-Type": "multipart/form-data"
},
"body": {
"file": "@/path/to/file.pdf",
"description": "Document upload"
}
}

GraphQL Query

// Input
{
"url": "https://api.github.com/graphql",
"method": "POST",
"headers": {
"Authorization": "Bearer ghp_xxxx",
"Content-Type": "application/json"
},
"body": {
"query": "{ viewer { login } }"
}
}

Error Handling

The node handles various error scenarios:

Status CodeDescriptionAction
400-499Client errorsReturns error with response body
500-599Server errorsRetries if configured, then returns error
TimeoutRequest timeoutRetries if configured
NetworkConnection failedRetries if configured

Error Response Format

{
"error": true,
"status": 404,
"statusText": "Not Found",
"message": "Resource not found",
"data": {
"error": "User with ID 999 does not exist"
}
}

Advanced Features

Custom Retry Logic

{
"retries": 3,
"retryDelay": 1000,
"retryOn": [408, 429, 500, 502, 503, 504]
}

Request Interceptors

{
"interceptors": {
"request": "function(config) { /* modify request */ }",
"response": "function(response) { /* process response */ }"
}
}

Proxy Configuration

{
"proxy": {
"host": "proxy.company.com",
"port": 8080,
"auth": {
"username": "proxy-user",
"password": "proxy-pass"
}
}
}

Best Practices

  1. Timeout Settings: Always set appropriate timeouts for external requests
  2. Error Handling: Implement proper error handling for all status codes
  3. Rate Limiting: Respect API rate limits and implement backoff strategies
  4. Security: Store credentials securely, use HTTPS when possible
  5. Logging: Log requests for debugging but avoid sensitive data
  6. Caching: Cache responses when appropriate to reduce API calls

Performance Tips

  • Use connection pooling for multiple requests to the same host
  • Implement request caching for frequently accessed data
  • Set appropriate timeout values to avoid hanging requests
  • Use streaming for large file downloads
  • Compress request bodies when supported
  • GraphQL Client - Specialized GraphQL requests
  • Webhook Receiver - Handle incoming webhooks
  • Rate Limiter - Control request frequency

Troubleshooting

Common Issues

  1. CORS Errors

    • Add appropriate CORS headers
    • Use proxy for cross-domain requests
  2. SSL Certificate Issues

    • Verify certificate validity
    • Configure certificate validation
  3. Authentication Failures

    • Check token expiration
    • Verify authentication method
  4. Request Size Limits

    • Check API payload limits
    • Use streaming for large files

Need Help?