-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathrest-api-examples.http
More file actions
315 lines (241 loc) · 6.76 KB
/
Copy pathrest-api-examples.http
File metadata and controls
315 lines (241 loc) · 6.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# REST Client VSCode Extension compatible (humao.rest-client)
### Variables
@base_url = http://127.0.0.1:8080
@username = admin
@password = test
@doc_name = API Test Document
@doc_path = api-testing/api-test-document
@doc_body = # API Test Document\n\nChanged content...
@test_upload = example.txt
@renamed_upload = renamed-example.txt
@newuser_username = newuser
@newuser_password = test
@newuser_role = viewer
### Authentication
#### Login
# @name login
POST {{ base_url }}/api/login
Content-Type: application/json
{
"username": "{{ username }}",
"password": "{{ password }}",
"keepLoggedIn": false
}
#### Check auth status
GET {{ base_url }}/api/check-auth
Accept: application/json
### Profile
#### Change password (wrong current password — expect 401)
POST {{ base_url }}/api/password
Content-Type: application/json
{
"current_password": "wrongpass",
"new_password": "newpass123"
}
#### Change password (correct — expect 200)
POST {{ base_url }}/api/password
Content-Type: application/json
{
"current_password": "{{ password }}",
"new_password": "{{ password }}"
}
#### Change password via GET (expect 405)
GET {{ base_url }}/api/password
### Documents
#### Create document
POST {{ base_url }}/api/document/create
Content-Type: application/json
{
"title": "{{ doc_name }}",
"path": "{{ doc_path }}"
}
#### Get document HTML
GET {{ base_url }}/api/document/{{ doc_path }}
Accept: text/html
#### Get document source (Markdown)
GET {{ base_url }}/api/source/{{ doc_path }}
Accept: text/markdown
#### Save document
POST {{ base_url }}/api/save/{{ doc_path }}
Content-Type: text/markdown
{{ doc_body }}
#### Rename document
POST {{ base_url }}/api/document/move
Content-Type: application/json
{
"sourcePath": "test-doc",
"targetPath": "",
"newSlug": "test-doc2"
}
#### Move document
POST {{ base_url }}/api/document/move
Content-Type: application/json
{
"sourcePath": "test-doc2",
"targetPath": "cat/sub",
"newSlug": "test-doc2"
}
#### Delete document
DELETE {{ base_url }}/api/document/{{ doc_path }}
### Files
#### Upload file (text example)
POST {{ base_url }}/api/files/upload
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="docPath"
{{ doc_path }}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.txt"
Content-Type: text/plain
This is the content of the text file being uploaded.
------WebKitFormBoundary7MA4YWxkTrZu0gW--
#### List files
GET {{ base_url }}/api/files/list/{{ doc_path }}
Accept: application/json
#### Serve file
GET {{ base_url }}/api/files/{{ doc_path }}/{{ test_upload }}
#### Rename file
POST {{ base_url }}/api/files/rename
Content-Type: application/json
{
"currentPath": "{{ doc_path }}/{{ test_upload }}",
"newName": "{{ renamed_upload }}"
}
#### Delete renamed file
DELETE {{ base_url }}/api/files/delete/{{ doc_path }}/{{ renamed_upload }}
### Comments
#### Add comment
POST {{ base_url }}/api/comments/add/{{ doc_path }}
Content-Type: application/json
{
"content": "This is a comment"
}
#### Get comments
# @name list_comments
GET {{ base_url }}/api/comments/{{ doc_path }}
Accept: application/json
### Store the first comment id
@comment_id = {{list_comments.response.body.$.comments[0].ID}}
#### Delete comment
DELETE {{ base_url }}/api/comments/delete/{{ doc_path }}/{{ comment_id }}
### Versions
#### Get version history
# @name get_version_history
GET {{ base_url }}/api/versions/{{ doc_path }}
Accept: application/json
### Store the first version's timestamp
@version_ts = {{get_version_history.response.body.$.versions[0].timestamp}}
#### Restore version
POST {{ base_url }}/api/versions/{{ doc_path }}/{{ version_ts }}/restore
### Admin
#### Get wiki settings
GET {{ base_url }}/api/settings/wiki
Accept: application/json
#### Update wiki settings
POST {{ base_url }}/api/settings/wiki
Content-Type: application/json
{
"title": "📚 Wiki-Go",
"owner": "wikigo.leomoon.com",
"notice": "Copyright :::year::: © All rights reserved.",
"timezone": "America/Vancouver",
"private": false,
"disable_comments": false,
"disable_file_upload_checking": false,
"max_versions": 10,
"max_upload_size": 1,
"language": "en"
}
#### Update security settings
POST {{ base_url }}/api/settings/security
Content-Type: application/json
{
"login_ban": {
"enabled": true,
"max_failures": 5,
"window_seconds": 180,
"initial_ban_seconds": 60,
"max_ban_seconds": 86400
}
}
#### List users
GET {{ base_url }}/api/users
Accept: application/json
#### Create user
POST {{ base_url }}/api/users
Content-Type: application/json
{
"username": "{{ newuser_username }}",
"password": "{{ newuser_password }}",
"role": "{{ newuser_role }}"
}
#### Update user
PUT {{ base_url }}/api/users
Content-Type: application/json
{
"username": "{{ newuser_username }}",
"new_password": "{{ newuser_password }}",
"role": "{{ newuser_role }}"
}
#### Delete user
DELETE {{ base_url }}/api/users?username=newuser
Content-Type: application/json
### Backup
#### Start backup
# @name start_backup
POST {{ base_url }}/api/backup/start
### Store the backup job ID
@backup_job_id = {{start_backup.response.body.$.jobId}}
#### Check backup status
GET {{ base_url }}/api/backup/status/{{ backup_job_id }}
Accept: application/json
#### List backups
# @name list_backups
GET {{ base_url }}/api/backup/list
Accept: application/json
### Store the first backup filename
@backup_filename = {{list_backups.response.body.$.backups[0].name}}
#### Download backup
GET {{ base_url }}/api/backup/download/{{ backup_filename }}
#### Delete backup
DELETE {{ base_url }}/api/backup/delete/{{ backup_filename }}
### Links API
#### Add a new link to links document
POST {{ base_url }}/api/links/add/links
Content-Type: application/json
{
"url": "https://stackoverflow.com",
"title": "Stack Overflow",
"description": "Programming Q&A community",
"category": "Learning Resources",
"date": "2025-09-03"
}
#### Edit an existing link (update GitHub link)
PUT {{ base_url }}/api/links/edit/links
Content-Type: application/json
{
"oldUrl": "https://github.com",
"newLink": {
"url": "https://github.com",
"title": "GitHub - Updated",
"description": "World's leading development platform - Updated!",
"category": "Work Tools",
"date": "2025-09-03"
}
}
#### Delete a link (remove Figma)
DELETE {{ base_url }}/api/links/delete/links
Content-Type: application/json
{
"url": "https://figma.com"
}
#### Fetch metadata
POST {{ base_url }}/api/links/fetch-metadata
Content-Type: application/json
{
"url": "https://www.kingorama.com/rostam-pop-up-book"
}
### Authentication cleanup
#### Logout (run after the authenticated examples above)
POST {{ base_url }}/api/logout
Content-Type: application/json