blob: 0c69f7d4db84ab6e38019a36f6c8fcb0767e4398 [file] [log] [blame]
Edwin Kempin36eeee22013-08-30 15:57:34 +02001Gerrit Code Review - /plugins/ REST API
2=======================================
3
4This page describes the plugin related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin36eeee22013-08-30 15:57:34 +02008[[plugin-endpoints]]
9Plugin Endpoints
10----------------
11
Edwin Kempin9de428c2013-09-02 14:44:21 +020012Gerrit REST endpoints for installed plugins are available under
13'/plugins/link:#plugin-id[\{plugin-id\}]/gerrit~<endpoint-id>'.
14The `gerrit~` prefix ensures that the Gerrit REST endpoints for plugins
15do not clash with any REST endpoint that a plugin may offer under its
16namespace.
17
18
19[[list-plugins]]
20List Plugins
21~~~~~~~~~~~~
22[verse]
23'GET /plugins/'
24
25Lists the plugins installed on the Gerrit server. Only the enabled
26plugins are returned unless the `all` option is specified.
27
28As result a map is returned that maps the plugin IDs to
29link:#plugin-info[PluginInfo] entries. The entries in the map are sorted
30by plugin ID.
31
32.Request
33----
34 GET /plugins/?all HTTP/1.0
35----
36
37.Response
38----
39 HTTP/1.1 200 OK
40 Content-Disposition: attachment
41 Content-Type: application/json;charset=UTF-8
42
43 )]}'
44 {
45 "delete-project": {
46 "kind": "gerritcodereview#plugin",
47 "id": "delete-project",
David Pursehouse62864b72013-10-17 23:05:08 +090048 "version": "2.9-SNAPSHOT"
Edwin Kempin9de428c2013-09-02 14:44:21 +020049 },
50 "reviewers-by-blame": {
51 "kind": "gerritcodereview#plugin",
52 "id": "reviewers-by-blame",
David Pursehouse62864b72013-10-17 23:05:08 +090053 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020054 "disabled": true
55 }
56 }
57----
58
Edwin Kempin36eeee22013-08-30 15:57:34 +020059[[install-plugin]]
60Install Plugin
61~~~~~~~~~~~~~~
62[verse]
63'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
64
65Installs a new plugin on the Gerrit server. If a plugin with the
David Ostrovsky366ad0e2013-09-05 19:59:09 +020066specified name already exists it is overwritten. Note: if the plugin
67provides its own name in the MANIFEST file, then the plugin name from
68the MANIFEST file has precedence over the \{plugin-id\} above.
Edwin Kempin36eeee22013-08-30 15:57:34 +020069
70The plugin jar can either be sent as binary data in the request body
71or a URL to the plugin jar must be provided in the request body inside
72a link:#plugin-input[PluginInput] entity.
73
74.Request
75----
76 PUT /plugins/delete-project HTTP/1.0
77 Content-Type: application/json;charset=UTF-8
78
79 {
80 "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar"
81 }
82----
83
84To provide the plugin jar as binary data in the request body the
85following curl command can be used:
86
87----
88 curl --digest --user admin:TNNuLkWsIV8w -X PUT --data-binary @delete-project-2.8.jar 'http://gerrit:8080/a/plugins/delete-project'
89----
90
91As response a link:#plugin-info[PluginInfo] entity is returned that
92describes the plugin.
93
94.Response
95----
96 HTTP/1.1 201 Created
97 Content-Disposition: attachment
98 Content-Type: application/json;charset=UTF-8
99
100 )]}'
101 {
102 "kind": "gerritcodereview#plugin",
103 "id": "delete-project",
104 "version": "2.8"
105 }
106----
107
108If an existing plugin was overwritten the response is "`200 OK`".
109
Edwin Kempin9de428c2013-09-02 14:44:21 +0200110[[get-plugin-status]]
111Get Plugin Status
112~~~~~~~~~~~~~~~~~
113[verse]
114'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
115
116Retrieves the status of a plugin on the Gerrit server.
117
118.Request
119----
120 GET /plugins/delete-project/gerrit~status HTTP/1.0
121----
122
123As response a link:#plugin-info[PluginInfo] entity is returned that
124describes the plugin.
125
126.Response
127----
128 HTTP/1.1 200 OK
129 Content-Disposition: attachment
130 Content-Type: application/json;charset=UTF-8
131
132 )]}'
133 {
134 "kind": "gerritcodereview#plugin",
135 "id": "delete-project",
136 "version": "2.8"
137 }
138----
139
140[[enable-plugin]]
141Enable Plugin
142~~~~~~~~~~~~~
143[verse]
144'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
145
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
160 Content-Type: application/json;charset=UTF-8
161
162 )]}'
163 {
164 "kind": "gerritcodereview#plugin",
165 "id": "delete-project",
166 "version": "2.8"
167 }
168----
169
170[[disable-plugin]]
171Disable Plugin
172~~~~~~~~~~~~~~
173[verse]
174'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
175
176OR
177
178[verse]
179'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
180
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
195 Content-Type: application/json;charset=UTF-8
196
197 )]}'
198 {
199 "kind": "gerritcodereview#plugin",
200 "id": "delete-project",
201 "version": "2.8",
202 "disabled": true
203 }
204----
205
206[[reload-plugin]]
207Reload Plugin
208~~~~~~~~~~~~~
209[verse]
210'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
211
212Reloads a plugin on the Gerrit server.
213
214.Request
215----
216 POST /plugins/delete-project/gerrit~reload HTTP/1.0
217----
218
219As response a link:#plugin-info[PluginInfo] entity is returned that
220describes the plugin.
221
222.Response
223----
224 HTTP/1.1 200 OK
225 Content-Disposition: attachment
226 Content-Type: application/json;charset=UTF-8
227
228 )]}'
229 {
230 "kind": "gerritcodereview#plugin",
231 "id": "delete-project",
232 "version": "2.8",
233 "disabled": true
234 }
235----
236
Edwin Kempin36eeee22013-08-30 15:57:34 +0200237
238[[ids]]
239IDs
240---
241
242[[plugin-id]]
243\{plugin-id\}
244~~~~~~~~~~~~~
245The ID of the plugin.
246
Edwin Kempin36eeee22013-08-30 15:57:34 +0200247[[json-entities]]
248JSON Entities
249-------------
250
251[[plugin-info]]
252PluginInfo
253~~~~~~~~~~
254The `PluginInfo` entity describes a plugin.
255
Edwin Kempin9de428c2013-09-02 14:44:21 +0200256[options="header",width="50%",cols="1,^2,4"]
257|=======================
258|Field Name||Description
259|`kind` ||`gerritcodereview#plugin`
260|`id` ||The ID of the plugin.
261|`version` ||The version of the plugin.
262|`disabled`|not set if `false`|Whether the plugin is disabled.
263|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200264
265[[plugin-input]]
266PluginInput
267~~~~~~~~~~~
268The `PluginInput` entity describes a plugin that should be installed.
269
270[options="header",width="50%",cols="1,6"]
271|======================
272|Field Name|Description
273|`url` |URL to the plugin jar.
274|======================
275
276
277GERRIT
278------
279Part of link:index.html[Gerrit Code Review]