HTTP Worker
The HTTP Worker is a powerful, general-purpose worker that can make HTTP requests to any endpoint. It supports all HTTP methods, multiple authentication types, retry policies, and response validation.
Features
- All HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
- Multiple authentication types (Basic, Bearer, API Key, OAuth2)
- Request body support (JSON, XML, Form, Multipart, Binary)
- Path and query parameters
- Custom headers and cookies
- Retry policies with exponential backoff
- Response validation (status codes, body content, JSONPath)
- Proxy support
- Client certificates (mTLS)
- SSL/TLS configuration
Use Cases
| Scenario | Example |
|---|---|
| Webhook Triggers | Call external APIs on schedule |
| Health Checks | Monitor external service availability |
| Data Sync | Fetch data from REST APIs periodically |
| Notifications | Send HTTP-based notifications (Slack, Teams, Discord) |
| Report Generation | Trigger report generation endpoints |
| Cache Warming | Pre-populate caches by calling endpoints |
Job Data Schema
When creating a job with the HTTP Worker, you provide configuration through the Job Data JSON:
{
"url": "https://api.example.com/users/{userId}",
"method": "POST",
"headers": {
"X-Custom-Header": "value"
},
"queryParameters": {
"include": "details"
},
"pathParameters": {
"userId": "123"
},
"body": {
"type": "Json",
"content": {
"name": "John Doe",
"email": "[email protected]"
}
},
"authentication": {
"type": "Bearer",
"credential": "your-api-token"
},
"timeoutSeconds": 30,
"retryPolicy": {
"maxRetries": 3,
"initialDelayMs": 1000,
"backoffMultiplier": 2.0
},
"validation": {
"expectedStatusCodes": [200, 201],
"bodyContains": "success"
}
}
Configuration Reference
Main Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | ✅ | - | Target URL. Supports path parameters like {userId} |
method | enum | - | GET | HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS |
headers | object | - | - | Custom request headers as key-value pairs |
queryParameters | object | - | - | Query string parameters to append to URL |
pathParameters | object | - | - | Values to replace URL placeholders like {id} |
body | object | - | - | Request body configuration |
authentication | object | - | - | Authentication settings |
timeoutSeconds | number | - | 30 | Request timeout in seconds |
followRedirects | boolean | - | true | Whether to follow HTTP redirects |
maxRedirects | number | - | 5 | Maximum redirects to follow |
ignoreSslErrors | boolean | - | false | Skip SSL certificate validation (use with caution!) |
retryPolicy | object | - | - | Retry configuration for failed requests |
validation | object | - | - | Response validation rules |
proxy | object | - | - | HTTP proxy configuration |
clientCertificate | object | - | - | Client certificate for mTLS |
userAgent | string | - | Milvaion-HttpWorker/1.0 | Custom User-Agent header |
cookies | object | - | - | Cookies to send with request |
Request Body Configuration
{
"body": {
"type": "Json",
"content": { "key": "value" },
"encoding": "utf-8",
"contentTypeOverride": "application/json"
}
}
| Property | Type | Default | Description |
|---|---|---|---|
type | enum | Json | Body type: Json, Xml, Text, FormUrlEncoded, Multipart, Binary, GraphQL, Html, None |
content | any | - | Body content (JSON object, string, or base64 for binary) |
formData | object | - | Form fields for FormUrlEncoded or Multipart |
files | array | - | File uploads for Multipart requests |
encoding | string | utf-8 | Character encoding |
contentTypeOverride | string | - | Override default Content-Type header |
Multipart File Upload
{
"body": {
"type": "Multipart",
"formData": {
"description": "My file upload"
},
"files": [
{
"fieldName": "file",
"fileName": "document.pdf",
"contentBase64": "JVBERi0xLjQK...",
"contentType": "application/pdf"
}
]
}
}
Authentication Types
Bearer Token
{
"authentication": {
"type": "Bearer",
"credential": "your-jwt-token"
}
}
Basic Authentication
{
"authentication": {
"type": "Basic",
"credential": "username",
"secret": "password"
}
}
API Key
{
"authentication": {
"type": "ApiKey",
"credential": "your-api-key",
"keyName": "X-API-Key",
"keyLocation": "Header"
}
}
keyLocation | Description |
|---|---|
Header | Send as HTTP header (default) |
Query | Send as query parameter |
Cookie | Send as cookie |
OAuth2 (Client Credentials)
{
"authentication": {
"type": "OAuth2",
"tokenUrl": "https://auth.example.com/oauth/token",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"scopes": ["read", "write"],
"grantType": "ClientCredentials"
}
}
grantType | Description |
|---|---|
ClientCredentials | Server-to-server authentication (default) |
Password | Resource owner password credentials |
AuthorizationCode | Authorization code flow |
RefreshToken | Refresh an existing token |
Retry Policy
{
"retryPolicy": {
"maxRetries": 3,
"initialDelayMs": 1000,
"maxDelayMs": 30000,
"backoffMultiplier": 2.0,
"retryOnStatusCodes": [408, 429, 500, 502, 503, 504],
"retryOnTimeout": true,
"retryOnConnectionError": true
}
}
| Property | Default | Description |
|---|---|---|
maxRetries | 3 | Maximum retry attempts |
initialDelayMs | 1000 | Initial delay between retries (ms) |
maxDelayMs | 30000 | Maximum delay between retries (ms) |
backoffMultiplier | 2.0 | Multiplier for exponential backoff |
retryOnStatusCodes | [408, 429, 500, 502, 503, 504] | Status codes that trigger retry |
retryOnTimeout | true | Retry on request timeout |
retryOnConnectionError | true | Retry on connection failures |
Response Validation
{
"validation": {
"expectedStatusCodes": [200, 201, 204],
"bodyContains": "success",
"bodyNotContains": "error",
"jsonPathExpression": "$.data.id",
"jsonPathExpectedValue": "123",
"requiredHeaders": {
"Content-Type": "application/json"
},
"maxResponseSizeBytes": 1048576
}
}
| Property | Description |
|---|---|
expectedStatusCodes | Array of acceptable status codes |
bodyContains | Fail if body doesn't contain this text |
bodyNotContains | Fail if body contains this text |
jsonPathExpression | JSONPath to extract value (e.g., $.data.id) |
jsonPathExpectedValue | Expected value at JSONPath location |
requiredHeaders | Headers that must be present in response |
maxResponseSizeBytes | Maximum allowed response size |
Proxy Configuration
{
"proxy": {
"url": "http://proxy.company.com:8080",
"username": "proxyuser",
"password": "proxypass",
"bypassList": ["localhost", "*.internal.com"]
}
}
Client Certificate (mTLS)
{
"clientCertificate": {
"certificateBase64": "MIIE...",
"password": "cert-password"
}
}
Or using Windows certificate store:
{
"clientCertificate": {
"thumbprint": "1234567890ABCDEF...",
"storeLocation": "CurrentUser"
}
}