blob: 938d101d8ec670c6348cd08188647c09f93612a1 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - /plugins/ REST API
Edwin Kempin36eeee22013-08-30 15:57:34 +02002
3This page describes the plugin related REST endpoints.
4Please also take note of the general information on the
5link:rest-api.html[REST API].
6
Edwin Kempin36eeee22013-08-30 15:57:34 +02007[[plugin-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008== Plugin Endpoints
Edwin Kempin36eeee22013-08-30 15:57:34 +02009
Edwin Kempin9de428c2013-09-02 14:44:21 +020010Gerrit REST endpoints for installed plugins are available under
11'/plugins/link:#plugin-id[\{plugin-id\}]/gerrit~<endpoint-id>'.
12The `gerrit~` prefix ensures that the Gerrit REST endpoints for plugins
13do not clash with any REST endpoint that a plugin may offer under its
14namespace.
15
16
17[[list-plugins]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080018=== List Plugins
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080019--
Edwin Kempin9de428c2013-09-02 14:44:21 +020020'GET /plugins/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080021--
Edwin Kempin9de428c2013-09-02 14:44:21 +020022
23Lists the plugins installed on the Gerrit server. Only the enabled
24plugins are returned unless the `all` option is specified.
25
Edwin Kempin362b14d12014-05-09 14:18:12 +020026To be allowed to see the installed plugins, a user must be a member of
27a group that is granted the 'View Plugins' capability or the
28'Administrate Server' capability.
29
Edwin Kempin9de428c2013-09-02 14:44:21 +020030As result a map is returned that maps the plugin IDs to
31link:#plugin-info[PluginInfo] entries. The entries in the map are sorted
32by plugin ID.
33
34.Request
35----
David Pursehouse91727022017-07-28 14:13:18 +010036 GET /plugins/ HTTP/1.0
37----
38
39.Response
40----
41 HTTP/1.1 200 OK
42 Content-Disposition: attachment
43 Content-Type: application/json; charset=UTF-8
44
45 )]}'
46 {
47 "delete-project": {
48 "id": "delete-project",
49 "index_url": "plugins/delete-project/",
David Pursehouse4a648212017-08-04 21:03:28 +020050 "filename": "delete-project.jar",
David Pursehouse91727022017-07-28 14:13:18 +010051 "version": "2.9-SNAPSHOT"
52 }
53 }
54----
55
56[[plugin-options]]
57==== Plugin Options
58All(a)::
59List all plugins including those that are disabled.
60
61.Request
62----
Edwin Kempin9de428c2013-09-02 14:44:21 +020063 GET /plugins/?all HTTP/1.0
64----
65
66.Response
67----
68 HTTP/1.1 200 OK
69 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090070 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +020071
72 )]}'
73 {
74 "delete-project": {
Edwin Kempin9de428c2013-09-02 14:44:21 +020075 "id": "delete-project",
David Ostrovsky83c79862013-12-05 21:40:36 +010076 "index_url": "plugins/delete-project/",
David Pursehouse4a648212017-08-04 21:03:28 +020077 "filename": "delete-project.jar",
Colby Ranger4d3226c2013-12-09 09:01:42 -080078 "version": "2.9-SNAPSHOT"
Edwin Kempin9de428c2013-09-02 14:44:21 +020079 },
80 "reviewers-by-blame": {
Edwin Kempin9de428c2013-09-02 14:44:21 +020081 "id": "reviewers-by-blame",
David Ostrovsky83c79862013-12-05 21:40:36 +010082 "index_url": "plugins/reviewers-by-blame/",
David Pursehouse4a648212017-08-04 21:03:28 +020083 "filename": "reviewers-by-blame.jar",
David Pursehouse62864b72013-10-17 23:05:08 +090084 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020085 "disabled": true
Colby Ranger4d3226c2013-12-09 09:01:42 -080086 }
Edwin Kempin9de428c2013-09-02 14:44:21 +020087 }
88----
89
David Pursehouse7f577a92017-07-27 17:32:28 +010090Limit(n)::
91Limit the number of plugins to be included in the results.
92+
93Query the first plugin in the plugin list:
94+
95.Request
96----
97 GET /plugins/?n=1 HTTP/1.0
98----
99+
100.Response
101----
102 HTTP/1.1 200 OK
103 Content-Disposition: attachment
104 Content-Type: application/json; charset=UTF-8
105
106 )]}'
107 {
108 "delete-project": {
109 "id": "delete-project",
110 "index_url": "plugins/delete-project/",
David Pursehouse4a648212017-08-04 21:03:28 +0200111 "filename": "delete-project.jar",
David Pursehouse7f577a92017-07-27 17:32:28 +0100112 "version": "2.9-SNAPSHOT"
113 }
114 }
115----
116
David Pursehouse68d975b2017-07-27 22:14:38 +0100117Prefix(p)::
118Limit the results to those plugins that start with the specified
119prefix.
120+
121The match is case sensitive. May not be used together with `m` or `r`.
122+
123List all plugins that start with `delete`:
124+
125.Request
126----
127 GET /plugins/?p=delete HTTP/1.0
128----
129+
130.Response
131----
132 HTTP/1.1 200 OK
133 Content-Disposition: attachment
134 Content-Type: application/json; charset=UTF-8
135
136 )]}'
137 {
138 "delete-project": {
139 "id": "delete-project",
140 "index_url": "plugins/delete-project/",
David Pursehouse4a648212017-08-04 21:03:28 +0200141 "filename": "delete-project.jar",
David Pursehouse68d975b2017-07-27 22:14:38 +0100142 "version": "2.9-SNAPSHOT"
143 }
144 }
145----
146+
147E.g. this feature can be used by suggestion client UI's to limit results.
148
149Regex(r)::
150Limit the results to those plugins that match the specified regex.
151+
152Boundary matchers '^' and '$' are implicit. For example: the regex 'test.*' will
153match any plugins that start with 'test' and regex '.*test' will match any
154project that end with 'test'.
155+
156The match is case sensitive. May not be used together with `m` or `p`.
157+
158List all plugins that match regex `some.*plugin`:
159+
160.Request
161----
162 GET /plugins/?r=some.*plugin HTTP/1.0
163----
164+
165.Response
166----
167 HTTP/1.1 200 OK
168 Content-Disposition: attachment
169 Content-Type: application/json; charset=UTF-8
170
171 )]}'
172 {
173 "some-plugin": {
174 "id": "some-plugin",
175 "index_url": "plugins/some-plugin/",
David Pursehouse4a648212017-08-04 21:03:28 +0200176 "filename": "some-plugin.jar",
David Pursehouse68d975b2017-07-27 22:14:38 +0100177 "version": "2.9-SNAPSHOT"
178 },
179 "some-other-plugin": {
180 "id": "some-other-plugin",
181 "index_url": "plugins/some-other-plugin/",
David Pursehouse4a648212017-08-04 21:03:28 +0200182 "filename": "some-other-plugin.jar",
David Pursehouse68d975b2017-07-27 22:14:38 +0100183 "version": "2.9-SNAPSHOT"
184 }
185 }
186
187----
David Pursehouse7f577a92017-07-27 17:32:28 +0100188
189Skip(S)::
190Skip the given number of plugins from the beginning of the list.
191+
192Query the second plugin in the plugin list:
193+
194.Request
195----
196 GET /plugins/?all&n=1&S=1 HTTP/1.0
197----
198+
199.Response
200----
201 HTTP/1.1 200 OK
202 Content-Disposition: attachment
203 Content-Type: application/json; charset=UTF-8
204
205 )]}'
206 {
207 "reviewers-by-blame": {
208 "id": "reviewers-by-blame",
209 "index_url": "plugins/reviewers-by-blame/",
David Pursehouse4a648212017-08-04 21:03:28 +0200210 "filename": "reviewers-by-blame.jar",
David Pursehouse7f577a92017-07-27 17:32:28 +0100211 "version": "2.9-SNAPSHOT",
212 "disabled": true
213 }
214 }
215----
216
David Pursehouse68d975b2017-07-27 22:14:38 +0100217Substring(m)::
218Limit the results to those plugins that match the specified substring.
219+
220The match is case insensitive. May not be used together with `r` or `p`.
221+
222List all plugins that match substring `project`:
223+
224.Request
225----
226 GET /plugins/?m=project HTTP/1.0
227----
228+
229.Response
230----
231 HTTP/1.1 200 OK
232 Content-Disposition: attachment
233 Content-Type: application/json; charset=UTF-8
234
235 )]}'
236 {
237 "delete-project": {
238 "id": "delete-project",
239 "index_url": "plugins/delete-project/",
David Pursehouse4a648212017-08-04 21:03:28 +0200240 "filename": "delete-project.jar",
David Pursehouse68d975b2017-07-27 22:14:38 +0100241 "version": "2.9-SNAPSHOT"
242 }
243 }
244----
David Pursehouse7f577a92017-07-27 17:32:28 +0100245
Edwin Kempin36eeee22013-08-30 15:57:34 +0200246[[install-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800247=== Install Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800248--
Edwin Kempin36eeee22013-08-30 15:57:34 +0200249'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800250--
Edwin Kempin36eeee22013-08-30 15:57:34 +0200251
252Installs a new plugin on the Gerrit server. If a plugin with the
David Ostrovsky366ad0e2013-09-05 19:59:09 +0200253specified name already exists it is overwritten. Note: if the plugin
254provides its own name in the MANIFEST file, then the plugin name from
255the MANIFEST file has precedence over the \{plugin-id\} above.
Edwin Kempin36eeee22013-08-30 15:57:34 +0200256
257The plugin jar can either be sent as binary data in the request body
258or a URL to the plugin jar must be provided in the request body inside
259a link:#plugin-input[PluginInput] entity.
260
261.Request
262----
263 PUT /plugins/delete-project HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900264 Content-Type: application/json; charset=UTF-8
Edwin Kempin36eeee22013-08-30 15:57:34 +0200265
266 {
267 "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar"
268 }
269----
270
271To provide the plugin jar as binary data in the request body the
272following curl command can be used:
273
274----
Han-Wen Nienhuys84d830b2017-02-15 16:36:04 +0100275 curl --user admin:TNNuLkWsIV8w -X PUT --data-binary @delete-project-2.8.jar 'http://gerrit:8080/a/plugins/delete-project'
Edwin Kempin36eeee22013-08-30 15:57:34 +0200276----
277
278As response a link:#plugin-info[PluginInfo] entity is returned that
279describes the plugin.
280
281.Response
282----
283 HTTP/1.1 201 Created
284 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900285 Content-Type: application/json; charset=UTF-8
Edwin Kempin36eeee22013-08-30 15:57:34 +0200286
287 )]}'
288 {
Edwin Kempin36eeee22013-08-30 15:57:34 +0200289 "id": "delete-project",
290 "version": "2.8"
291 }
292----
293
294If an existing plugin was overwritten the response is "`200 OK`".
295
Edwin Kempin9de428c2013-09-02 14:44:21 +0200296[[get-plugin-status]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800297=== Get Plugin Status
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800298--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200299'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800300--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200301
302Retrieves the status of a plugin on the Gerrit server.
303
304.Request
305----
306 GET /plugins/delete-project/gerrit~status HTTP/1.0
307----
308
309As response a link:#plugin-info[PluginInfo] entity is returned that
310describes the plugin.
311
312.Response
313----
314 HTTP/1.1 200 OK
315 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900316 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200317
318 )]}'
319 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200320 "id": "delete-project",
321 "version": "2.8"
322 }
323----
324
325[[enable-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800326=== Enable Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800327--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200328'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800329--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200330
331Enables a plugin on the Gerrit server.
332
333.Request
334----
335 POST /plugins/delete-project/gerrit~enable HTTP/1.0
336----
337
338As response a link:#plugin-info[PluginInfo] entity is returned that
339describes the plugin.
340
341.Response
342----
343 HTTP/1.1 200 OK
344 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900345 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200346
347 )]}'
348 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200349 "id": "delete-project",
350 "version": "2.8"
351 }
352----
353
354[[disable-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800355=== Disable Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800356--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200357'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800358--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200359
360OR
361
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800362--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200363'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800364--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200365
366Disables a plugin on the Gerrit server.
367
368.Request
369----
370 POST /plugins/delete-project/gerrit~disable HTTP/1.0
371----
372
373As response a link:#plugin-info[PluginInfo] entity is returned that
374describes the plugin.
375
376.Response
377----
378 HTTP/1.1 200 OK
379 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900380 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200381
382 )]}'
383 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200384 "id": "delete-project",
385 "version": "2.8",
386 "disabled": true
387 }
388----
389
390[[reload-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800391=== Reload Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800392--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200393'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800394--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200395
396Reloads a plugin on the Gerrit server.
397
398.Request
399----
400 POST /plugins/delete-project/gerrit~reload HTTP/1.0
401----
402
403As response a link:#plugin-info[PluginInfo] entity is returned that
404describes the plugin.
405
406.Response
407----
408 HTTP/1.1 200 OK
409 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900410 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200411
412 )]}'
413 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200414 "id": "delete-project",
415 "version": "2.8",
416 "disabled": true
417 }
418----
419
Edwin Kempin36eeee22013-08-30 15:57:34 +0200420
421[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800422== IDs
Edwin Kempin36eeee22013-08-30 15:57:34 +0200423
424[[plugin-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800425=== \{plugin-id\}
Edwin Kempin36eeee22013-08-30 15:57:34 +0200426The ID of the plugin.
427
Edwin Kempin36eeee22013-08-30 15:57:34 +0200428[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800429== JSON Entities
Edwin Kempin36eeee22013-08-30 15:57:34 +0200430
431[[plugin-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800432=== PluginInfo
Edwin Kempin36eeee22013-08-30 15:57:34 +0200433The `PluginInfo` entity describes a plugin.
434
David Pursehouseae367192014-11-25 17:24:47 +0900435[options="header",cols="1,^2,4"]
Edwin Kempin9de428c2013-09-02 14:44:21 +0200436|=======================
David Ostrovsky83c79862013-12-05 21:40:36 +0100437|Field Name ||Description
David Ostrovsky83c79862013-12-05 21:40:36 +0100438|`id` ||The ID of the plugin.
439|`version` ||The version of the plugin.
440|`index_url`|optional|URL of the plugin's default page.
David Pursehouse4a648212017-08-04 21:03:28 +0200441|`filename` |optional|The plugin's filename.
David Ostrovsky83c79862013-12-05 21:40:36 +0100442|`disabled` |not set if `false`|Whether the plugin is disabled.
Edwin Kempin9de428c2013-09-02 14:44:21 +0200443|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200444
445[[plugin-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800446=== PluginInput
Edwin Kempin36eeee22013-08-30 15:57:34 +0200447The `PluginInput` entity describes a plugin that should be installed.
448
David Pursehouseae367192014-11-25 17:24:47 +0900449[options="header",cols="1,6"]
Edwin Kempin36eeee22013-08-30 15:57:34 +0200450|======================
451|Field Name|Description
452|`url` |URL to the plugin jar.
453|======================
454
455
456GERRIT
457------
458Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700459
460SEARCHBOX
461---------