Request Functions
Process HTTP requests in real-time. Handle user interactions, API calls, and webhook processing with instant responses and automatic scaling.
Request functions handle incoming HTTP requests from users. They’re your main API endpoints that process user interactions, validate data, and execute business logic.
When to Use
- User authentication and registration
- Form submissions and data processing
- API endpoints and webhook handlers
- E-commerce transactions and payments
What They Do
- Receive HTTP requests (GET, POST, PUT, DELETE)
- Validate and process input data
- Execute business logic
- Return responses to users
How Request Functions Work
- User makes HTTP request to your function via hub URL
- Hub routes request to your function with authentication
- Function processes request data and executes business logic
- Response returned to user with any Hub enhancements
Request Function Examples
Handle product search with filters and pagination:
Sample URL:
🚀 See Hub Enhancements
🚀 See Hub Enhancements
What Ollie Hub adds:
- ✅ Complete pagination with navigation info
- ✅ Enhanced product data (images, slugs, stock status)
- ✅ Applied filters context for better UX
- ✅ Structured, consistent response format
Handle product search with filters and pagination:
Sample URL:
🚀 See Hub Enhancements
🚀 See Hub Enhancements
What Ollie Hub adds:
- ✅ Complete pagination with navigation info
- ✅ Enhanced product data (images, slugs, stock status)
- ✅ Applied filters context for better UX
- ✅ Structured, consistent response format
Process customer orders with validation:
Sample URL:
🚀 See Hub Enhancements
🚀 See Hub Enhancements
What Ollie Hub adds:
- ✅ Real-time inventory validation
- ✅ Secure payment processing
- ✅ Automatic tax calculation
- ✅ Delivery estimation with carrier info
- ✅ Complete order summary with line items
- ✅ Generated tracking number
Handle user login with JWT tokens:
Sample URL:
🚀 See Hub Enhancements
🚀 See Hub Enhancements
What Ollie Hub adds:
- ✅ Complete user profile with permissions
- ✅ Secure JWT token with expiration
- ✅ Refresh token for seamless re-authentication
- ✅ HTTP-only cookies for security
- ✅ User preferences and settings
- ✅ Last login tracking
Process payment webhooks from Stripe:
Sample URL:
🚀 See Hub Enhancements
🚀 See Hub Enhancements
What Ollie Hub adds:
- ✅ Cryptographic signature verification
- ✅ Automatic order status update (pending → paid)
- ✅ Instant confirmation email to customer
- ✅ Event logging for business analytics
- ✅ Detailed processing confirmation
- ✅ Action audit trail
Best Practices
Validate Early
Always validate input data first. Return helpful error messages for invalid requests.
Handle Errors Gracefully
Use try-catch blocks and return appropriate HTTP status codes and error messages.
Keep Functions Focused
Each function should handle one specific endpoint or operation. Don’t try to do everything.
Use Proper Status Codes
Return correct HTTP status codes: 200 for success, 400 for bad input, 404 for not found, etc.
Next Steps
Best Practices
Essential patterns for building robust functions
Response Functions
Learn to customize responses with analytics and enhancements
Task Functions
Automate workflows with scheduled functions
Pro Tip: Request functions work great with Response functions to add analytics, security headers, and custom transformations automatically. Check out our Best Practices guide for implementation patterns and security tips.