Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - /plugins/ REST API |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 2 | |
| 3 | This page describes the plugin related REST endpoints. |
| 4 | Please also take note of the general information on the |
| 5 | link:rest-api.html[REST API]. |
| 6 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 7 | [[plugin-endpoints]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 8 | == Plugin Endpoints |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 9 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 10 | Gerrit REST endpoints for installed plugins are available under |
| 11 | '/plugins/link:#plugin-id[\{plugin-id\}]/gerrit~<endpoint-id>'. |
| 12 | The `gerrit~` prefix ensures that the Gerrit REST endpoints for plugins |
| 13 | do not clash with any REST endpoint that a plugin may offer under its |
| 14 | namespace. |
| 15 | |
| 16 | |
| 17 | [[list-plugins]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 18 | === List Plugins |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 19 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 20 | 'GET /plugins/' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 21 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 22 | |
| 23 | Lists the plugins installed on the Gerrit server. Only the enabled |
| 24 | plugins are returned unless the `all` option is specified. |
| 25 | |
Edwin Kempin | 362b14d1 | 2014-05-09 14:18:12 +0200 | [diff] [blame] | 26 | To be allowed to see the installed plugins, a user must be a member of |
| 27 | a group that is granted the 'View Plugins' capability or the |
| 28 | 'Administrate Server' capability. |
| 29 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 30 | As result a map is returned that maps the plugin IDs to |
| 31 | link:#plugin-info[PluginInfo] entries. The entries in the map are sorted |
| 32 | by 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 Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 43 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 44 | |
| 45 | )]}' |
| 46 | { |
| 47 | "delete-project": { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 48 | "id": "delete-project", |
David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 49 | "index_url": "plugins/delete-project/", |
Colby Ranger | 4d3226c | 2013-12-09 09:01:42 -0800 | [diff] [blame] | 50 | "version": "2.9-SNAPSHOT" |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 51 | }, |
| 52 | "reviewers-by-blame": { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 53 | "id": "reviewers-by-blame", |
David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 54 | "index_url": "plugins/reviewers-by-blame/", |
David Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame] | 55 | "version": "2.9-SNAPSHOT", |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 56 | "disabled": true |
Colby Ranger | 4d3226c | 2013-12-09 09:01:42 -0800 | [diff] [blame] | 57 | } |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 58 | } |
| 59 | ---- |
| 60 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 61 | [[install-plugin]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 62 | === Install Plugin |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 63 | -- |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 64 | 'PUT /plugins/link:#plugin-id[\{plugin-id\}]' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 65 | -- |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 66 | |
| 67 | Installs a new plugin on the Gerrit server. If a plugin with the |
David Ostrovsky | 366ad0e | 2013-09-05 19:59:09 +0200 | [diff] [blame] | 68 | specified name already exists it is overwritten. Note: if the plugin |
| 69 | provides its own name in the MANIFEST file, then the plugin name from |
| 70 | the MANIFEST file has precedence over the \{plugin-id\} above. |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 71 | |
| 72 | The plugin jar can either be sent as binary data in the request body |
| 73 | or a URL to the plugin jar must be provided in the request body inside |
| 74 | a link:#plugin-input[PluginInput] entity. |
| 75 | |
| 76 | .Request |
| 77 | ---- |
| 78 | PUT /plugins/delete-project HTTP/1.0 |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 79 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 80 | |
| 81 | { |
| 82 | "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar" |
| 83 | } |
| 84 | ---- |
| 85 | |
| 86 | To provide the plugin jar as binary data in the request body the |
| 87 | following 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 | |
| 93 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 94 | describes the plugin. |
| 95 | |
| 96 | .Response |
| 97 | ---- |
| 98 | HTTP/1.1 201 Created |
| 99 | Content-Disposition: attachment |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 100 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 101 | |
| 102 | )]}' |
| 103 | { |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 104 | "id": "delete-project", |
| 105 | "version": "2.8" |
| 106 | } |
| 107 | ---- |
| 108 | |
| 109 | If an existing plugin was overwritten the response is "`200 OK`". |
| 110 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 111 | [[get-plugin-status]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 112 | === Get Plugin Status |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 113 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 114 | 'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 115 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 116 | |
| 117 | Retrieves 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 | |
| 124 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 125 | describes the plugin. |
| 126 | |
| 127 | .Response |
| 128 | ---- |
| 129 | HTTP/1.1 200 OK |
| 130 | Content-Disposition: attachment |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 131 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 132 | |
| 133 | )]}' |
| 134 | { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 135 | "id": "delete-project", |
| 136 | "version": "2.8" |
| 137 | } |
| 138 | ---- |
| 139 | |
| 140 | [[enable-plugin]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 141 | === Enable Plugin |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 142 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 143 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 144 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 145 | |
| 146 | Enables a plugin on the Gerrit server. |
| 147 | |
| 148 | .Request |
| 149 | ---- |
| 150 | POST /plugins/delete-project/gerrit~enable HTTP/1.0 |
| 151 | ---- |
| 152 | |
| 153 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 154 | describes the plugin. |
| 155 | |
| 156 | .Response |
| 157 | ---- |
| 158 | HTTP/1.1 200 OK |
| 159 | Content-Disposition: attachment |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 160 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 161 | |
| 162 | )]}' |
| 163 | { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 164 | "id": "delete-project", |
| 165 | "version": "2.8" |
| 166 | } |
| 167 | ---- |
| 168 | |
| 169 | [[disable-plugin]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 170 | === Disable Plugin |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 171 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 172 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 173 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 174 | |
| 175 | OR |
| 176 | |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 177 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 178 | 'DELETE /plugins/link:#plugin-id[\{plugin-id\}]' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 179 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 180 | |
| 181 | Disables a plugin on the Gerrit server. |
| 182 | |
| 183 | .Request |
| 184 | ---- |
| 185 | POST /plugins/delete-project/gerrit~disable HTTP/1.0 |
| 186 | ---- |
| 187 | |
| 188 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 189 | describes the plugin. |
| 190 | |
| 191 | .Response |
| 192 | ---- |
| 193 | HTTP/1.1 200 OK |
| 194 | Content-Disposition: attachment |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 195 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 196 | |
| 197 | )]}' |
| 198 | { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 199 | "id": "delete-project", |
| 200 | "version": "2.8", |
| 201 | "disabled": true |
| 202 | } |
| 203 | ---- |
| 204 | |
| 205 | [[reload-plugin]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 206 | === Reload Plugin |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 207 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 208 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload' |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 209 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 210 | |
| 211 | Reloads a plugin on the Gerrit server. |
| 212 | |
| 213 | .Request |
| 214 | ---- |
| 215 | POST /plugins/delete-project/gerrit~reload HTTP/1.0 |
| 216 | ---- |
| 217 | |
| 218 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 219 | describes the plugin. |
| 220 | |
| 221 | .Response |
| 222 | ---- |
| 223 | HTTP/1.1 200 OK |
| 224 | Content-Disposition: attachment |
David Pursehouse | 56bf1cb | 2015-01-06 15:44:00 +0900 | [diff] [blame] | 225 | Content-Type: application/json; charset=UTF-8 |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 226 | |
| 227 | )]}' |
| 228 | { |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 229 | "id": "delete-project", |
| 230 | "version": "2.8", |
| 231 | "disabled": true |
| 232 | } |
| 233 | ---- |
| 234 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 235 | |
| 236 | [[ids]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 237 | == IDs |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 238 | |
| 239 | [[plugin-id]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 240 | === \{plugin-id\} |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 241 | The ID of the plugin. |
| 242 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 243 | [[json-entities]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 244 | == JSON Entities |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 245 | |
| 246 | [[plugin-info]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 247 | === PluginInfo |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 248 | The `PluginInfo` entity describes a plugin. |
| 249 | |
David Pursehouse | ae36719 | 2014-11-25 17:24:47 +0900 | [diff] [blame] | 250 | [options="header",cols="1,^2,4"] |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 251 | |======================= |
David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 252 | |Field Name ||Description |
David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 253 | |`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 Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 257 | |======================= |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 258 | |
| 259 | [[plugin-input]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 260 | === PluginInput |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 261 | The `PluginInput` entity describes a plugin that should be installed. |
| 262 | |
David Pursehouse | ae36719 | 2014-11-25 17:24:47 +0900 | [diff] [blame] | 263 | [options="header",cols="1,6"] |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 264 | |====================== |
| 265 | |Field Name|Description |
| 266 | |`url` |URL to the plugin jar. |
| 267 | |====================== |
| 268 | |
| 269 | |
| 270 | GERRIT |
| 271 | ------ |
| 272 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 273 | |
| 274 | SEARCHBOX |
| 275 | --------- |