To retrieve data from your datasets, you need to define a 'query' with the Data Lens REST API query language. In addition to simply fetching data, you can define a query to aggregate, transform, filter and sort the data before creating a visualization with it. Note that only dataset owners can create queries on a dataset.
A Data Lens query is not a one-off action like a query in SQL. It corresponds more to the concept of 'prepared statements' in SQL, where you can create a query for later execution. This involves separating the sending of the query's source code and the actual data retrieval.
Query owners can choose to 'publish' a query to make it possible for non-authenticated users to use it. While a query remains private (unpublished), only the query owner can POST it to the Data Lens REST API. This privacy option allows you to upload a sensitive dataset (for example, records with user information) but make a less sensitive query (for example, aggregating the number of users by country in the result). You can then make only the less sensitive data publicly available by publishing that query.