本文介绍通过HTTP的方式来访问SQL。

请求路径和方法

请求路径 请求方法 描述
/api/v2/sql POST SQL访问。

SQL访问示例

请求示例如下语句:
POST /api/v2/sql
请求体的示例如下语句:
SELECT region,time,temperature,humidity FROM sensor WHERE time >= 1619076780000 AND time <= 1619076800000
响应示例如下语句:
{
    "columns": [
        "region",
        "time",
        "temperature",
        "humidity"
    ],
    "rows": [
        [
            "north-cn",
            1619076780000,
            12.1,
            45.0
        ],
        [
            "north-cn",
            1619076780000,
            12.1,
            null
        ],
        [
            "north-cn",
            1619076790000,
            12.1,
            null
        ],
        [
            "north-cn",
            1619076790001,
            12.1,
            null
        ]
    ]
}