A serverless REST API endpoint built with Zoho Catalyst that sleeps for a specified duration.
This is a lightweight function-as-a-service (FaaS) application demonstrating a basic HTTP endpoint on the Zoho Catalyst platform. It accepts either a seconds or milliseconds parameter and pauses execution for that duration before returning a response.
sleep/
├── .catalystrc # Local Catalyst configuration
├── catalyst.json # Project manifest
└── functions/
└── sleep_function/
├── index.py # Handler implementation
├── catalyst-config.json # Function configuration
└── requirements.txt # Python dependencies
- Platform: Zoho Catalyst
- Runtime: Python 3.9
- Function Type: BasicIO (HTTP request/response handler)
Endpoint: /sleep_function
Method: GET
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
seconds |
number | * | Number of seconds to sleep (0-30) |
milliseconds |
number | * | Number of milliseconds to sleep (0-30000) |
* Provide one or the other, not both. Do NOT exceed 30 seconds or 30000 milliseconds
Example Requests:
# Using seconds
curl "https://sleep-900403292.development/sleep_function?seconds=5"
# Using milliseconds
curl "https://sleep-900403292.development/sleep_function?milliseconds=500"Success Response:
{
"success": true,
"message": "Slept for 5 seconds",
"slept_for": 5,
"unit": "seconds"
}{
"success": true,
"message": "Slept for 500 milliseconds",
"slept_for": 500,
"unit": "milliseconds"
}Error Responses:
Missing parameter:
{"error": "seconds or milliseconds parameter is required", "usage": "?seconds=NUMBER or ?milliseconds=NUMBER"}Both parameters provided:
{"error": "Provide either seconds or milliseconds, not both", "usage": "?seconds=NUMBER or ?milliseconds=NUMBER"}Invalid type:
{"error": "Invalid seconds parameter. Must be a number.", "provided": "abc"}Out of range:
{"error": "Maximum sleep time is 30 seconds", "provided": 60}Negative value:
{"error": "Seconds must be non-negative", "provided": -5}zcatalyst-sdk==1.0.3- Zoho Catalyst Python SDK
- Python 3.9+
- Zoho Catalyst CLI
pip install -r functions/sleep_function/requirements.txtcatalyst deployThe function is configured via catalyst-config.json:
- Runtime: Python 3.9
- Type: BasicIO
- Entry Point:
index.py
[Specify your license]