blob: dfe9f0ec0215c98461152499dbbc6b240b8a5507 [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----
36 GET /plugins/?all HTTP/1.0
37----
38
39.Response
40----
41 HTTP/1.1 200 OK
42 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090043 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +020044
45 )]}'
46 {
47 "delete-project": {
Edwin Kempin9de428c2013-09-02 14:44:21 +020048 "id": "delete-project",
David Ostrovsky83c79862013-12-05 21:40:36 +010049 "index_url": "plugins/delete-project/",
Colby Ranger4d3226c2013-12-09 09:01:42 -080050 "version": "2.9-SNAPSHOT"
Edwin Kempin9de428c2013-09-02 14:44:21 +020051 },
52 "reviewers-by-blame": {
Edwin Kempin9de428c2013-09-02 14:44:21 +020053 "id": "reviewers-by-blame",
David Ostrovsky83c79862013-12-05 21:40:36 +010054 "index_url": "plugins/reviewers-by-blame/",
David Pursehouse62864b72013-10-17 23:05:08 +090055 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020056 "disabled": true
Colby Ranger4d3226c2013-12-09 09:01:42 -080057 }
Edwin Kempin9de428c2013-09-02 14:44:21 +020058 }
59----
60
Edwin Kempin36eeee22013-08-30 15:57:34 +020061[[install-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080062=== Install Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080063--
Edwin Kempin36eeee22013-08-30 15:57:34 +020064'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080065--
Edwin Kempin36eeee22013-08-30 15:57:34 +020066
67Installs a new plugin on the Gerrit server. If a plugin with the
David Ostrovsky366ad0e2013-09-05 19:59:09 +020068specified name already exists it is overwritten. Note: if the plugin
69provides its own name in the MANIFEST file, then the plugin name from
70the MANIFEST file has precedence over the \{plugin-id\} above.
Edwin Kempin36eeee22013-08-30 15:57:34 +020071
72The plugin jar can either be sent as binary data in the request body
73or a URL to the plugin jar must be provided in the request body inside
74a link:#plugin-input[PluginInput] entity.
75
76.Request
77----
78 PUT /plugins/delete-project HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090079 Content-Type: application/json; charset=UTF-8
Edwin Kempin36eeee22013-08-30 15:57:34 +020080
81 {
82 "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar"
83 }
84----
85
86To provide the plugin jar as binary data in the request body the
87following curl command can be used:
88
89----
90 curl --digest --user admin:TNNuLkWsIV8w -X PUT --data-binary @delete-project-2.8.jar 'http://gerrit:8080/a/plugins/delete-project'
91----
92
93As response a link:#plugin-info[PluginInfo] entity is returned that
94describes the plugin.
95
96.Response
97----
98 HTTP/1.1 201 Created
99 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900100 Content-Type: application/json; charset=UTF-8
Edwin Kempin36eeee22013-08-30 15:57:34 +0200101
102 )]}'
103 {
Edwin Kempin36eeee22013-08-30 15:57:34 +0200104 "id": "delete-project",
105 "version": "2.8"
106 }
107----
108
109If an existing plugin was overwritten the response is "`200 OK`".
110
Edwin Kempin9de428c2013-09-02 14:44:21 +0200111[[get-plugin-status]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800112=== Get Plugin Status
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800113--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200114'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800115--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200116
117Retrieves the status of a plugin on the Gerrit server.
118
119.Request
120----
121 GET /plugins/delete-project/gerrit~status HTTP/1.0
122----
123
124As response a link:#plugin-info[PluginInfo] entity is returned that
125describes the plugin.
126
127.Response
128----
129 HTTP/1.1 200 OK
130 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900131 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200132
133 )]}'
134 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200135 "id": "delete-project",
136 "version": "2.8"
137 }
138----
139
140[[enable-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800141=== Enable Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800142--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200143'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800144--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200145
146Enables a plugin on the Gerrit server.
147
148.Request
149----
150 POST /plugins/delete-project/gerrit~enable HTTP/1.0
151----
152
153As response a link:#plugin-info[PluginInfo] entity is returned that
154describes the plugin.
155
156.Response
157----
158 HTTP/1.1 200 OK
159 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900160 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200161
162 )]}'
163 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200164 "id": "delete-project",
165 "version": "2.8"
166 }
167----
168
169[[disable-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800170=== Disable Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800171--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200172'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800173--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200174
175OR
176
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800177--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200178'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800179--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200180
181Disables a plugin on the Gerrit server.
182
183.Request
184----
185 POST /plugins/delete-project/gerrit~disable HTTP/1.0
186----
187
188As response a link:#plugin-info[PluginInfo] entity is returned that
189describes the plugin.
190
191.Response
192----
193 HTTP/1.1 200 OK
194 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900195 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200196
197 )]}'
198 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200199 "id": "delete-project",
200 "version": "2.8",
201 "disabled": true
202 }
203----
204
205[[reload-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800206=== Reload Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800207--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200208'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800209--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200210
211Reloads a plugin on the Gerrit server.
212
213.Request
214----
215 POST /plugins/delete-project/gerrit~reload HTTP/1.0
216----
217
218As response a link:#plugin-info[PluginInfo] entity is returned that
219describes the plugin.
220
221.Response
222----
223 HTTP/1.1 200 OK
224 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900225 Content-Type: application/json; charset=UTF-8
Edwin Kempin9de428c2013-09-02 14:44:21 +0200226
227 )]}'
228 {
Edwin Kempin9de428c2013-09-02 14:44:21 +0200229 "id": "delete-project",
230 "version": "2.8",
231 "disabled": true
232 }
233----
234
Edwin Kempin36eeee22013-08-30 15:57:34 +0200235
236[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800237== IDs
Edwin Kempin36eeee22013-08-30 15:57:34 +0200238
239[[plugin-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800240=== \{plugin-id\}
Edwin Kempin36eeee22013-08-30 15:57:34 +0200241The ID of the plugin.
242
Edwin Kempin36eeee22013-08-30 15:57:34 +0200243[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800244== JSON Entities
Edwin Kempin36eeee22013-08-30 15:57:34 +0200245
246[[plugin-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800247=== PluginInfo
Edwin Kempin36eeee22013-08-30 15:57:34 +0200248The `PluginInfo` entity describes a plugin.
249
David Pursehouseae367192014-11-25 17:24:47 +0900250[options="header",cols="1,^2,4"]
Edwin Kempin9de428c2013-09-02 14:44:21 +0200251|=======================
David Ostrovsky83c79862013-12-05 21:40:36 +0100252|Field Name ||Description
David Ostrovsky83c79862013-12-05 21:40:36 +0100253|`id` ||The ID of the plugin.
254|`version` ||The version of the plugin.
255|`index_url`|optional|URL of the plugin's default page.
256|`disabled` |not set if `false`|Whether the plugin is disabled.
Edwin Kempin9de428c2013-09-02 14:44:21 +0200257|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200258
259[[plugin-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800260=== PluginInput
Edwin Kempin36eeee22013-08-30 15:57:34 +0200261The `PluginInput` entity describes a plugin that should be installed.
262
David Pursehouseae367192014-11-25 17:24:47 +0900263[options="header",cols="1,6"]
Edwin Kempin36eeee22013-08-30 15:57:34 +0200264|======================
265|Field Name|Description
266|`url` |URL to the plugin jar.
267|======================
268
269
270GERRIT
271------
272Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700273
274SEARCHBOX
275---------