@@ -9,51 +9,32 @@ Start the API server:
99``` bash
1010hana-cli server
1111
12- # By default listens on http://localhost:3001
12+ # By default listens on http://localhost:3010
1313```
1414
1515Access the API:
1616
1717``` bash
1818# List all tables
19- curl http://localhost:3001/api /tables -H " Authorization: Bearer YOUR_TOKEN "
19+ curl http://localhost:3010/hana /tables
2020
2121# Get table details
22- curl http://localhost:3001/api /tables/MY_SCHEMA/MY_TABLE -H " Authorization: Bearer YOUR_TOKEN "
22+ curl http://localhost:3010/hana /tables/MY_SCHEMA/MY_TABLE
2323
2424# Execute query
25- curl -X POST http://localhost:3001/api/execute \
26- -H " Authorization: Bearer YOUR_TOKEN" \
25+ curl -X POST http://localhost:3010/hana/querySimple \
2726 -H " Content-Type: application/json" \
28- -d ' {"sql ": "SELECT * FROM MY_TABLE LIMIT 10"}'
27+ -d ' {"q ": "SELECT * FROM MY_TABLE LIMIT 10"}'
2928```
3029
3130## API Overview
3231
3332The HANA CLI API server provides HTTP endpoints for all CLI commands.
3433
35- ### Server Modes
36-
37- ** CLI Mode** (default)
38- ``` bash
39- hana-cli [command] [options]
40- ```
41-
42- ** Web UI Mode** (interactive UI)
43- ``` bash
44- hana-cli [command] -w --port 3010
45- ```
46-
47- ** API Server Mode** (programmatic access)
48- ``` bash
49- hana-cli server --port 3001
50- ```
51-
5234### Request Format
5335
5436``` json
55- POST /api/execute HTTP/1.1
56- Authorization: Bearer <token>
37+ POST /hana/execute HTTP/1.1
5738Content-Type: application/json
5839
5940{
@@ -68,6 +49,7 @@ Content-Type: application/json
6849### Response Format
6950
7051Success response:
52+
7153``` json
7254{
7355 "success" : true ,
@@ -83,6 +65,7 @@ Success response:
8365```
8466
8567Error response:
68+
8669``` json
8770{
8871 "success" : false ,
@@ -96,38 +79,36 @@ Error response:
9679
9780### Connection
9881
99- - ` GET /api /connection ` - Current connection info
100- - ` POST /api /connect ` - Establish new connection
101- - ` POST /api /disconnect ` - Close connection
82+ - ` GET /hana /connection ` - Current connection info
83+ - ` POST /hana /connect ` - Establish new connection
84+ - ` POST /hana /disconnect ` - Close connection
10285
10386### Data Operations
10487
105- - ` GET /api /tables?schema=SCHEMA ` - List tables
106- - ` GET /api /tables/SCHEMA/TABLE ` - Table details
107- - ` GET /api /views?schema=SCHEMA ` - List views
108- - ` POST /api /export ` - Export data
109- - ` POST /api /import ` - Import data
88+ - ` GET /hana /tables?schema=SCHEMA ` - List tables
89+ - ` GET /hana /tables/SCHEMA/TABLE ` - Table details
90+ - ` GET /hana /views?schema=SCHEMA ` - List views
91+ - ` POST /hana /export ` - Export data
92+ - ` POST /hana /import ` - Import data
11093
11194### Schema Operations
11295
113- - ` GET /api /schemas ` - List all schemas
114- - ` GET /api /objects?schema=SCHEMA ` - List objects
115- - ` POST /api /compareSchema ` - Compare schemas
116- - ` POST /api /schemaClone ` - Clone schema
96+ - ` GET /hana /schemas ` - List all schemas
97+ - ` GET /hana /objects?schema=SCHEMA ` - List objects
98+ - ` POST /hana /compareSchema ` - Compare schemas
99+ - ` POST /hana /schemaClone ` - Clone schema
117100
118101### Query Execution
119102
120- - ` POST /api /execute ` - Run SQL query
121- - ` POST /api /callProcedure ` - Execute stored procedure
122- - ` GET /api /query/:id/results ` - Get query results
123- - ` POST /api /query/:id/cancel ` - Cancel running query
103+ - ` POST /hana /execute ` - Run SQL query
104+ - ` POST /hana /callProcedure ` - Execute stored procedure
105+ - ` GET /hana /query/:id/results ` - Get query results
106+ - ` POST /hana /query/:id/cancel ` - Cancel running query
124107
125108### System
126109
127- - ` GET /api/system/info ` - System information
128- - ` GET /api/system/version ` - Database version
129- - ` GET /api/health ` - Health check
130- - ` GET /api/metrics ` - Performance metrics
110+ - ` GET /hana/health ` - Health check
111+ - ` GET /hana/metrics ` - Performance metrics
131112
132113## Authentication
133114
@@ -137,25 +118,12 @@ By default, run in **unsecured mode** (development/local):
137118hana-cli server
138119```
139120
140- With token authentication:
141-
142- ``` bash
143- hana-cli server --token-required \
144- --tokens " prod-token:secret123,dev-token:secret456"
145- ```
146-
147- With API key:
148-
149- ``` bash
150- hana-cli server --api-key " my-app-api-key"
151- ```
152-
153121## Configuration
154122
155123### Port
156124
157125``` bash
158- hana-cli server --port 3001
126+ hana-cli server --port 3010
159127```
160128
161129### Host
@@ -164,39 +132,16 @@ hana-cli server --port 3001
164132hana-cli server --host 0.0.0.0 # Listen on all interfaces
165133```
166134
167- ### Database
168-
169- Use specific connection:
170-
171- ``` bash
172- hana-cli server -d host:port -u user -p password
173- ```
174-
175- ### CORS
176-
177- Enable cross-origin requests:
178-
179- ``` bash
180- hana-cli server --cors " *"
181- hana-cli server --cors " https://myapp.example.com"
182- ```
183-
184- ### Rate Limiting
185-
186- ``` bash
187- hana-cli server --rate-limit 100 # Max 100 requests per minute
188- ```
189-
190135## Usage Examples
191136
192137### Using with curl
193138
194139``` bash
195140# Get tables
196- curl " http://localhost:3001/api /tables?schema=MY_SCHEMA"
141+ curl " http://localhost:3010/hana /tables?schema=MY_SCHEMA"
197142
198143# Export data with filters
199- curl -X POST " http://localhost:3001/api /export" \
144+ curl -X POST " http://localhost:3010/hana /export" \
200145 -H " Content-Type: application/json" \
201146 -d ' {
202147 "schema": "MY_SCHEMA",
@@ -206,7 +151,7 @@ curl -X POST "http://localhost:3001/api/export" \
206151 }'
207152
208153# Execute query
209- curl -X POST " http://localhost:3001/api /execute" \
154+ curl -X POST " http://localhost:3010/hana /execute" \
210155 -H " Content-Type: application/json" \
211156 -d ' {
212157 "sql": "SELECT COUNT(*) FROM MY_TABLE"
@@ -219,12 +164,12 @@ curl -X POST "http://localhost:3001/api/execute" \
219164const fetch = require (' node-fetch' );
220165
221166// Get table list
222- const response = await fetch (' http://localhost:3001/api /tables?schema=MY_SCHEMA' );
167+ const response = await fetch (' http://localhost:3010/hana /tables?schema=MY_SCHEMA' );
223168const data = await response .json ();
224169console .log (data .data .rows );
225170
226171// Execute query
227- const queryResult = await fetch (' http://localhost:3001/api /execute' , {
172+ const queryResult = await fetch (' http://localhost:3010/hana /execute' , {
228173 method: ' POST' ,
229174 headers: { ' Content-Type' : ' application/json' },
230175 body: JSON .stringify ({
@@ -241,52 +186,20 @@ import json
241186
242187# Get tables
243188response = requests.get(
244- ' http://localhost:3001/api /tables' ,
189+ ' http://localhost:3010/hana /tables' ,
245190 params = {' schema' : ' MY_SCHEMA' }
246191)
247192tables = response.json()[' data' ][' rows' ]
248193print (tables)
249194
250195# Execute query
251196result = requests.post(
252- ' http://localhost:3001/api /execute' ,
197+ ' http://localhost:3010/hana /execute' ,
253198 json = {' sql' : ' SELECT * FROM MY_TABLE LIMIT 5' }
254199)
255200print (result.json())
256201```
257202
258- ## Performance Considerations
259-
260- ### Connection Pooling
261-
262- Server maintains connection pool:
263- - Default pool size: 10 connections
264- - Configure: ` --pool-size 20 `
265-
266- ### Query Timeout
267-
268- Default timeout: 30 seconds
269-
270- ``` bash
271- hana-cli server --timeout 60
272- ```
273-
274- ### Result Caching
275-
276- Cache recent queries:
277-
278- ``` bash
279- hana-cli server --cache-queries
280- ```
281-
282- ### Compression
283-
284- Enable response compression:
285-
286- ``` bash
287- hana-cli server --compress
288- ```
289-
290203## See Also
291204
292205- [ Web UI] ( ../web-ui/ )
0 commit comments