added TryIt buttom for HTML help,

added Bearer token for testing API
This commit is contained in:
2026-03-29 21:51:42 +02:00
parent 1f32935a29
commit 394a85ef45
3 changed files with 952 additions and 208 deletions

View File

@ -231,6 +231,8 @@ and there is also an HTML version available
<img src="test/Example.APIcalculator.png" />
The HTML documentation page also includes a built-in interactive tester. Each endpoint can be expanded with `Try it`, filled directly in the browser, and executed against the current API endpoint. If needed, you can set a shared Bearer token at the top of the page. The token is stored in `localStorage` and is sent as `Authorization: Bearer ...` for test requests made from that page.
You can also download generated frontend clients:
* JavaScript: `?format=javascript`
@ -263,3 +265,14 @@ These outputs can also be generated in command line:
* HTML: `$> php APIcalculator.php --html`
* JavaScript: `$> php APIcalculator.php --javascript > backend.js` (`--js` alias is available)
* TypeScript: `$> php APIcalculator.php --typescript > backend.ts`
## HTML help tester notes
The built-in HTML tester currently follows the default APIlite request model:
* request method is `POST`
* endpoint action is sent as query parameter `action`
* request fields are sent as top-level form fields
* object and array field values are serialized as JSON strings
Because the current metadata does not explicitly distinguish path params, query params and request body schemas, the HTML tester renders the parts that are reliably available today and keeps the rest minimal.