DDN (HTTP API)
For client-side applications or other cases where you can make HTTP calls but not connect to Splitgraph's PostgreSQL endpoint directly, you can also use the DDN HTTP API. This lets you run SQL queries on the DDN over HTTP.
Querying the DDN with API keys
To get Splitgraph API keys, see the Machine Credentials section.
You can then query the DDN by passing the API key and secret as HTTP request headers:
curl https://data.splitgraph.com/sql/query/ddn \
-H 'X-API-Key: API_KEY' \
-H 'X-API-Secret: API_SECRET' \
-H 'Content-Type: application/json' \
-d '{"sql": "SELECT 1"}'
Querying the DDN with an access token
You can exchange your API keys for a temporary (1 hour lifetime) access token that you can use to query the HTTP interface.
curl https://api.splitgraph.com/auth/access_token \
-H 'Content-Type: application/json' \
-d '{"api_key": (api key), "api_secret": (api secret)}'
Using the access token, you can now run SQL queries on the DDN:
curl https://data.splitgraph.com/sql/query/ddn \
-H 'Authorization: Bearer '$TOKEN \
-H 'Content-Type: application/json' \
-d '{"sql": "SELECT 1"}'
Querying the DDN anonymously
Alternatively, you query the DDN without signing in. Anonymous queries are subject to heavier throttling and will not give you access to private repositories. In addition, they are not supported on private deployments.
curl https://data.splitgraph.com/sql/query/ddn \
-H 'Content-Type: application/json' \
-d '{"sql": "SELECT 1"}'