Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.08 KB

File metadata and controls

48 lines (33 loc) · 1.08 KB

cURL Cloud Sample

Use cURL to run SQL against Spice.ai Cloud over HTTP.

Links

Prerequisites

  • cURL
  • A Spice.ai Cloud API key
  • A dataset available in your Cloud app

Quick Start

git clone https://github.com/spiceai/cookbook.git
cd cookbook/client-sdk/curl-sample

Set 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.sh

Manual Query (HTTP)

curl -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\"}"

Expected Result

You should receive JSON with query results in a data array.