blob: e9e0a1c972cee981b9f6f7cad55bf30250e9bfaa [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~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080022--
Edwin Kempin9de428c2013-09-02 14:44:21 +020023'GET /plugins/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080024--
Edwin Kempin9de428c2013-09-02 14:44:21 +020025
26Lists the plugins installed on the Gerrit server. Only the enabled
27plugins are returned unless the `all` option is specified.
28
29As result a map is returned that maps the plugin IDs to
30link:#plugin-info[PluginInfo] entries. The entries in the map are sorted
31by plugin ID.
32
33.Request
34----
35 GET /plugins/?all HTTP/1.0
36----
37
38.Response
39----
40 HTTP/1.1 200 OK
41 Content-Disposition: attachment
42 Content-Type: application/json;charset=UTF-8
43
44 )]}'
45 {
46 "delete-project": {
47 "kind": "gerritcodereview#plugin",
48 "id": "delete-project",
David Ostrovsky83c79862013-12-05 21:40:36 +010049 "index_url": "plugins/delete-project/",
50 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020051 },
52 "reviewers-by-blame": {
53 "kind": "gerritcodereview#plugin",
54 "id": "reviewers-by-blame",
David Ostrovsky83c79862013-12-05 21:40:36 +010055 "index_url": "plugins/reviewers-by-blame/",
David Pursehouse62864b72013-10-17 23:05:08 +090056 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020057 "disabled": true
David Ostrovsky83c79862013-12-05 21:40:36 +010058 },
Edwin Kempin9de428c2013-09-02 14:44:21 +020059 }
60----
61
Edwin Kempin36eeee22013-08-30 15:57:34 +020062[[install-plugin]]
63Install Plugin
64~~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080065--
Edwin Kempin36eeee22013-08-30 15:57:34 +020066'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080067--
Edwin Kempin36eeee22013-08-30 15:57:34 +020068
69Installs a new plugin on the Gerrit server. If a plugin with the
David Ostrovsky366ad0e2013-09-05 19:59:09 +020070specified name already exists it is overwritten. Note: if the plugin
71provides its own name in the MANIFEST file, then the plugin name from
72the MANIFEST file has precedence over the \{plugin-id\} above.
Edwin Kempin36eeee22013-08-30 15:57:34 +020073
74The plugin jar can either be sent as binary data in the request body
75or a URL to the plugin jar must be provided in the request body inside
76a link:#plugin-input[PluginInput] entity.
77
78.Request
79----
80 PUT /plugins/delete-project HTTP/1.0
81 Content-Type: application/json;charset=UTF-8
82
83 {
84 "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar"
85 }
86----
87
88To provide the plugin jar as binary data in the request body the
89following curl command can be used:
90
91----
92 curl --digest --user admin:TNNuLkWsIV8w -X PUT --data-binary @delete-project-2.8.jar 'http://gerrit:8080/a/plugins/delete-project'
93----
94
95As response a link:#plugin-info[PluginInfo] entity is returned that
96describes the plugin.
97
98.Response
99----
100 HTTP/1.1 201 Created
101 Content-Disposition: attachment
102 Content-Type: application/json;charset=UTF-8
103
104 )]}'
105 {
106 "kind": "gerritcodereview#plugin",
107 "id": "delete-project",
108 "version": "2.8"
109 }
110----
111
112If an existing plugin was overwritten the response is "`200 OK`".
113
Edwin Kempin9de428c2013-09-02 14:44:21 +0200114[[get-plugin-status]]
115Get Plugin Status
116~~~~~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800117--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200118'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800119--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200120
121Retrieves the status of a plugin on the Gerrit server.
122
123.Request
124----
125 GET /plugins/delete-project/gerrit~status HTTP/1.0
126----
127
128As response a link:#plugin-info[PluginInfo] entity is returned that
129describes the plugin.
130
131.Response
132----
133 HTTP/1.1 200 OK
134 Content-Disposition: attachment
135 Content-Type: application/json;charset=UTF-8
136
137 )]}'
138 {
139 "kind": "gerritcodereview#plugin",
140 "id": "delete-project",
141 "version": "2.8"
142 }
143----
144
145[[enable-plugin]]
146Enable Plugin
147~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800148--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200149'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800150--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200151
152Enables a plugin on the Gerrit server.
153
154.Request
155----
156 POST /plugins/delete-project/gerrit~enable HTTP/1.0
157----
158
159As response a link:#plugin-info[PluginInfo] entity is returned that
160describes the plugin.
161
162.Response
163----
164 HTTP/1.1 200 OK
165 Content-Disposition: attachment
166 Content-Type: application/json;charset=UTF-8
167
168 )]}'
169 {
170 "kind": "gerritcodereview#plugin",
171 "id": "delete-project",
172 "version": "2.8"
173 }
174----
175
176[[disable-plugin]]
177Disable Plugin
178~~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800179--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200180'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800181--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200182
183OR
184
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800185--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200186'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800187--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200188
189Disables a plugin on the Gerrit server.
190
191.Request
192----
193 POST /plugins/delete-project/gerrit~disable HTTP/1.0
194----
195
196As response a link:#plugin-info[PluginInfo] entity is returned that
197describes the plugin.
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 "kind": "gerritcodereview#plugin",
208 "id": "delete-project",
209 "version": "2.8",
210 "disabled": true
211 }
212----
213
214[[reload-plugin]]
215Reload Plugin
216~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800217--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200218'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800219--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200220
221Reloads a plugin on the Gerrit server.
222
223.Request
224----
225 POST /plugins/delete-project/gerrit~reload HTTP/1.0
226----
227
228As response a link:#plugin-info[PluginInfo] entity is returned that
229describes the plugin.
230
231.Response
232----
233 HTTP/1.1 200 OK
234 Content-Disposition: attachment
235 Content-Type: application/json;charset=UTF-8
236
237 )]}'
238 {
239 "kind": "gerritcodereview#plugin",
240 "id": "delete-project",
241 "version": "2.8",
242 "disabled": true
243 }
244----
245
Edwin Kempin36eeee22013-08-30 15:57:34 +0200246
247[[ids]]
248IDs
249---
250
251[[plugin-id]]
252\{plugin-id\}
253~~~~~~~~~~~~~
254The ID of the plugin.
255
Edwin Kempin36eeee22013-08-30 15:57:34 +0200256[[json-entities]]
257JSON Entities
258-------------
259
260[[plugin-info]]
261PluginInfo
262~~~~~~~~~~
263The `PluginInfo` entity describes a plugin.
264
Edwin Kempin9de428c2013-09-02 14:44:21 +0200265[options="header",width="50%",cols="1,^2,4"]
266|=======================
David Ostrovsky83c79862013-12-05 21:40:36 +0100267|Field Name ||Description
268|`kind` ||`gerritcodereview#plugin`
269|`id` ||The ID of the plugin.
270|`version` ||The version of the plugin.
271|`index_url`|optional|URL of the plugin's default page.
272|`disabled` |not set if `false`|Whether the plugin is disabled.
Edwin Kempin9de428c2013-09-02 14:44:21 +0200273|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200274
275[[plugin-input]]
276PluginInput
277~~~~~~~~~~~
278The `PluginInput` entity describes a plugin that should be installed.
279
280[options="header",width="50%",cols="1,6"]
281|======================
282|Field Name|Description
283|`url` |URL to the plugin jar.
284|======================
285
286
287GERRIT
288------
289Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700290
291SEARCHBOX
292---------