Skip to content

Commit 1873ed5

Browse files
authored
Add examples for HTTP instance APIs. (#2043)
### What problem does this PR solve? Add examples for HTTP instance APIs. Issue link: #1937 ### Type of change - [x] Other (please describe): examples.
1 parent 86800d8 commit 1873ed5

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

example/http/show_metrics.sh

+148
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,78 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# create table 'my_table'
16+
echo -e '-- create my_table'
17+
curl --request POST \
18+
--url http://localhost:23820/databases/default_db/tables/my_table \
19+
--header 'accept: application/json' \
20+
--header 'content-type: application/json' \
21+
--data ' {
22+
"create_option": "ignore_if_exists",
23+
"fields": [
24+
{
25+
"name" : "num",
26+
"type" : "integer"
27+
},
28+
{
29+
"name" : "name",
30+
"type" : "varchar"
31+
},
32+
{
33+
"name" : "score",
34+
"type" : "float"
35+
}
36+
]
37+
} '
38+
39+
echo -e '\n\n-- insert 5 rows into my_table'
40+
curl --request POST \
41+
--url http://localhost:23820/databases/default_db/tables/my_table/docs \
42+
--header 'accept: application/json' \
43+
--header 'content-type: application/json' \
44+
--data '
45+
[
46+
{
47+
"num" : 1,
48+
"name" : "Tom",
49+
"score" : 90
50+
},
51+
{
52+
"num" : 2,
53+
"name" : "Henry",
54+
"score" : 70
55+
},
56+
{
57+
"num" : 3,
58+
"name" : "james",
59+
"score" : 70
60+
},
61+
{
62+
"num" : 4,
63+
"name" : "Toby",
64+
"score" : 92
65+
},
66+
{
67+
"num" : 5,
68+
"name" : "Tom",
69+
"score" : 90
70+
}
71+
] '
72+
73+
# show all rows of 'my_table'
74+
echo -e '\n\n-- select all rows of my_table'
75+
curl --request GET \
76+
--url http://localhost:23820/databases/default_db/tables/my_table/docs \
77+
--header 'accept: application/json' \
78+
--header 'content-type: application/json' \
79+
--data '
80+
{
81+
"output":
82+
[
83+
"*"
84+
]
85+
} '
86+
1587
# show buffer
1688
echo -e '\n-- show buffer'
1789
curl --request GET \
@@ -36,3 +108,79 @@ curl --request GET \
36108
--url http://localhost:23820/instance/queries \
37109
--header 'accept: application/json'
38110

111+
# show logs
112+
echo -e '\n\n-- show logs'
113+
curl --request GET \
114+
--url http://localhost:23820/instance/logs \
115+
--header 'accept: application/json'
116+
117+
# show delta checkpoints
118+
echo -e '\n\n-- show delta checkpoint'
119+
curl --request GET \
120+
--url http://localhost:23820/instance/delta_checkpoint \
121+
--header 'accept: application/json'
122+
123+
# show global checkpoints
124+
echo -e '\n\n-- show global checkpoint'
125+
curl --request GET \
126+
--url http://localhost:23820/instance/global_checkpoint \
127+
--header 'accept: application/json'
128+
129+
# show transactions
130+
echo -e '\n\n-- show transactions'
131+
curl --request GET \
132+
--url http://localhost:23820/instance/transactions \
133+
--header 'accept: application/json'
134+
135+
# show objects
136+
echo -e '\n\n-- show objects'
137+
curl --request GET \
138+
--url http://localhost:23820/instance/objects \
139+
--header 'accept: application/json'
140+
141+
# show files
142+
echo -e '\n\n-- show files'
143+
curl --request GET \
144+
--url http://localhost:23820/instance/files \
145+
--header 'accept: application/json'
146+
147+
# show memory
148+
echo -e '\n\n-- show memory'
149+
curl --request GET \
150+
--url http://localhost:23820/instance/memory \
151+
--header 'accept: application/json'
152+
153+
# show memory objects
154+
echo -e '\n\n-- show memory objects'
155+
curl --request GET \
156+
--url http://localhost:23820/instance/memory/objects \
157+
--header 'accept: application/json'
158+
159+
# show memory allocations
160+
echo -e '\n\n-- show memory allocations'
161+
curl --request GET \
162+
--url http://localhost:23820/instance/memory/allocations \
163+
--header 'accept: application/json'
164+
165+
# show memory allocations
166+
echo -e '\n\n-- show memory allocations'
167+
curl --request GET \
168+
--url http://localhost:23820/instance/memory/allocations \
169+
--header 'accept: application/json'
170+
171+
# force global checkpoints
172+
echo -e '\n\n-- show memory allocations'
173+
curl --request POST \
174+
--url http://localhost:23820/instance/flush \
175+
--header 'accept: application/json'
176+
177+
# compact table
178+
curl --request POST \
179+
--url http://localhost:23820/instance/table/compact \
180+
--header 'accept: application/json' \
181+
--header 'content-type: application/json' \
182+
--data '
183+
{
184+
"db_name" : "default_db",
185+
"table_name" : "my_table"
186+
} '

0 commit comments

Comments
 (0)