First of all very new to retool and not familiar with UI but tried to search a lot and couldn't get answer.
Goal: To be able to run query with dynamic value
Details: I have defined API resource which needs dynamic header value to be passed but when I use {{ connected_account_id }} it shows error that is not defined as shown in screenshot below
In this case I think you are going to want to add this custom header at the App level since it seems like the connected_account_id will be generated/maintained there.
Okay makes sense but can you please mention here how and where to define these variables? and how to pass data from app to this API requests having this kind of variables?
You would set up the resource as normal (but without any options/headers which will be added in the App. In your App, when you choose the resource for the query there will be additional options that you can add like this:
I am unsure where your connected account ID would be coming from, but if it is the result from a different query in the app, you can use the data property of that query in place of where I have used yourData above.
{{ yourData }} --> {{yourOtherQuery.data}}
Once you are looking at another query's returned data, the structure of the returned value can be used, such as nested JSON properties or indexed array values.