TuCloudAPI: Difference between revisions
TuCloudAPI reference (regenerated: + simulatecall) |
getpbxs: account-scoped selector (all roles) |
||
| Line 21: | Line 21: | ||
* [[TuCloudAPI getappsrecords]] — List this PBX's selectable records for an app (the record picker), via the tenant-scoped lookup function. | * [[TuCloudAPI getappsrecords]] — List this PBX's selectable records for an app (the record picker), via the tenant-scoped lookup function. | ||
* [[TuCloudAPI getactiondata]] — List the selectable value options for an action (the value picker), for select/checkbox action types, via the tenant-scoped lookup function. | * [[TuCloudAPI getactiondata]] — List the selectable value options for an action (the value picker), for select/checkbox action types, via the tenant-scoped lookup function. | ||
* [[TuCloudAPI getpbxs]] — List the PBXs the calling ukey | * [[TuCloudAPI getpbxs]] — List the PBXs assigned to the calling ukey's account (post-login selector; show only if >1). | ||
* [[TuCloudAPI addtask]] — Create a scheduled task (status forced 0). | * [[TuCloudAPI addtask]] — Create a scheduled task (status forced 0). | ||
* [[TuCloudAPI updatetask]] — Edit a task (does not change status). | * [[TuCloudAPI updatetask]] — Edit a task (does not change status). | ||
Revision as of 18:48, 1 August 2026
Overview
TuCloudAPI is the REST API to manage tucloud (the multi-tenant PBX, a.k.a. futurepbx). HTTPS, GET, JSON. Base URL:
https://tucloudapi.7kas.com:9087/tucloud?func=NAME&ukey=YOUR_KEY&pbx=PBX_NAME
Authentication & tenant
Every call needs an API key (ukey). The tasks functions also need pbx — the PBX name (e.g. tucall). The (ukey, pbx) pair is the tenant boundary: the server resolves the PBX name to its id and verifies the key owns it (SuperRoot any PBX; Operator its own root; Client its own account). It never trusts a numeric tenant from the caller.
Response format
Always HTTP 200. The tasks functions always return a JSON envelope: success {"ok":true, ...}, empty {"ok":true,"rows":[]}, error {"ok":false,"code":...,"message":...} (codes: missing_pbx, unknown_pbx, forbidden, invalid_param, not_found, db_error, server_busy). IDs are exposed as _id. Base/legacy functions return their data object directly, or {} on error/empty.
Functions
Scheduled tasks (Tareas programadas)
- TuCloudAPI gettasks — List scheduled tasks (tareas programadas) for the PBX, with schedule + status labels and step counts.
- TuCloudAPI gettask — Get one scheduled task and its ordered steps.
- TuCloudAPI gettasksteps — Get the ordered steps of a task (tenant-checked).
- TuCloudAPI gettasklog — Get the last 100 execution-log rows for a task (read-only history), newest first.
- TuCloudAPI getapps — List the 8 target entity types ("apps") a task step can act on.
- TuCloudAPI getappactions — List the configurable fields ("actions") for an app — the dynamic-form catalog (field, type 0-5, data, metadata).
- TuCloudAPI getappsrecords — List this PBX's selectable records for an app (the record picker), via the tenant-scoped lookup function.
- TuCloudAPI getactiondata — List the selectable value options for an action (the value picker), for select/checkbox action types, via the tenant-scoped lookup function.
- TuCloudAPI getpbxs — List the PBXs assigned to the calling ukey's account (post-login selector; show only if >1).
- TuCloudAPI addtask — Create a scheduled task (status forced 0).
- TuCloudAPI updatetask — Edit a task (does not change status).
- TuCloudAPI deletetask — Delete a task (DB cascade of steps/log + crontab removal via the operator trigger).
- TuCloudAPI addtaskstep — Append a step to a task.
- TuCloudAPI updatetaskstep — Change a step's value (blank -> NULL).
- TuCloudAPI deletetaskstep — Remove a step.
Tucloud PBX
- TuCloudAPI getpbxloclog — Tucloud PBX IVR/locution DTMF key-press log for a period.
Meta / discovery
- TuCloudAPI help — Lists the API functions available to the role of the calling ukey, with each function's description, parameters (meaning, optional/default), an example call and the response format.
Diagnostics
- TuCloudAPI helloworld — Health check / connectivity test.
Administration
- TuCloudAPI SetDebugLevel — Sets the runtime debug/log verbosity level.
- TuCloudAPI ReloadUsersKeys — Hot-reloads the API keys from the database without restarting the service.
- TuCloudAPI resetinternalkey — Regenerates the non-showable internal API key for an account.
Account management (inherited)
- TuCloudAPI getaccountcodeid — Lists (id, accountcode) pairs of the accounts under the caller.
- TuCloudAPI getaccountcodedata — Returns full account profile rows (view_voip_users_api) for the caller's accounts.
- TuCloudAPI lockaccountcode — Blocks (locks) an account (blocked=SI).
- TuCloudAPI unlockaccountcode — Unblocks (unlocks) an account (blocked=NO).
- TuCloudAPI addaccountcode — Creates a new account (client) under the caller.
- TuCloudAPI getcredit — Returns credit and status (credit, credit_limit, creditalarm, email, blocked).
simulator
- TuCloudAPI simulatecall — Simulate how a call routes (inbound DID / outbound / internal) WITHOUT placing a real call, returning the ordered decision trace (flujo).
Related
Full technical reference (architecture, auth model, side effects): see the project repo doc/TUCLOUDAPI_REFERENCE.md. Scheduled-tasks engine: the 6 tucloud_pbx_tasks* tables + the .231 crontab trigger.