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 | ~~~~~~~~~~~~ |
| 22 | [verse] |
| 23 | 'GET /plugins/' |
| 24 | |
| 25 | Lists the plugins installed on the Gerrit server. Only the enabled |
| 26 | plugins are returned unless the `all` option is specified. |
| 27 | |
| 28 | As result a map is returned that maps the plugin IDs to |
| 29 | link:#plugin-info[PluginInfo] entries. The entries in the map are sorted |
| 30 | by plugin ID. |
| 31 | |
| 32 | .Request |
| 33 | ---- |
| 34 | GET /plugins/?all HTTP/1.0 |
| 35 | ---- |
| 36 | |
| 37 | .Response |
| 38 | ---- |
| 39 | HTTP/1.1 200 OK |
| 40 | Content-Disposition: attachment |
| 41 | Content-Type: application/json;charset=UTF-8 |
| 42 | |
| 43 | )]}' |
| 44 | { |
| 45 | "delete-project": { |
| 46 | "kind": "gerritcodereview#plugin", |
| 47 | "id": "delete-project", |
David Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame^] | 48 | "version": "2.9-SNAPSHOT" |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 49 | }, |
| 50 | "reviewers-by-blame": { |
| 51 | "kind": "gerritcodereview#plugin", |
| 52 | "id": "reviewers-by-blame", |
David Pursehouse | 62864b7 | 2013-10-17 23:05:08 +0900 | [diff] [blame^] | 53 | "version": "2.9-SNAPSHOT", |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 54 | "disabled": true |
| 55 | } |
| 56 | } |
| 57 | ---- |
| 58 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 59 | [[install-plugin]] |
| 60 | Install Plugin |
| 61 | ~~~~~~~~~~~~~~ |
| 62 | [verse] |
| 63 | 'PUT /plugins/link:#plugin-id[\{plugin-id\}]' |
| 64 | |
| 65 | 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] | 66 | specified name already exists it is overwritten. Note: if the plugin |
| 67 | provides its own name in the MANIFEST file, then the plugin name from |
| 68 | the MANIFEST file has precedence over the \{plugin-id\} above. |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 69 | |
| 70 | The plugin jar can either be sent as binary data in the request body |
| 71 | or a URL to the plugin jar must be provided in the request body inside |
| 72 | a 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 | |
| 84 | To provide the plugin jar as binary data in the request body the |
| 85 | following 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 | |
| 91 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 92 | describes 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 | |
| 108 | If an existing plugin was overwritten the response is "`200 OK`". |
| 109 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 110 | [[get-plugin-status]] |
| 111 | Get Plugin Status |
| 112 | ~~~~~~~~~~~~~~~~~ |
| 113 | [verse] |
| 114 | 'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status' |
| 115 | |
| 116 | Retrieves 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 | |
| 123 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 124 | describes 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]] |
| 141 | Enable Plugin |
| 142 | ~~~~~~~~~~~~~ |
| 143 | [verse] |
| 144 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable' |
| 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 |
| 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]] |
| 171 | Disable Plugin |
| 172 | ~~~~~~~~~~~~~~ |
| 173 | [verse] |
| 174 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable' |
| 175 | |
| 176 | OR |
| 177 | |
| 178 | [verse] |
| 179 | 'DELETE /plugins/link:#plugin-id[\{plugin-id\}]' |
| 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 |
| 195 | Content-Type: application/json;charset=UTF-8 |
| 196 | |
| 197 | )]}' |
| 198 | { |
| 199 | "kind": "gerritcodereview#plugin", |
| 200 | "id": "delete-project", |
| 201 | "version": "2.8", |
| 202 | "disabled": true |
| 203 | } |
| 204 | ---- |
| 205 | |
| 206 | [[reload-plugin]] |
| 207 | Reload Plugin |
| 208 | ~~~~~~~~~~~~~ |
| 209 | [verse] |
| 210 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload' |
| 211 | |
| 212 | Reloads a plugin on the Gerrit server. |
| 213 | |
| 214 | .Request |
| 215 | ---- |
| 216 | POST /plugins/delete-project/gerrit~reload HTTP/1.0 |
| 217 | ---- |
| 218 | |
| 219 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 220 | describes the plugin. |
| 221 | |
| 222 | .Response |
| 223 | ---- |
| 224 | HTTP/1.1 200 OK |
| 225 | Content-Disposition: attachment |
| 226 | Content-Type: application/json;charset=UTF-8 |
| 227 | |
| 228 | )]}' |
| 229 | { |
| 230 | "kind": "gerritcodereview#plugin", |
| 231 | "id": "delete-project", |
| 232 | "version": "2.8", |
| 233 | "disabled": true |
| 234 | } |
| 235 | ---- |
| 236 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 237 | |
| 238 | [[ids]] |
| 239 | IDs |
| 240 | --- |
| 241 | |
| 242 | [[plugin-id]] |
| 243 | \{plugin-id\} |
| 244 | ~~~~~~~~~~~~~ |
| 245 | The ID of the plugin. |
| 246 | |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 247 | [[json-entities]] |
| 248 | JSON Entities |
| 249 | ------------- |
| 250 | |
| 251 | [[plugin-info]] |
| 252 | PluginInfo |
| 253 | ~~~~~~~~~~ |
| 254 | The `PluginInfo` entity describes a plugin. |
| 255 | |
Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 256 | [options="header",width="50%",cols="1,^2,4"] |
| 257 | |======================= |
| 258 | |Field Name||Description |
| 259 | |`kind` ||`gerritcodereview#plugin` |
| 260 | |`id` ||The ID of the plugin. |
| 261 | |`version` ||The version of the plugin. |
| 262 | |`disabled`|not set if `false`|Whether the plugin is disabled. |
| 263 | |======================= |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 264 | |
| 265 | [[plugin-input]] |
| 266 | PluginInput |
| 267 | ~~~~~~~~~~~ |
| 268 | The `PluginInput` entity describes a plugin that should be installed. |
| 269 | |
| 270 | [options="header",width="50%",cols="1,6"] |
| 271 | |====================== |
| 272 | |Field Name|Description |
| 273 | |`url` |URL to the plugin jar. |
| 274 | |====================== |
| 275 | |
| 276 | |
| 277 | GERRIT |
| 278 | ------ |
| 279 | Part of link:index.html[Gerrit Code Review] |