| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 1 | Gerrit Code Review - /plugins/ REST API |
| 2 | ======================================= |
| 3 | |
| 4 | This page describes the plugin related REST endpoints. |
| 5 | Please also take note of the general information on the |
| 6 | link:rest-api.html[REST API]. |
| 7 | |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 8 | [[plugin-endpoints]] |
| 9 | Plugin Endpoints |
| 10 | ---------------- |
| 11 | |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 12 | Gerrit REST endpoints for installed plugins are available under |
| 13 | '/plugins/link:#plugin-id[\{plugin-id\}]/gerrit~<endpoint-id>'. |
| 14 | The `gerrit~` prefix ensures that the Gerrit REST endpoints for plugins |
| 15 | do not clash with any REST endpoint that a plugin may offer under its |
| 16 | namespace. |
| 17 | |
| 18 | |
| 19 | [[list-plugins]] |
| 20 | List Plugins |
| 21 | ~~~~~~~~~~~~ |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 22 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 23 | 'GET /plugins/' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 24 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 25 | |
| 26 | Lists the plugins installed on the Gerrit server. Only the enabled |
| 27 | plugins are returned unless the `all` option is specified. |
| 28 | |
| 29 | As result a map is returned that maps the plugin IDs to |
| 30 | link:#plugin-info[PluginInfo] entries. The entries in the map are sorted |
| 31 | by 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 Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame^] | 49 | "index_url": "plugins/delete-project/", |
| 50 | "version": "2.9-SNAPSHOT", |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 51 | }, |
| 52 | "reviewers-by-blame": { |
| 53 | "kind": "gerritcodereview#plugin", |
| 54 | "id": "reviewers-by-blame", |
| David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame^] | 55 | "index_url": "plugins/reviewers-by-blame/", |
| David Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame] | 56 | "version": "2.9-SNAPSHOT", |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 57 | "disabled": true |
| David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame^] | 58 | }, |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 59 | } |
| 60 | ---- |
| 61 | |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 62 | [[install-plugin]] |
| 63 | Install Plugin |
| 64 | ~~~~~~~~~~~~~~ |
| 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 | 'PUT /plugins/link:#plugin-id[\{plugin-id\}]' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 67 | -- |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 68 | |
| 69 | 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] | 70 | specified name already exists it is overwritten. Note: if the plugin |
| 71 | provides its own name in the MANIFEST file, then the plugin name from |
| 72 | the MANIFEST file has precedence over the \{plugin-id\} above. |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 73 | |
| 74 | The plugin jar can either be sent as binary data in the request body |
| 75 | or a URL to the plugin jar must be provided in the request body inside |
| 76 | a 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 | |
| 88 | To provide the plugin jar as binary data in the request body the |
| 89 | following 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 | |
| 95 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 96 | describes 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 | |
| 112 | If an existing plugin was overwritten the response is "`200 OK`". |
| 113 | |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 114 | [[get-plugin-status]] |
| 115 | Get Plugin Status |
| 116 | ~~~~~~~~~~~~~~~~~ |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 117 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 118 | 'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 119 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 120 | |
| 121 | Retrieves 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 | |
| 128 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 129 | describes 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]] |
| 146 | Enable Plugin |
| 147 | ~~~~~~~~~~~~~ |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 148 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 149 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 150 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 151 | |
| 152 | Enables a plugin on the Gerrit server. |
| 153 | |
| 154 | .Request |
| 155 | ---- |
| 156 | POST /plugins/delete-project/gerrit~enable HTTP/1.0 |
| 157 | ---- |
| 158 | |
| 159 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 160 | describes 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]] |
| 177 | Disable Plugin |
| 178 | ~~~~~~~~~~~~~~ |
| 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 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 181 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 182 | |
| 183 | OR |
| 184 | |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 185 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 186 | 'DELETE /plugins/link:#plugin-id[\{plugin-id\}]' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 187 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 188 | |
| 189 | Disables a plugin on the Gerrit server. |
| 190 | |
| 191 | .Request |
| 192 | ---- |
| 193 | POST /plugins/delete-project/gerrit~disable HTTP/1.0 |
| 194 | ---- |
| 195 | |
| 196 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 197 | describes 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]] |
| 215 | Reload Plugin |
| 216 | ~~~~~~~~~~~~~ |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 217 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 218 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 219 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 220 | |
| 221 | Reloads a plugin on the Gerrit server. |
| 222 | |
| 223 | .Request |
| 224 | ---- |
| 225 | POST /plugins/delete-project/gerrit~reload HTTP/1.0 |
| 226 | ---- |
| 227 | |
| 228 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 229 | describes 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 Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 246 | |
| 247 | [[ids]] |
| 248 | IDs |
| 249 | --- |
| 250 | |
| 251 | [[plugin-id]] |
| 252 | \{plugin-id\} |
| 253 | ~~~~~~~~~~~~~ |
| 254 | The ID of the plugin. |
| 255 | |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 256 | [[json-entities]] |
| 257 | JSON Entities |
| 258 | ------------- |
| 259 | |
| 260 | [[plugin-info]] |
| 261 | PluginInfo |
| 262 | ~~~~~~~~~~ |
| 263 | The `PluginInfo` entity describes a plugin. |
| 264 | |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 265 | [options="header",width="50%",cols="1,^2,4"] |
| 266 | |======================= |
| David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame^] | 267 | |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 Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 273 | |======================= |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 274 | |
| 275 | [[plugin-input]] |
| 276 | PluginInput |
| 277 | ~~~~~~~~~~~ |
| 278 | The `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 | |
| 287 | GERRIT |
| 288 | ------ |
| 289 | Part of link:index.html[Gerrit Code Review] |
| Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 290 | |
| 291 | SEARCHBOX |
| 292 | --------- |