# 快速开始

## 注册roapi-cloud获取token

请登陆roapi-cloud网站，并注册帐号，获取可以访问服务的token.

### 本地edge版本 执行

#### 服务启动

提供 APIs 为 `test_data/uk_cities_with_headers.csv` 和 `test_data/spacex-launches.json`:

```bash
roapi-cloud 
```

或者使用预编译的 docker 镜像:

```
docker run -t --rm -p 8080:8080 ghcr.io/roapi-cloud/roapi-cloud:latest --addr-http 0.0.0.0:8080 
```

### 云版本 执行

不需要进行本地服务启动，上传数据和查询，请更改localhost为roapi-cloud.com

#### 上传数据

```
curl -u <你的帐号>:<你的token> -k https://localhost:8080/api/<你的空间名>/spacex_launches/_json -d test_data/spacex_launches.json
curl -u <你的帐号>:<你的token> -k https://localhost:8080/api/<你的空间名>/uk_cities_with_headers/_csv -d test_data/uk_cities_with_headers.csv
```

#### 查询 API

以表的方式查询可以用 SQL, GraphQL 或 REST:

```bash
curl -X POST -d "SELECT city, lat, lng FROM uk_cities LIMIT 2" localhost:8080/api/<你的空间名>/sql
curl -X POST -d "query { uk_cities(limit: 2) {city, lat, lng} }" localhost:8080/api/<你的空间名>/graphql
curl "localhost:8080/api/<你的空间名>/tables/uk_cities?columns=city,lat,lng&limit=2"
```

response 样例:

```json
[
  {
    "city": "Elgin, Scotland, the UK",
    "lat": 57.653484,
    "lng": -3.335724
  },
  {
    "city": "Stoke-on-Trent, Staffordshire, the UK",
    "lat": 53.002666,
    "lng": -2.179404
  }
]
```

参考 [Query frontends](/docs/api/query.md) 不同的请求参数和数据返回

请注意roapi和roapi-cloud在查询请求url的参数会多一级空间名的目录，用来区分不同用户url地址。

#### Schema API

自动推断表结构，查询该表的Schema:

```bash
curl localhost:8080/api/schema
```

response 样例:

```json
{
  "uk_cities": {
    "fields": [
      {
        "name": "city",
        "data_type": "Utf8",
        "nullable": false,
        "dict_id": 0,
        "dict_is_ordered": false
      },
      {
        "name": "lat",
        "data_type": "Float64",
        "nullable": false,
        "dict_id": 0,
        "dict_is_ordered": false
      },
      {
        "name": "lng",
        "data_type": "Float64",
        "nullable": false,
        "dict_id": 0,
        "dict_is_ordered": false
      }
    ]
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.roapi-cloud.com/docs/kuai-su-kai-shi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
