HTTP Query API

Use the Hydrolix cluster HTTP Query API

Each cluster runs the Hydrolix HTTP query API. The API endpoint is https://{myhost}.hydrolix.live/query.

We recommend the POST endpoint, although there is also a GET endpoint.

Authentication

The HTTP query API interface support both JWT bearer token-based and username/password-based query authentication.

Get the bearer token, which is good for the next 24 hours, to authenticate future API calls. This command assumes you've set the $HDX_HOSTNAME, $HDX_USER and $HDX_PASSWORD environment variables:

export HDX_TOKEN=$(
  curl -v -X POST -H "Content-Type: application/json" \
  https://$HDX_HOSTNAME/config/v1/login/ \
  -d "{
    \"username\":\"$HDX_USER\",
    \"password\":\"$HDX_PASSWORD\"  
  }" | jq -r ".auth_token.access_token"
)

Learn more on the Enable Query Authentication, User Authentication, and Configure IP Access pages.

The ClickHouse native and MySQL interfaces support the username/password authentication mechanism.


HTTP query API example

$ printf "%s\n" "SELECT COUNT(*) FROM hydro.logs WHERE timestamp > NOW() - INTERVAL 1 HOUR;" \
  | curl -X POST \
      --data-binary @- \
      --header "Authorization: Bearer ${JWT_ACCESS_TOKEN}" \
      https://{myhost}.hydrolix.live/query
2354732