Query using the REST API
Query Pinot via a broker endpoint using the example below. This example assumes broker is running on localhost:8099
and StarTree Cloud
Access the Pinot REST API by invoking POST
operation with a JSON body containing the parameter sql
to the /query/sql
endpoint on a broker.
Example when you are running the following curl for localhost:
$ curl -H "Content-Type: application/json" -X POST \
-d '{"sql":"select foo, count(*) from myTable group by foo limit 100"}' \
http://localhost:8099/query/sql
Example when you are running the following curl for StarTree Cloud:
$ curl --location --request POST 'https://broker.pinot.docwrkspc.docorg.startree-staging.cloud/query/sql' \
--header 'Authorization: Basic <API Token>' \
--header 'Content-Type: application/json' \
--data-raw '{"sql":"select foo, count(*) from MyData group by foo order by foo desc limit 100"}'