forked from oracle/opengrok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
577 lines (398 loc) · 17.5 KB
/
apiary.apib
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
HIFORMAT: 1A
# OpenGrok
OpenGrok RESTful API documentation. The following endpoints are accessible under `/api/v1`
Besides `/suggester` and `/search` endpoints, everything is accessible from `localhost` only.
## Annotation [/annotation{?path}]
### Get annotation for a file [GET]
+ Parameters
+ path (string) - path of file, relative to source root
+ Response 200 (application/json)
+ Body
[
{
"revision": "c55d5891",
"author": "Adam Hornáček",
"description": "changeset: c55d5891\nsummary: Rewrite README.txt to use markdown syntax\nuser: Adam Hornáček <[email protected]>\ndate: Wed Aug 30 17:42:12 CEST 2017",
"version": "1/15"
},
{
"revision": "5e0c6b22",
"author": "Vladimir Kotal",
"description": "changeset: 5e0c6b22\nsummary: bump year\nuser: Vladimir Kotal <[email protected]>\ndate: Thu Jul 18 14:43:01 CEST 2019",
"version": "14/15"
}
]
## Authorization framework reload [/configuration/authorization/reload]
### reloads authorization framework [POST]
+ Request (application/text)
+ Response 204
## Configuration [/configuration]
### return XML representation of configuration [GET]
+ Response 200 (application/xml)
+ Body
```
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.8.0_172" class="java.beans.XMLDecoder">
<object class="org.opengrok.indexer.configuration.Configuration" id="Configuration0">
<void property="allowLeadingWildcard">
<boolean>true</boolean>
</void>
</object>
</java>
```
### sets configuration from XML representation [PUT]
+ Request (application/xml)
+ Body
```
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.8.0_172" class="java.beans.XMLDecoder">
<object class="org.opengrok.indexer.configuration.Configuration" id="Configuration0">
<void property="allowLeadingWildcard">
<boolean>true</boolean>
</void>
</object>
</java>
```
+ Response 201 (application/json)
## Configuration field [/configuration/{field}{?reindex}]
### returns specific configuration field [GET]
+ Response 200 (application/json)
### sets specific configuration field [PUT]
+ Parameters
+ reindex (boolean) - specifies if the underlying data were also reindexed (refreshes some searchers and additional data structures)
+ Request (application/text)
string value of the field to set
+ Response 204
## File content [/file/content{?path}]
### get file content [GET]
Honors the Accept header. The text type works for plain text files only.
+ Parameters
+ path (string) - path of file, relative to source root
+ Response 200 (text/plain)
+ Body
foo
bar
+ Response 200 (application/octet-stream)
## File genre [/file/genre{?path}]
### get file genre [GET]
+ Parameters
+ path (string) - path of file, relative to source root
+ Response 200 (text/plain)
+ Body
genre as identified by analyzer, could be PLAIN, XREFABLE, IMAGE, DATA, HTML
## History [/history{?path,withFiles,start,max}]
### get history entries [GET]
+ Parameters
+ path (string) - path of file/directory to get history for, relative to source root
+ withFiles (optional, boolean) - whether to include list of files
+ start (optional, int) - start index
+ max (optional, int) - number of entries to get (default value 1000)
+ Response 200 (application/json)
+ Body
{
"entries": [
{
"revision": "86b0ab6b",
"date": 1565163646000,
"author": "Adam Hornacek <[email protected]>",
"tags": null,
"message": "Try to use mvnw in CI",
"files": [
"/opengrok/docker/README.md"
]
},
{
"revision": "a391bead",
"date": 1564745178000,
"author": "Adam Hornacek <[email protected]>",
"tags": null,
"message": "Fix docker readme typo",
"files": [
"/opengrok/docker/README.md"
]
},
{
"revision": "33551f14",
"date": 1563531391000,
"author": "Vladimir Kotal <[email protected]>",
"tags": "1.3.0, 1.2.25, 1.2.24",
"message": "document docker-compose",
"files": [
"/opengrok/docker/README.md"
]
}
],
"start": 5,
"count": 3,
"total": 24
}
## Include files reload [/system/includes/reload]
### reloads all include files for web application [PUT]
+ Response 204
## Index searchers refresh [/system/refresh]
### refreshes index searchers for specified project [PUT]
+ Request (text/plain)
+ Body
project name to refresh
+ Response 204
## Messages [/messages{?tag}]
### adds message to a system [POST]
Usable values for `messageLevel` are: `success`, `info`, `warning`, `error`.
This will affect CSS class of the displayed message, leading to different coloring.
The values in the `tags` list can be: `main` (special value for top level message in the whole web application),
project name and project group name.
The format of `duration` is the same as Java's java.time.Duration class,
see https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-
+ Request (application/json)
{
"tags": ["main"],
"messageLevel": "info",
"text":"test message",
"duration":"PT10M"
}
+ Response 201
### deletes messages with specified tag [DELETE]
+ Request (text/plain)
string value of the message text - only messages with the text (and specified tag) will be deleted
+ Parameters
+ tag (string) - tag
+ Response 204
### returns all messages with specified tag [GET]
+ Parameters
+ tag (string) - tag
+ Response 200 (application/json)
[
{
"expired": false,
"created": "2019-01-23 20:39:31 CET",
"tags": [
"main"
],
"expiration": "2019-01-23 20:49:31 CET",
"cssClass": "class",
"text": "test message"
}
]
## Path descriptions [/system/pathdesc]
### updates path descriptions for web application [POST]
+ Request (text/plain)
+ Body
/foo bar
/foo/foo bar bar
+ Response 204
## Projects [/projects]
For all entry points that modify web application configuration it is worth noting that
the configuration has to be retrieved and stored on disk (using the configuration specific
entry points) in order to be persistent (e.g. in case of application server restart or
web application redeploy).
### returns a list of all projects [GET]
+ Response 200 (application/json)
+ Body
["foo","bar"]
### add project [POST]
This will merely add the project and its repositories to the web application configuration.
The project will not be searchable (and thus appear in the UI) until it is indexed.
+ Request (text/plain)
+ Body
text/plain name of the project
+ Response 201
## Project management [/projects/{project}]
### delete project [DELETE]
This will remove the project and its repositories from the web application configuration.
It will also delete project specific data such as index, cross reference pages, history index
and suggester data.
+ Response 204
## Project data management [/projects/{project}/data]
### delete project index data [DELETE]
This will delete project index data but keep the project in web application configuration so that
can be indexed from scratch.
The project data (whatever is the project's directory under source root) will be left intact.
This will also mark the project as not indexed.
+ Response 204
## Project history cache management [/projects/{project}/historycache]
### delete history cache for a project [DELETE]
This will delete history cache for a project.
+ Response 204
## Project metadata management [/projects/{project}/indexed]
This entry point is used by the Indexer once it finishes indexing given project.
### marks project as indexed [PUT]
+ Response 204
## Project index files [/projects/{project}/files]
### Get a list of files tracked by the index database for given project [GET]
+ Response 200 (application/json)
+ Body
["/project/foo.txt","/project/bar.txt"]
## Project metadata [/projects/{project}/property/{field}]
### sets property field for the project [PUT]
+ Request
+ Body
body – string representation of the value to set
+ Response 204
### returns the field value [GET]
+ Response 200 (application/json)
## Project repositories [/projects/{project}/repositories]
### returns a list of repositories for the specified project [GET]
Native path separators (of the system running the service)
will be used for repository paths.
+ Response 200 (application/json)
+ Body
["/opengrok-master/testdata/repositories/teamware",
"/opengrok-master/testdata/sources/rfe2575",
"/opengrok-master/testdata/repositories/rcs_test",
"/opengrok-master"]
## Repository type [/projects/{project}/repositories/type]
### returns types of project repositories [GET]
+ Response 200 (application/json)
+ Body
["RCS","git","SCCS"]
## Project indexed flag [/projects/indexed]
### returns a list of indexed projects [GET]
+ Response 200 (application/json)
+ Body
["sc-2","sc-1"]
## Repository field value [/repositories/property/{field}{?repository}]
### return the field value [GET]
The repository path is relative to source root. Examples of field names:
- `working` (boolean) - is the repository capable of running underlying SCM
commands
- `type` (string) - type of SCM
- `remote` (boolean) - is the SCM source remote
- `parent` (string) - origin/parent of the SCM
- `branch` (string) - branch identification
- `currentVersion` (string) - current revision ID
- `handleRenamedFiles` (boolean) - whether to handle renamed files for history
cache generation
- `historyEnabled` (boolean) - is history enabled
The repository path is relative to source root.
+ Response 200 (application/json)
+ Parameters
+ repository - repository path with native path separators (of the machine
running the service) starting with path separator for which to return type
## Search [/search{?full,def,symbol,path,hist,type,projects,maxresults,start}]
## return search results [GET]
+ Parameters
+ full (optional, string) - full search field value to search for
+ def (optional, string) - definition field value to search for
+ symbol (optional, string) - symbol field value to search for
+ path (optional, string) - file path field value to search for
+ hist (optional, string) - history field value to search for
+ type (optional, string) - type of the files to search for
+ projects (optional, string) - projects to search in
+ maxresults (optional, string) - maximum number of documents whose hits will be returned (default 1000)
+ start (optional, string) - start index from which to return results
+ Response 200 (application/json)
+ Body
{
"time": 13,
"resultCount": 35,
"startDocument": 0,
"endDocument": 0,
"results": {
"/opengrok/test/org/opensolaris/opengrok/history/hg-export-renamed.txt": [{
"line": "# User Vladimir <b>Kotal</b> <Vladimir.<b>Kotal</b>@oracle.com>",
"lineNumber": "19"
},{
"line": "# User Vladimir <b>Kotal</b> <Vladimir.<b>Kotal</b>@oracle.com>",
"lineNumber":"29"
}]
}
## Statistics [/stats]
### returns statistics [GET]
+ Response 200 (application/json)
+ Body
{"requests_per_minute_max":2,"timing":{"authorization":9,"authorization_in_stack_default stack_of_OpenGrok":0,
"authorization_in_stack_default stack_positive":0,"authorization_of_OpenGrok":9,
"authorization_positive_of_OpenGrok":9,"root":1109,"*":1109,"authorization_in_stack_default stack_positive_of_OpenGrok":0,
"authorization_positive":9},"minutes":1,"timing_min":{"authorization":0,"authorization_in_stack_default stack_of_OpenGrok":0,
"authorization_in_stack_default stack_positive":0,"authorization_of_OpenGrok":0,
"authorization_positive_of_OpenGrok":0,"root":4,"*":4,"authorization_in_stack_default stack_positive_of_OpenGrok":0,
"authorization_positive":0},"timing_avg":{"authorization":4.5,"authorization_in_stack_default stack_of_OpenGrok":0.0,
"authorization_in_stack_default stack_positive":0.0,"authorization_of_OpenGrok":4.5,
"authorization_positive_of_OpenGrok":4.5,"root":554.5,"*":554.5,
"authorization_in_stack_default stack_positive_of_OpenGrok":0.0,"authorization_positive":4.5},
"request_categories":{"authorization":2,"authorization_in_stack_default stack_of_OpenGrok":2,
"authorization_in_stack_default stack_positive":2,"authorization_cache_misses":2,
"authorization_of_OpenGrok":2,"authorization_cache_hits":4,
"authorization_positive_of_OpenGrok":2,"root":2,"*":2,
"authorization_in_stack_default stack_positive_of_OpenGrok":2,
"authorization_positive":2},
"day_histogram":[0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0],"requests":2,
"requests_per_minute_min":1,"requests_per_minute":2,"requests_per_minute_avg":2.0,
"month_histogram":[0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"timing_max":{"authorization":9,"authorization_in_stack_default stack_of_OpenGrok":0,
"authorization_in_stack_default stack_positive":0,"authorization_of_OpenGrok":9,
"authorization_positive_of_OpenGrok":9,"root":1105,"*":1105,
"authorization_in_stack_default stack_positive_of_OpenGrok":0,"authorization_positive":9}}
### deletes statistics [DELETE]
+ Response 204
## Statistics reload [/stats/reload]
### reloads statistics (useful when configuration path to statistics changed) [PUT]
+ Response 204
## Suggester [/suggest{?projects,field,caret,full,defs,refs,path,hist,type}]
### returns suggestions [GET]
+ Parameters
+ projects (string) - list of projects for which to retrieve suggestions
+ field - field for which to suggest
+ caret - position of the caret in the input field
+ full - value of the Full Search input
+ defs - value of the Definitions input
+ refs - value of Symbol input
+ path - value of the File Path input
+ hist - value of the History input
+ type - value of the Type input
+ Response 200 (application/json)
+ Body
{
"time": 60,
"suggestions": [{
"phrase": "package",
"projects": ["kotlin"],
"score": 387
}],
"identifier": "pprttq",
"queryText": "pprttq",
"partialResult":false
}
## Suggester configuration [/suggest/config]
### returns suggester configuration [GET]
+ Response 200 (application/json)
+ Body
{"enabled":true,"maxResults":10,"minChars":4,"allowedProjects":null,
"maxProjects":2147483647,
"allowedFields":["defs","path","hist","refs","type","full"],
"allowComplexQueries":true,"allowMostPopular":true,"showScores":false,
"showProjects":true,"showTime":false,"rebuildCronConfig":"0 0 * * *",
"buildTerminationTime":1800,"timeThreshold":2000}
## Suggester popularity data initialization with queries [/suggest/init/queries]
### updates popularity data based on the queries [POST]
+ Request (application/json)
+ Body
["http://localhost:8080/source/search?project=kotlin&full=text"]
+ Response 204
## Suggester popularity data initialization [/suggest/init/raw]
### updates popularity data based on the provided data [POST]
+ Request (application/json)
+ Body
[{"project":"kotlin","field":"full","token":"args","increment":100}]
+ Response 204
## Suggester popularity data [/suggest/popularity/{project}{?field,page,pageSize,all}]
### retrieves popularity data for project [GET]
+ Parameters
+ field - field for which to retrieve data, default: full
+ page - page of data, default: 0
+ pageSize - size of the page, default: 100
+ all - if all data should be retrieved, if true then page and pageSize params are ignored
+ Response 200 (application/json)
+ Body
[{"iso":3},{"the":3},{"to":3},{"conform":3},{"-":2},
{"sc_window_set":1},{"_lso_outbound":1},{"missing":1}]
## Suggester data rebuild [/suggest/rebuild]
### rebuilds suggester data for all projects [PUT]
This kicks off suggester data rebuild in the background, i.e. the rebuild will very likely complete some time after the API call returned.
+ Response 204
## Suggester project data rebuild [/suggest/rebuild/{project}]
### rebuilds suggester data for given project [PUT]
This kicks off suggester data rebuild in the background, i.e. the rebuild will very likely complete some time after the API call returned.
+ Parameters
+ project - project name
+ Response 204