AST 1209 http trigger service
Create HTTP Service to Trigger Deployment Runs
Create an HTTP service that allows triggering Prefect Deployment "quick runs" on-demand via API calls.
Key details:
- Build HTTP API service (FastAPI or similar)
- Accept POST requests to trigger deployment runs
- Endpoint:
POST /deployments/{deployment-name}/runsor similar - Use Prefect Python client to create deployment runs
- Static bearer token authentication for now
- Initially: trigger runs using Deployment's config only (no parameter overrides)
- Validate deployment name exists before triggering
- Error handling: log failures and return error response for invalid deployment names
- Return run ID and status in response
- Log all trigger requests for auditing
- Deploy as container alongside Prefect server
- Note: Support single deployment per request only (no batch triggering)
Example(s):
Request:
POST /deployments/customer-a.adp-to-costpoint/runs
Authorization: Bearer {static-token}
Success response:
{
"run_id": "abc-123-def",
"deployment_name": "customer-a.adp-to-costpoint",
"status": "scheduled"
}
Error response (invalid deployment):
{
"error": "Deployment not found",
"deployment_name": "invalid-deployment"
}