Monetize360

Call External API

Connect to an external service or website

Call External API

Connect to an external service or website to send or receive data. You can use this to integrate with other apps, send data to third-party services, or fetch information from external sources.

Technical Name: CallExternalApiFunc

Properties

  • Execution Mode: SYNC
  • Type: NATIVE
  • Category: External API
  • Function ID: 8f7a2ea8-6d8a-4f2b-b8f6-9f6b6d8a2ea8

Input Schema

Required Parameters

ParameterTypeDescription
connectionIdstring (uuid)Connection containing URL, method, auth, and defaults

Optional Parameters

ParameterTypeDescription
headersobjectAdditional headers (overrides connection headers)
queryParamsobjectAdditional query params (overrides connection params)
bodystringJSON template with {variable} placeholders
bodyVariablesobjectVariables for {placeholder} substitution in body
timeoutSecondsintegerRequest timeout in seconds (default: 30, max: 300)

Input Example

{
  "connectionId": "api-connection-uuid",
  "headers": {
    "X-Custom-Header": "value",
    "Accept": "application/json"
  },
  "queryParams": {
    "page": 1,
    "limit": 50
  },
  "body": "{\"customerId\": \"{customerId}\", \"orderAmount\": {amount}}",
  "bodyVariables": {
    "customerId": "cust-123",
    "amount": 250.00
  },
  "timeoutSeconds": 60
}

Connection Configuration

API connections store reusable configuration:

{
  "name": "Payment Gateway API",
  "url": "https://api.payment-gateway.com/v1",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer ${API_KEY}",
    "Content-Type": "application/json"
  },
  "timeout": 30
}

Output Schema

FieldTypeDescription
successbooleanTrue if HTTP status 200-299
statusCodeintegerHTTP response status code
headersobjectResponse headers
responseBodyanyResponse body (parsed as JSON if possible)

Output Example

{
  "success": true,
  "statusCode": 200,
  "headers": {
    "content-type": "application/json",
    "x-rate-limit-remaining": "99"
  },
  "responseBody": {
    "transactionId": "txn-789",
    "status": "completed",
    "amount": 250.00,
    "currency": "USD",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Use Cases

Payment Processing

Integrate with payment gateways:

Start → ValidatePayment → CallExternalApi(ProcessPayment) → UpdateOrder → End

Data Synchronization

Sync data with external systems:

{
  "connectionId": "crm-api-connection",
  "body": "{\"name\": \"{customerName}\", \"email\": \"{email}\"}",
  "bodyVariables": {
    "customerName": "${fetchCustomer.output.name}",
    "email": "${fetchCustomer.output.email}"
  }
}

Webhook Callbacks

Send data to webhook endpoints:

{
  "connectionId": "webhook-connection",
  "body": "${prepareWebhookPayload.output.payload}"
}

HTTP Methods

Supported HTTP methods:

  • GET: Retrieve data
  • POST: Create resources
  • PUT: Update resources (full)
  • PATCH: Update resources (partial)
  • DELETE: Remove resources
  • HEAD: Get headers only
  • OPTIONS: Get supported methods

Authentication

Bearer Token

{
  "headers": {
    "Authorization": "Bearer ${API_TOKEN}"
  }
}

API Key

{
  "headers": {
    "X-API-Key": "${API_KEY}"
  }
}

Basic Auth

{
  "headers": {
    "Authorization": "Basic ${BASE64_CREDENTIALS}"
  }
}

Error Handling

HTTP Errors

{
  "success": false,
  "statusCode": 404,
  "headers": {...},
  "responseBody": {
    "error": "Resource not found",
    "code": "NOT_FOUND"
  }
}

Retry Logic

Implement retry with exponential backoff:

Start → CallExternalApi → CheckStatus → Retry(if failed) → End

Best Practices

  1. Timeout Configuration: Set appropriate timeouts for different APIs
  2. Error Handling: Always check success field and status code
  3. Rate Limiting: Implement rate limiting for external APIs
  4. Secrets Management: Store API keys in environment variables
  5. Response Validation: Validate response structure before processing
  6. Logging: Log requests and responses for debugging
  7. Idempotency: Use idempotency keys for critical operations

Workflow Example

Start
  → FetchOrder
  → PreparePayload
  → CallExternalApi(Payment Gateway)
  → CheckResponse
  → UpdateOrderStatus
  → EmailNotification
→ End

Limitations

  • Maximum request size: 10MB
  • Maximum response size: 50MB
  • Timeout range: 1-300 seconds
  • Maximum headers: 50 per request