Asked by Gabriel on March 16, 2025
Where can I find the automatically created Swagger documentation for my API?
Answered by Twidget
The Swagger (OpenAPI) documentation is available on the API page in your Twidget environment.
Making a field required in a POST request
Use the Validate commands to check that the field exists and throw an error if it does not. This will return a non‑200 response and prevent the record from being created. See the validate tutorial: https://www.youtube.com/watch?v=FAbQP37ImUI&pp=0gcJCU8JAYcqIYzv
Querying by non‑ID fields returning no results
Quoted field names refer to table fields correctly. If you are testing in the API Client or the endpoint test, make sure Live Data is enabled to see actual records rather than mock data.
Retrieving related data across tables (example with managers and employees)
One approach: keep company_id and manager_id fields on the Employee table. Use Get Multiple Data filtered by company_id to fetch employees, then for each employee fetch the manager by manager_id (this results in multiple calls).
For better efficiency: perform a single Get Multiple Data to f...
Deleting layers in the page editor
Select the element and press the Delete key, or use the Delete option available in the toolbar options dropdown.
Accessing global variables inside functions
Global variables are accessible only in server‑side contexts (endpoints, server functions, events). They are not available inside client‑side code or client functions.