HTTP API
Authentication
GreptimeDB supports the built-in Basic
authentication scheme in HTTP API for SQL language and OpenTSDB protocol. To set up authentication, do the following:
- Encode your username and password using
Base64
algorithm. - Attach your encoded credentials to the HTTP request header using the format
Authorization: Basic <base64-encoded-credentials>
.
Here’s an example:
shell
curl -X POST \
-H 'Authorization: Basic Z3JlcHRpbWVfdXNlcjpncmVwdGltZV9wd2Q=' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'sql=show tables' \
http://localhost:4000/v1/sql?db=public
json
{
"code": 0,
"output": [
{
"records": {
"schema": {
"column_schemas": [
{
"name": "Tables",
"data_type": "String"
}
]
},
"rows": [
["numbers"],
["scripts"]
]
}
}
],
"execution_time_ms": 1
}
Z3JlcHRpbWVfdXNlcjpncmVwdGltZV9wd2Q=
isgreptime_user:greptime_pwd
encoded using Base64. Remember to replace it with your own configured username and password and encode them using Base64.- The
public
in the URL is the name of your database, which is required with authorization.
NOTE
InfluxDB uses its own authentication format, see InfluxDB for details.
Write Data
Query Data
当前内容版权归 GreptimeDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 GreptimeDB .