In this tutorial, we’ll explore how to build scalable async task processing with httpied. Whether you’re processing user uploads, sending notifications, or generating reports, httpied makes it simple and reliable.
Getting Started
First, sign up for an httpied account and grab your API key from the dashboard. You’ll need this to authenticate your requests.
Enqueuing Your First Task
The simplest way to enqueue a task is via our REST API:
curl -X POST https://api.httpied.com/v1/enqueue \ -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target": "https://your-api.com/webhook",
"method": "POST",
"body": {
"user_id": 123,
"action": "send_welcome_email"
}
}' httpied will handle the execution, retries, and monitoring automatically.
Using the SDK
For even easier integration, use one of our SDKs. Here’s an example with Python:
from httpied import Client
client = Client(api_key="YOUR_API_KEY")
# Enqueue a simple task
client.enqueue(
target="https://your-api.com/webhook",
method="POST",
body={"user_id": 123, "action": "send_welcome_email"}
)
# Schedule a recurring task
client.schedule(
target="https://your-api.com/daily-report",
cron="0 9 * * *", # Every day at 9 AM
body={"report_type": "daily_summary"}
) Advanced Features
Custom Retry Logic
By default, httpied uses exponential backoff for retries. But you can customize this:
client.enqueue( target="https://your-api.com/critical-task",
method="POST",
body={"data": "important"},
retry_config={
"max_attempts": 10,
"initial_delay": 1000, # ms
"backoff_factor": 2
}
) Timeouts and Headers
Need custom headers or timeouts? No problem:
client.enqueue( target="https://your-api.com/webhook",
method="POST",
headers={
"X-Custom-Header": "value",
"Authorization": "Bearer SECRET"
},
timeout=30000, # 30 seconds
body={"data": "hello"}
) Monitoring and Debugging
Every task gets a unique ID that you can use to track its progress in the dashboard. You’ll see:
- Execution status and timing
- Request/response payloads
- Retry attempts and failures
- Performance metrics
Best Practices
- Idempotency: Make your webhook handlers idempotent. httpied may retry failed tasks.
- Timeouts: Set reasonable timeouts to avoid hanging tasks.
- Error Handling: Return proper HTTP status codes (2xx for success, 4xx/5xx for errors).
- Security: Validate webhook signatures to ensure requests come from httpied.
What’s Next?
Try building your first async task with httpied today. Start with something simple, then scale to millions of executions per month.
Have questions? Reach out to our support team - we’re here to help!