In older versions of Lenses, there was a REST API available to query the data, but I haven’t found anything related to that in recent versions. How can I use the Lenses API to execute queries?
Hello Edward_k,
In Lenses 5 no longer uses the REST API to send queries and receive results. Instead, websockets are used for communication between the UI and the API to execute queries on the SQL Engine. There is documentation explaining how the API works with websockets, and it can be found at this link here: Lenses WebSocket API | Lenses.io Documentation.
An example of running a query using the WebSocket API involves using the utility uwsc and requires an access token. After connecting to Lenses with uwsc, you send the query along with the authentication token to retrieve the query results.
uwsc ws://[domain]:[port]/api/ws/v2/sql/execute
{"token": "8496749c-1f7e-4c6f-ayy9-9491e1abb349","sql": "SELECT * FROM topic LIMIT 1;"}