blob: 89a22f0c3fff0d8408b62a20837ecf26e8e8237a [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
26As result a map is returned that maps the plugin IDs to
27link:#plugin-info[PluginInfo] entries. The entries in the map are sorted
28by plugin ID.
29
30.Request
31----
32 GET /plugins/?all HTTP/1.0
33----
34
35.Response
36----
37 HTTP/1.1 200 OK
38 Content-Disposition: attachment
39 Content-Type: application/json;charset=UTF-8
40
41 )]}'
42 {
43 "delete-project": {
44 "kind": "gerritcodereview#plugin",
45 "id": "delete-project",
David Ostrovsky83c79862013-12-05 21:40:36 +010046 "index_url": "plugins/delete-project/",
Colby Ranger4d3226c2013-12-09 09:01:42 -080047 "version": "2.9-SNAPSHOT"
Edwin Kempin9de428c2013-09-02 14:44:21 +020048 },
49 "reviewers-by-blame": {
50 "kind": "gerritcodereview#plugin",
51 "id": "reviewers-by-blame",
David Ostrovsky83c79862013-12-05 21:40:36 +010052 "index_url": "plugins/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
Colby Ranger4d3226c2013-12-09 09:01:42 -080055 }
Edwin Kempin9de428c2013-09-02 14:44:21 +020056 }
57----
58
Edwin Kempin36eeee22013-08-30 15:57:34 +020059[[install-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080060=== Install Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080061--
Edwin Kempin36eeee22013-08-30 15:57:34 +020062'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080063--
Edwin Kempin36eeee22013-08-30 15:57:34 +020064
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]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800111=== Get Plugin Status
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800112--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200113'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800114--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200115
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]]
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
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]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800171=== Disable Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800172--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200173'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800174--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200175
176OR
177
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800178--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200179'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800180--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200181
182Disables a plugin on the Gerrit server.
183
184.Request
185----
186 POST /plugins/delete-project/gerrit~disable HTTP/1.0
187----
188
189As response a link:#plugin-info[PluginInfo] entity is returned that
190describes the plugin.
191
192.Response
193----
194 HTTP/1.1 200 OK
195 Content-Disposition: attachment
196 Content-Type: application/json;charset=UTF-8
197
198 )]}'
199 {
200 "kind": "gerritcodereview#plugin",
201 "id": "delete-project",
202 "version": "2.8",
203 "disabled": true
204 }
205----
206
207[[reload-plugin]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800208=== Reload Plugin
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800209--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200210'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800211--
Edwin Kempin9de428c2013-09-02 14:44:21 +0200212
213Reloads a plugin on the Gerrit server.
214
215.Request
216----
217 POST /plugins/delete-project/gerrit~reload HTTP/1.0
218----
219
220As response a link:#plugin-info[PluginInfo] entity is returned that
221describes the plugin.
222
223.Response
224----
225 HTTP/1.1 200 OK
226 Content-Disposition: attachment
227 Content-Type: application/json;charset=UTF-8
228
229 )]}'
230 {
231 "kind": "gerritcodereview#plugin",
232 "id": "delete-project",
233 "version": "2.8",
234 "disabled": true
235 }
236----
237
Edwin Kempin36eeee22013-08-30 15:57:34 +0200238
239[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800240== IDs
Edwin Kempin36eeee22013-08-30 15:57:34 +0200241
242[[plugin-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800243=== \{plugin-id\}
Edwin Kempin36eeee22013-08-30 15:57:34 +0200244The ID of the plugin.
245
Edwin Kempin36eeee22013-08-30 15:57:34 +0200246[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800247== JSON Entities
Edwin Kempin36eeee22013-08-30 15:57:34 +0200248
249[[plugin-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800250=== PluginInfo
Edwin Kempin36eeee22013-08-30 15:57:34 +0200251The `PluginInfo` entity describes a plugin.
252
Edwin Kempin9de428c2013-09-02 14:44:21 +0200253[options="header",width="50%",cols="1,^2,4"]
254|=======================
David Ostrovsky83c79862013-12-05 21:40:36 +0100255|Field Name ||Description
256|`kind` ||`gerritcodereview#plugin`
257|`id` ||The ID of the plugin.
258|`version` ||The version of the plugin.
259|`index_url`|optional|URL of the plugin's default page.
260|`disabled` |not set if `false`|Whether the plugin is disabled.
Edwin Kempin9de428c2013-09-02 14:44:21 +0200261|=======================
Edwin Kempin36eeee22013-08-30 15:57:34 +0200262
263[[plugin-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800264=== PluginInput
Edwin Kempin36eeee22013-08-30 15:57:34 +0200265The `PluginInput` entity describes a plugin that should be installed.
266
267[options="header",width="50%",cols="1,6"]
268|======================
269|Field Name|Description
270|`url` |URL to the plugin jar.
271|======================
272
273
274GERRIT
275------
276Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700277
278SEARCHBOX
279---------