ByteHouse OpenAPI uses Bearer Token authorization. The user needs to create and use an API Key as the secret in the ByteHouse Console.
In the ByteHouse Cloud Data Warehouse Console Tenant management > Connection information > Connection tools page, you can obtain ByteHouse's OpenAPI connection address. You may select a private or public connection address as needed.
In the ByteHouse Cloud Data Warehouse Console Tenant management > Connection information > API Key page, click the New button under the API Key module to create an API Key.
warning
:::
Please refer to the API List to obtain the corresponding interfaces.
warning
Due to interface optimization, when using the Queries-V2 interface, you need to add port number "8123" in the URL.
:::
The specific API invocation path and method can be found in the interface documentation for each module. Examples are as follows:
| | | \
| Use Queries-V2 interface | Use Queries-V1 interface | |
|---|---|---|
| \ | ||
| ```Shell | \ | |
| curl --request POST \ | \ | |
| --url https://{OPENAPI_HOST}:8123/v2/sql/sync \ | \ | |
| --header 'accept: application/json' \ | \ | |
| --header 'authorization: Bearer ${API_KEY}' \ | \ | |
| --header 'content-type: application/json' \ | \ | |
| --data ' | \ | |
| { | \ | |
| "mode": "ansi_sql", | \ | |
| "query": "select 1" | \ | |
| } | \ | |
| ' | \ | |
| ``` | \ | |
| \ | ||
| ```Shell | \ | |
| curl --request POST \ | \ | |
| --url https://{OPENAPI_HOST}/v1/sql/sync \ | \ | |
| --header 'accept: application/json' \ | \ | |
| --header 'authorization: Bearer ${API_KEY}' \ | \ | |
| --header 'content-type: application/json' \ | \ | |
| --data ' | \ | |
| { | \ | |
| "mode": "ansi_sql", | \ | |
| "query": "select 1" | \ | |
| } | \ | |
| ' | \ | |
| ``` | \ | |
| \ | ||