-
Goal: send REST request to API with data from several tables, some of them with multiple lines
-
Details:
** i have an app where i show a table called Documents.
** after selecting a row from this table app populates several other tables visible to user - like document-details, document-suggestions, document-comments and so on. Some of this tables contain multiple lines (e.g. several comments),
** i created a query that gets single pieces of data from populated tables (like document-details.date, document-details.author) and sends them to API in json format, in simple flat structure with all fields - it works well,
** now i am trying to add a new json part to this request that would represent a multiple rows with data about the selected document
someting like
"comments":
[
{
"comment-author": "Adam",
"comment-date": "2024-01-22",
"comment-text": "great doc!"
},
{
"comment-author": "Edward",
"comment-date": "2024-01-21",
"comment-text": "poor doc!"
}
]
so when i select a document i can send an API request with some basic values but also structured multiline values
so basically i think i need something that will convert sql query to json structure and save it into text variable?
I tried creating variable and using initial value for testing (until i find out how to dynamically set this variable to json from my tables) but when i put this variable in body of REST request retool adds \ characters before every " character,
it is rather complicated REST call and i need several structures in it but now i am struggling with adding first one,
any suggestions?