Skip to content

Commit 19e1a34

Browse files
vsianwritinwaters
andauthored
HTTP APIs document (#2039)
### What problem does this PR solve? Add documents for folloing HTTP APIs: - Show memory - Show memory objects - Show memory allocation - Force global checkpoint - Compact table Issue link: #1937 ### Type of change - [x] Documentation Update --------- Co-authored-by: writinwaters <[email protected]>
1 parent 4dcb535 commit 19e1a34

File tree

1 file changed

+230
-0
lines changed

1 file changed

+230
-0
lines changed

docs/references/http_api_reference.mdx

+230
Original file line numberDiff line numberDiff line change
@@ -3130,6 +3130,236 @@ The response includes a JSON object like the following:
31303130
31313131
---
31323132
3133+
## Show memory
3134+
3135+
**GET** `/instance/memory`
3136+
3137+
Shows the memory usage information of the instance.
3138+
3139+
### Request
3140+
3141+
- Method: GET
3142+
- URL: `/instance/memory`
3143+
- Headers: `accept: application/json`
3144+
3145+
#### Request example
3146+
3147+
```shell
3148+
curl --request GET \
3149+
--url http://localhost:23821/instance/memory \
3150+
--header 'accept: application/json'
3151+
```
3152+
3153+
### Response
3154+
3155+
#### Status code 200
3156+
3157+
The response includes a JSON object like the following:
3158+
3159+
```shell
3160+
{
3161+
"error_code":0,
3162+
"memory_allocation":"Not activate",
3163+
"memory_objects":"Not activate"
3164+
}
3165+
```
3166+
3167+
- `"error_code"`: `integer`
3168+
`0`: The operation succeeds.
3169+
3170+
---
3171+
3172+
## Show memory object
3173+
3174+
**GET** `/instance/memory/objects`
3175+
3176+
Shows the memory object usage information of the instance.
3177+
3178+
### Request
3179+
3180+
- Method: GET
3181+
- URL: `/instance/memory/objects`
3182+
- Headers: `accept: application/json`
3183+
3184+
#### Request example
3185+
3186+
```shell
3187+
curl --request GET \
3188+
--url http://localhost:23821/instance/memory/objects \
3189+
--header 'accept: application/json'
3190+
```
3191+
3192+
### Response
3193+
3194+
#### Status code 200
3195+
3196+
The response includes a JSON object like the following:
3197+
3198+
```shell
3199+
{
3200+
"error_code":0,
3201+
}
3202+
```
3203+
3204+
- `"error_code"`: `integer`
3205+
`0`: The operation succeeds.
3206+
3207+
---
3208+
3209+
## Show memory allocation
3210+
3211+
**GET** `/instance/memory/allocation`
3212+
3213+
Shows the memory allocation information of the instance.
3214+
3215+
### Request
3216+
3217+
- Method: GET
3218+
- URL: `/instance/memory/allocation`
3219+
- Headers: `accept: application/json`
3220+
3221+
#### Request example
3222+
3223+
```shell
3224+
curl --request GET \
3225+
--url http://localhost:23821/instance/memory/allocation \
3226+
--header 'accept: application/json'
3227+
```
3228+
3229+
### Response
3230+
3231+
#### Status code 200
3232+
3233+
The response includes a JSON object like the following:
3234+
3235+
```shell
3236+
{
3237+
"error_code":0,
3238+
}
3239+
```
3240+
3241+
- `"error_code"`: `integer`
3242+
`0`: The operation succeeds.
3243+
3244+
---
3245+
3246+
## Global Checkpoint
3247+
3248+
**POST** `/instance/flush`
3249+
3250+
Performs a full checkpoint on the instance.
3251+
3252+
### Request
3253+
3254+
- Method: POST
3255+
- URL: `/instance/flush`
3256+
- Headers:
3257+
- `accept: application/json`
3258+
- `content-type: application/json`
3259+
3260+
#### Request example
3261+
3262+
```shell
3263+
curl --request POST \
3264+
--url http://localhost:23822/instance/flush\
3265+
--header 'accept: application/json' \
3266+
```
3267+
3268+
### Response
3269+
3270+
#### Status code 200
3271+
3272+
The response includes a JSON object like the following:
3273+
3274+
```shell
3275+
{
3276+
"error_code":0,
3277+
}
3278+
```
3279+
3280+
- `"error_code"`: `integer`
3281+
`0`: The operation succeeds.
3282+
3283+
---
3284+
3285+
## Compact Table
3286+
3287+
**POST** `/instance/table/compact`
3288+
3289+
Performs a compaction operation on a specified table.
3290+
3291+
### Request
3292+
3293+
- Method: POST
3294+
- URL: `/instance/table/compact`
3295+
- Headers:
3296+
- `accept: application/json`
3297+
- `content-type: application/json`
3298+
3299+
#### Request example
3300+
3301+
```shell
3302+
curl --request POST \
3303+
--url http://localhost:23820/instance/table/compact \
3304+
--header 'accept: application/json' \
3305+
--header 'content-type: application/json' \
3306+
--data '
3307+
{
3308+
"db_name" : "default_db",
3309+
"table_name" : "my_table",
3310+
} '
3311+
```
3312+
3313+
#### Request parameters
3314+
3315+
- `db_name`: Required (*Body parameter*)
3316+
- `table_name`: Required (*Body parameter*)
3317+
`db_name` and `table_name` specifies the table to perform compaction.
3318+
3319+
### Response
3320+
3321+
3322+
<Tabs
3323+
defaultValue="s200"
3324+
values={[
3325+
{label: 'Status code 200', value: 's200'},
3326+
{label: 'Status code 500', value: 's500'},
3327+
]}>
3328+
<TabItem value="s200">
3329+
3330+
The response includes a JSON object like the following:
3331+
3332+
```shell
3333+
{
3334+
"error_code": 0
3335+
}
3336+
```
3337+
3338+
- `"error_code"`: `integer`
3339+
`0`: The operation succeeds.
3340+
3341+
</TabItem>
3342+
<TabItem value="s500">
3343+
3344+
A `500` HTTP status code indicates an error condition. The response includes a JSON object like the following:
3345+
3346+
```shell
3347+
{
3348+
"error_code":3022,
3349+
"error_message":"Table id_timep doesn't exist@src/planner/query_binder.cpp:423"
3350+
}
3351+
```
3352+
3353+
- `"error_code"`: `integer`
3354+
A non-zero value indicates a specific error condition.
3355+
- `"error_message"`: `string`
3356+
When `error_code` is non-zero, `"error_message"` provides additional details about the error.
3357+
3358+
</TabItem>
3359+
</Tabs>
3360+
3361+
---
3362+
31333363
## Admin set node role
31343364
31353365
**POST** `/admin/node/current`

0 commit comments

Comments
 (0)