REST API Reference
Overview
Tasker provides a comprehensive REST API for handler discovery, task management, and dependency graph analysis. The API supports namespace-based organization and semantic versioning, enabling enterprise-scale workflow management.
Base URL & Mounting
The API is available at the mount point configured in your Rails routes:
# config/routes.rb
Rails.application.routes.draw do
mount Tasker::Engine, at: '/tasker', as: 'tasker'
endBase URL: https://your-app.com/tasker
Authentication
All API endpoints support the same authentication system configured for your Tasker installation:
JWT Authentication
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
https://your-app.com/tasker/handlersCustom Authentication
If you've configured a custom authenticator, use the authentication method appropriate for your setup:
Analytics API
The analytics API provides real-time performance monitoring and bottleneck analysis for your workflow orchestration, introduced in Tasker Engine v1.0.0.
Performance Analytics
Endpoint: GET /tasker/analytics/performance
Description: Get system-wide performance metrics and analytics with 90-second caching.
Example Request:
Example Response:
Bottleneck Analysis
Endpoint: GET /tasker/analytics/bottlenecks
Description: Get bottleneck analysis scoped by task parameters with 2-minute caching.
Query Parameters:
namespace(optional) - Filter by task namespacename(optional) - Filter by task nameversion(optional) - Filter by task versionperiod(optional) - Analysis period in hours (default: 24)
Example Request:
Example Response:
Health Monitoring
Endpoint: GET /tasker/health/ready
Description: Check if the system is ready to accept requests. This endpoint never requires authentication.
Example Request:
Endpoint: GET /tasker/health/live
Description: Check if the system is alive and responding. This endpoint never requires authentication.
Example Request:
Endpoint: GET /tasker/health/status
Description: Get detailed system health status including metrics and database information. May require authorization depending on configuration.
Example Request:
Metrics Export
Endpoint: GET /tasker/metrics
Description: Export system metrics in Prometheus format. Authentication requirements depend on configuration.
Example Request:
Handler Discovery API
The handler discovery API provides comprehensive information about available task handlers, their configurations, and dependency graphs.
List Namespaces
Endpoint: GET /tasker/handlers
Description: Returns all namespaces with handler counts and metadata.
Example Request:
Example Response:
List Handlers in Namespace
Endpoint: GET /tasker/handlers/{namespace}
Description: Returns all handlers available in a specific namespace.
Parameters:
namespace(path) - The namespace name (e.g., "payments", "inventory")
Example Request:
Example Response:
Get Handler Details with Dependency Graph
Endpoint: GET /tasker/handlers/{namespace}/{name}
Description: Returns detailed handler information including step templates, configuration, and dependency graph.
Parameters:
namespace(path) - The namespace namename(path) - The handler nameversion(query, optional) - Specific version to retrieve (defaults to latest)
Example Request:
Example Response:
Task Management API
The task management API supports creating and managing tasks with full namespace and version support.
Create Task
Endpoint: POST /tasker/tasks
Description: Creates a new task with namespace and version support.
Request Body:
Example Request:
Example Response:
List Tasks
Endpoint: GET /tasker/tasks
Description: Lists tasks with optional filtering by namespace, version, and status.
Query Parameters:
namespace(optional) - Filter by namespaceversion(optional) - Filter by versionstatus(optional) - Filter by task statuspage(optional) - Page number for paginationper_page(optional) - Items per page (default: 25, max: 100)
Example Request:
Example Response:
Get Task Details
Endpoint: GET /tasker/tasks/{id}
Description: Returns detailed information about a specific task.
Parameters:
id(path) - The task IDinclude_dependencies(query, optional) - Include dependency graph analysis
Example Request:
Example Response:
Workflow Steps API
The workflow steps API allows detailed management of individual task steps, introduced in v1.0.0.
List Steps by Task
Endpoint: GET /tasker/tasks/{task_id}/workflow_steps
Description: List all workflow steps for a specific task.
Parameters:
task_id(path) - The task ID
Example Request:
Get Step Details
Endpoint: GET /tasker/tasks/{task_id}/workflow_steps/{step_id}
Description: Get detailed information about a specific workflow step.
Parameters:
task_id(path) - The task IDstep_id(path) - The step ID
Example Request:
Update Step
Endpoint: PATCH /tasker/tasks/{task_id}/workflow_steps/{step_id}
Description: Update step configuration (retry limits, inputs).
Request Body:
Example Request:
Cancel Step
Endpoint: DELETE /tasker/tasks/{task_id}/workflow_steps/{step_id}
Description: Cancel a specific workflow step.
Parameters:
task_id(path) - The task IDstep_id(path) - The step ID
Example Request:
Error Handling
The API uses standard HTTP status codes and provides detailed error information:
HTTP Status Codes
200 OK- Successful request201 Created- Resource created successfully400 Bad Request- Invalid request parameters401 Unauthorized- Authentication required403 Forbidden- Insufficient permissions404 Not Found- Resource not found422 Unprocessable Entity- Validation errors500 Internal Server Error- Server error503 Service Unavailable- Analytics unavailable or system health check failed
Error Response Format
Common Error Scenarios
Handler Not Found:
Namespace Not Found:
Authentication Error:
Authorization Error:
Rate Limiting
The API respects standard Rails rate limiting configurations. Consider implementing rate limiting for production deployments:
OpenAPI/Swagger Documentation
Tasker automatically generates OpenAPI documentation for all endpoints. The API documentation is available at:
Swagger UI:
https://your-app.com/tasker/api-docsOpenAPI Spec:
https://your-app.com/tasker/api-docs.json
The documentation includes:
Complete endpoint specifications
Request/response schemas
Authentication requirements
Error response formats
Interactive API testing interface
SDK and Client Libraries
cURL Examples
Complete Handler Discovery Workflow:
JavaScript/Node.js Example
Best Practices
1. Version Management
Always specify versions in production integrations
Use semantic versioning for handler versions
Test version compatibility before deployment
2. Error Handling
Implement proper error handling for all API calls
Use exponential backoff for retryable errors
Log API errors for monitoring and debugging
3. Authentication
Use secure token storage and rotation
Implement proper token refresh mechanisms
Never log authentication tokens
4. Performance
Use pagination for large result sets
Cache handler discovery results when appropriate
Monitor API response times and implement timeouts
5. Monitoring
Track API usage and performance metrics
Set up alerts for error rates and response times
Monitor task creation and completion rates
Integration Examples
CI/CD Pipeline Integration
Monitoring Dashboard Integration
Load Testing
This REST API provides comprehensive access to Tasker's handler discovery and task management capabilities, enabling enterprise-scale workflow orchestration with full namespace and version support.
Last updated