Try StarTree Cloud: 30-day free trial
Query using the REST API

Query using the REST API

To query Pinot via a broker endpoint, complete the following steps:

  1. Generate a Pinot API token.
  2. In StarTree Cloud (opens in a new tab), click Go to Data Manager.
  3. Click a dataset to test, and then highlight and copy the Broker URL.
  4. 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, including the broker URL.

The following example assumes broker is running on localhost:8099 and StarTree Cloud.

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 or https://broker.pinot.celaar.cp.s7e.startree.cloud:443/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' or https://broker.pinot.celaar.cp.s7e.startree.cloud:443/query/sql\
--header 'Authorization: Bearer <API Token>' \
--header 'Content-Type: application/json' \
--data-raw '{"sql":"select foo, count(*) from MyData group by foo order by foo desc limit 100"}'