Skip to content

Commit 80b76a1

Browse files
authored
Update README.md
1 parent 7ab007a commit 80b76a1

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

docs/README.md

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@ The extension goal is to replace the functionality currently offered by [Quackpi
1010
![image](https://github.com/user-attachments/assets/e930a8d2-b3e4-454e-ba12-e5e91b30bfbe)
1111

1212
#### Extension Functions
13-
- `httpserve_start(host, port)`
14-
- `httpserve_stop()`
13+
- `httpserve_start(host, port)`: starts the server using provided parameters
14+
- `httpserve_stop()`: stops the server thread
1515

16-
#### API Endpoints
17-
- `/` `GET`, `POST`
18-
- `default_format`: Supports `JSONEachRow` or `JSONCompact`
19-
- `query`: Supports DuckDB SQL queries
20-
- `/ping` `GET`
16+
<br>
2117

22-
### Installation
18+
### 📦 Installation
2319
```sql
2420
INSTALL httpserver FROM community;
2521
LOAD httpserver;
2622
```
2723

28-
### Usage
24+
### 🔌 Usage
2925
Start the HTTP server providing the `host` and `port` parameters
3026
```sql
3127
D SELECT httpserve_start('0.0.0.0',9999);
@@ -37,11 +33,11 @@ D SELECT httpserve_start('0.0.0.0',9999);
3733
└─────────────────────────────────────┘
3834
```
3935

40-
#### QUERY UI
36+
#### 👉 QUERY UI
4137
Browse to your endpoint and use the built-in quackplay interface _(experimental)_
4238
![image](https://github.com/user-attachments/assets/0ee751d0-7360-4d3d-949d-3fb930634ebd)
4339

44-
#### QUERY API
40+
#### 👉 QUERY API
4541
Query your API endpoint using curl GET/POST requests
4642

4743
```bash
@@ -74,7 +70,7 @@ curl -X POST -d "SELECT 'hello', version()" "http://localhost:9999/?default_form
7470
}
7571
```
7672
77-
You can also have DuckDB instances query each other using `NDJSON`
73+
👉 You can also have DuckDB instances query each other and... _themselves!_
7874
7975
```sql
8076
D LOAD json;
@@ -97,28 +93,38 @@ D SELECT * FROM read_json_auto('http://localhost:9999/?q=SELECT version()');
9793
9894
<br>
9995
100-
<br>
96+
### API Documentation
10197
102-
### Build steps
103-
Now to build the extension, run:
104-
```sh
105-
make
106-
```
107-
The main binaries that will be built are:
108-
```sh
109-
./build/release/duckdb
110-
./build/release/test/unittest
111-
./build/release/extension/<extension_name>/<extension_name>.duckdb_extension
112-
```
113-
- `duckdb` is the binary for the duckdb shell with the extension code automatically loaded.
114-
- `unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
115-
- `<extension_name>.duckdb_extension` is the loadable binary as it would be distributed.
98+
#### Endpoints Overview
11699
117-
## Running the extension
118-
To run the extension code, simply start the shell with `./build/release/duckdb`. This shell will have the extension pre-loaded.
100+
| Endpoint | Methods | Description |
101+
|----------|---------|-------------|
102+
| `/` | GET, POST | Query API endpoint |
103+
| `/ping` | GET | Health check endpoint |
119104
120-
## Running the tests
121-
Different tests can be created for DuckDB extensions. The primary way of testing DuckDB extensions should be the SQL tests in `./test/sql`. These SQL tests can be run using:
122-
```sh
123-
make test
124-
```
105+
#### Detailed Endpoint Specifications
106+
107+
##### Query API
108+
109+
**Methods:** `GET`, `POST`
110+
111+
**Parameters:**
112+
113+
| Parameter | Description | Supported Values |
114+
|-----------|-------------|-------------------|
115+
| `default_format` | Specifies the output format | `JSONEachRow`, `JSONCompact` |
116+
| `query` | The DuckDB SQL query to execute | Any valid DuckDB SQL query |
117+
118+
##### Notes
119+
120+
- Ensure that your queries are properly formatted and escaped when sending them as part of the request.
121+
- The root endpoint (`/`) supports both GET and POST methods, but POST is recommended for complex queries or when the query length exceeds URL length limitations.
122+
- Always specify the `default_format` parameter to ensure consistent output formatting.
123+
124+
<br>
125+
126+
##### :black_joker: Disclaimers
127+
128+
[^1]: DuckDB ® is a trademark of DuckDB Foundation. All rights reserved by their respective owners. [^1]
129+
[^2]: ClickHouse ® is a trademark of ClickHouse Inc. No direct affiliation or endorsement. [^2]
130+
[^3]: Released under the MIT license. See LICENSE for details. All rights reserved by their respective owners. [^3]

0 commit comments

Comments
 (0)