blob: adfd3e275af2a2f3a6a17134c0c6a2f4e229ffa9 [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 Pursehouse62864b72013-10-17 23:05:08 +090049 "version": "2.9-SNAPSHOT"
Edwin Kempin9de428c2013-09-02 14:44:21 +020050 },
51 "reviewers-by-blame": {
52 "kind": "gerritcodereview#plugin",
53 "id": "reviewers-by-blame",
David Pursehouse62864b72013-10-17 23:05:08 +090054 "version": "2.9-SNAPSHOT",
Edwin Kempin9de428c2013-09-02 14:44:21 +020055 "disabled": true
56 }
57 }
58----
59
Edwin Kempin36eeee22013-08-30 15:57:34 +020060[[install-plugin]]
61Install Plugin
62~~~~~~~~~~~~~~
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
79 Content-Type: application/json;charset=UTF-8
80
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
100 Content-Type: application/json;charset=UTF-8
101
102 )]}'
103 {
104 "kind": "gerritcodereview#plugin",
105 "id": "delete-project",
106 "version": "2.8"
107 }
108----
109
110If an existing plugin was overwritten the response is "`200 OK`".
111
Edwin Kempin9de428c2013-09-02 14:44:21 +0200112[[get-plugin-status]]
113Get Plugin Status
114~~~~~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800115--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200116'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800117--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200118
119Retrieves the status of a plugin on the Gerrit server.
120
121.Request
122----
123 GET /plugins/delete-project/gerrit~status HTTP/1.0
124----
125
126As response a link:#plugin-info[PluginInfo] entity is returned that
127describes the plugin.
128
129.Response
130----
131 HTTP/1.1 200 OK
132 Content-Disposition: attachment
133 Content-Type: application/json;charset=UTF-8
134
135 )]}'
136 {
137 "kind": "gerritcodereview#plugin",
138 "id": "delete-project",
139 "version": "2.8"
140 }
141----
142
143[[enable-plugin]]
144Enable Plugin
145~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800146--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200147'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800148--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200149
150Enables a plugin on the Gerrit server.
151
152.Request
153----
154 POST /plugins/delete-project/gerrit~enable HTTP/1.0
155----
156
157As response a link:#plugin-info[PluginInfo] entity is returned that
158describes the plugin.
159
160.Response
161----
162 HTTP/1.1 200 OK
163 Content-Disposition: attachment
164 Content-Type: application/json;charset=UTF-8
165
166 )]}'
167 {
168 "kind": "gerritcodereview#plugin",
169 "id": "delete-project",
170 "version": "2.8"
171 }
172----
173
174[[disable-plugin]]
175Disable Plugin
176~~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800177--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200178'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800179--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200180
181OR
182
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800183--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200184'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800185--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200186
187Disables a plugin on the Gerrit server.
188
189.Request
190----
191 POST /plugins/delete-project/gerrit~disable HTTP/1.0
192----
193
194As response a link:#plugin-info[PluginInfo] entity is returned that
195describes the plugin.
196
197.Response
198----
199 HTTP/1.1 200 OK
200 Content-Disposition: attachment
201 Content-Type: application/json;charset=UTF-8
202
203 )]}'
204 {
205 "kind": "gerritcodereview#plugin",
206 "id": "delete-project",
207 "version": "2.8",
208 "disabled": true
209 }
210----
211
212[[reload-plugin]]
213Reload Plugin
214~~~~~~~~~~~~~
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800215--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200216'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800217--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200218
219Reloads a plugin on the Gerrit server.
220
221.Request
222----
223 POST /plugins/delete-project/gerrit~reload HTTP/1.0
224----
225
226As response a link:#plugin-info[PluginInfo] entity is returned that
227describes the plugin.
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 "kind": "gerritcodereview#plugin",
238 "id": "delete-project",
239 "version": "2.8",
240 "disabled": true
241 }
242----
243
Edwin Kempin36eeee22013-08-30 15:57:34 +0200244
245[[ids]]
246IDs
247---
248
249[[plugin-id]]
250\{plugin-id\}
251~~~~~~~~~~~~~
252The ID of the plugin.
253
Edwin Kempin36eeee22013-08-30 15:57:34 +0200254[[json-entities]]
255JSON Entities
256-------------
257
258[[plugin-info]]
259PluginInfo
260~~~~~~~~~~
261The `PluginInfo` entity describes a plugin.
262
Edwin Kempin9de428c2013-09-02 14:44:21 +0200263[options="header",width="50%",cols="1,^2,4"]
264|=======================
265|Field Name||Description
266|`kind` ||`gerritcodereview#plugin`
267|`id` ||The ID of the plugin.
268|`version` ||The version of the plugin.
269|`disabled`|not set if `false`|Whether the plugin is disabled.
270|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200271
272[[plugin-input]]
273PluginInput
274~~~~~~~~~~~
275The `PluginInput` entity describes a plugin that should be installed.
276
277[options="header",width="50%",cols="1,6"]
278|======================
279|Field Name|Description
280|`url` |URL to the plugin jar.
281|======================
282
283
284GERRIT
285------
286Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700287
288SEARCHBOX
289---------