Use cURL to run SQL against Spice.ai Cloud over HTTP.
- cURL
- A Spice.ai Cloud API key
- A dataset available in your Cloud app
git clone https://github.com/spiceai/cookbook.git
cd cookbook/client-sdk/curl-sampleSet your cloud values for the commands in this README:
export SPICE_API_KEY="your_api_key"
export SPICE_DATASET="your_dataset"The script snippet keeps inline placeholders by design. Replace the API key and dataset placeholders in query_cloud_http.sh, then run:
bash query_cloud_http.shcurl -X POST https://data.spiceai.io/v1/sql \
-H "Content-Type: application/json" \
-H "X-API-Key: ${SPICE_API_KEY}" \
-d "{\"query\": \"SELECT * FROM ${SPICE_DATASET} LIMIT 10\"}"You should receive JSON with query results in a data array.