Script Execution
Section titled “Script Execution”Execute scripts as HTTP endpoints via POST requests. Each script becomes an addressable endpoint that accepts arbitrary JSON payloads, enabling you to expose server-side logic over HTTP without provisioning dedicated infrastructure.
POST /{path}
Section titled “POST /{path}”Execute a script at the given path. The request body is passed to the script as input, and the script’s return value is sent back as the HTTP response.
Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes | Script path (supports Next.js-style routing) |
Request Body
Section titled “Request Body”The POST variant accepts an arbitrary JSON body, which is forwarded to the script. The body schema is open — no fixed fields are required.
{ "event": "order.created", "orderId": "ord_8f3a2b", "amount": 4200, "currency": "EUR"}Response
Section titled “Response”{ "ok": true, "received": { "event": "order.created", "orderId": "ord_8f3a2b" }}{ "error": "VALIDATION_ERROR", "message": "Invalid JSON in request body"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid request data | The request body failed validation | Check request body format and try again |
{ "error": "SCRIPT_NOT_FOUND", "message": "Script not found at path"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
SCRIPT_NOT_FOUND | Script file not found | No script exists at the specified path | Verify the script path and ensure the file exists |
{ "error": "SCRIPT_EXECUTION_ERROR", "message": "Runtime error in script"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
SCRIPT_EXECUTION_ERROR | Script execution failed | An error occurred while executing the script | Check script logs for detailed error information |
SDK Usage
Section titled “SDK Usage”The SDK exposes script execution through client.exec.execution.execute, which takes the script path as a single positional string argument. Internally it issues a GET request to the script path; the POST variant documented above additionally accepts a request body for passing data to the script.
curl -X POST "https://myapp-cnt7k2-exec-1.eu.containers.hoody.icu/scripts/handle-webhook" \ -H "Content-Type: application/json" \ -d '{ "event": "order.created", "orderId": "ord_8f3a2b", "amount": 4200, "currency": "EUR" }'import { HoodyClient } from "hoody-sdk";
const client = new HoodyClient({ token: process.env.HOODY_TOKEN,});
// Issues a GET to the script path.const result = await client.exec.execution.execute("scripts/handle-webhook");
// For the POST variant documented above, send a request body via fetch:const response = await fetch( `https://myapp-cnt7k2-exec-1.eu.containers.hoody.icu/scripts/handle-webhook`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ event: "order.created", orderId: "ord_8f3a2b", amount: 4200, currency: "EUR", }), });const data = await response.json();