Return database rows as JSON
Build a flow that answers a request with the rows of a database.
Táto stránka ešte nie je preložená. Čítaš originál.
Na tejto stránke
This recipe publishes the customers of a Customers database at their own address.
1. Create the Customers database with the columns you need. See Databases.
2. Open Flows, select Create, name the flow Customer API and select SUBMIT.
3. Open the flow. From the Databases group, drag View endpoint, Customers and View response onto the area.
4. Connect Request of the view to Input of Customers, and Output of Customers to Response of View response.

5. Double-click Customers and replace the code with:
return FIND();6. Select APPLY in the settings, then APPLY and Continue in the designer.
7. Find the address of the view:
SELECT name, url FROM tbl_view WHERE isremoved = false;8. Open the address in the browser where you are signed in to TAS. TAS answers with the rows:
[{"id":"JasoGx1cB61f","name":"Jane Doe","email":"jane@example.com","active":true}]Return one row
Change the code of Customers to read the id from the query string:
return READ().where('id', data.query.id);Then call the address with ?id= and the identifier of a row. Connect the Error output to View response too, so that the request also ends when the code fails.