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 Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame] | 49 | "version": "2.9-SNAPSHOT" |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 50 | }, |
| 51 | "reviewers-by-blame": { |
| 52 | "kind": "gerritcodereview#plugin", |
| 53 | "id": "reviewers-by-blame", |
David Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame] | 54 | "version": "2.9-SNAPSHOT", |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 55 | "disabled": true |
| 56 | } |
| 57 | } |
| 58 | ---- |
| 59 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 60 | [[install-plugin]] |
| 61 | Install Plugin |
| 62 | ~~~~~~~~~~~~~~ |
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 |
| 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 | |
| 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 |
| 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 | |
| 110 | If an existing plugin was overwritten the response is "`200 OK`". |
| 111 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 112 | [[get-plugin-status]] |
| 113 | Get Plugin Status |
| 114 | ~~~~~~~~~~~~~~~~~ |
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 | 'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status' |
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 | |
| 119 | Retrieves 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 | |
| 126 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 127 | describes 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]] |
| 144 | Enable Plugin |
| 145 | ~~~~~~~~~~~~~ |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame^] | 146 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 147 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable' |
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 | |
| 150 | Enables a plugin on the Gerrit server. |
| 151 | |
| 152 | .Request |
| 153 | ---- |
| 154 | POST /plugins/delete-project/gerrit~enable HTTP/1.0 |
| 155 | ---- |
| 156 | |
| 157 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 158 | describes 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]] |
| 175 | Disable Plugin |
| 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 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable' |
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 | OR |
| 182 | |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame^] | 183 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 184 | 'DELETE /plugins/link:#plugin-id[\{plugin-id\}]' |
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 | |
| 187 | Disables a plugin on the Gerrit server. |
| 188 | |
| 189 | .Request |
| 190 | ---- |
| 191 | POST /plugins/delete-project/gerrit~disable HTTP/1.0 |
| 192 | ---- |
| 193 | |
| 194 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 195 | describes 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]] |
| 213 | Reload Plugin |
| 214 | ~~~~~~~~~~~~~ |
Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame^] | 215 | -- |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 216 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload' |
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 | |
| 219 | Reloads a plugin on the Gerrit server. |
| 220 | |
| 221 | .Request |
| 222 | ---- |
| 223 | POST /plugins/delete-project/gerrit~reload HTTP/1.0 |
| 224 | ---- |
| 225 | |
| 226 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 227 | describes 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 Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 244 | |
| 245 | [[ids]] |
| 246 | IDs |
| 247 | --- |
| 248 | |
| 249 | [[plugin-id]] |
| 250 | \{plugin-id\} |
| 251 | ~~~~~~~~~~~~~ |
| 252 | The ID of the plugin. |
| 253 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 254 | [[json-entities]] |
| 255 | JSON Entities |
| 256 | ------------- |
| 257 | |
| 258 | [[plugin-info]] |
| 259 | PluginInfo |
| 260 | ~~~~~~~~~~ |
| 261 | The `PluginInfo` entity describes a plugin. |
| 262 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 263 | [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 Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 271 | |
| 272 | [[plugin-input]] |
| 273 | PluginInput |
| 274 | ~~~~~~~~~~~ |
| 275 | The `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 | |
| 284 | GERRIT |
| 285 | ------ |
| 286 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 287 | |
| 288 | SEARCHBOX |
| 289 | --------- |