| 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 | |
| 26 | As result a map is returned that maps the plugin IDs to |
| 27 | link:#plugin-info[PluginInfo] entries. The entries in the map are sorted |
| 28 | by 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 Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 46 | "index_url": "plugins/delete-project/", |
| Colby Ranger | 4d3226c | 2013-12-09 09:01:42 -0800 | [diff] [blame] | 47 | "version": "2.9-SNAPSHOT" |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 48 | }, |
| 49 | "reviewers-by-blame": { |
| 50 | "kind": "gerritcodereview#plugin", |
| 51 | "id": "reviewers-by-blame", |
| David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 52 | "index_url": "plugins/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 |
| Colby Ranger | 4d3226c | 2013-12-09 09:01:42 -0800 | [diff] [blame] | 55 | } |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 56 | } |
| 57 | ---- |
| 58 | |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 59 | [[install-plugin]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 60 | === Install Plugin |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 61 | -- |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 62 | 'PUT /plugins/link:#plugin-id[\{plugin-id\}]' |
| 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 | |
| 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]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 111 | === Get Plugin Status |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 112 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 113 | 'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 114 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 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]] |
| 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 |
| 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' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 171 | === Disable Plugin |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 172 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 173 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 174 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 175 | |
| 176 | OR |
| 177 | |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 178 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 179 | 'DELETE /plugins/link:#plugin-id[\{plugin-id\}]' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 180 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 181 | |
| 182 | Disables a plugin on the Gerrit server. |
| 183 | |
| 184 | .Request |
| 185 | ---- |
| 186 | POST /plugins/delete-project/gerrit~disable HTTP/1.0 |
| 187 | ---- |
| 188 | |
| 189 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 190 | describes 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' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 208 | === Reload Plugin |
| 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 | 'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload' |
| Yuxuan 'fishy' Wang | d85b687 | 2013-11-15 11:47:46 -0800 | [diff] [blame] | 211 | -- |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 212 | |
| 213 | Reloads a plugin on the Gerrit server. |
| 214 | |
| 215 | .Request |
| 216 | ---- |
| 217 | POST /plugins/delete-project/gerrit~reload HTTP/1.0 |
| 218 | ---- |
| 219 | |
| 220 | As response a link:#plugin-info[PluginInfo] entity is returned that |
| 221 | describes 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 Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 238 | |
| 239 | [[ids]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 240 | == IDs |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 241 | |
| 242 | [[plugin-id]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 243 | === \{plugin-id\} |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 244 | The ID of the plugin. |
| 245 | |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 246 | [[json-entities]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 247 | == JSON Entities |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 248 | |
| 249 | [[plugin-info]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 250 | === PluginInfo |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 251 | The `PluginInfo` entity describes a plugin. |
| 252 | |
| Edwin Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 253 | [options="header",width="50%",cols="1,^2,4"] |
| 254 | |======================= |
| David Ostrovsky | 83c7986 | 2013-12-05 21:40:36 +0100 | [diff] [blame] | 255 | |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 Kempin | 9de428c | 2013-09-02 14:44:21 +0200 | [diff] [blame] | 261 | |======================= |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 262 | |
| 263 | [[plugin-input]] |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame^] | 264 | === PluginInput |
| Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 265 | The `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 | |
| 274 | GERRIT |
| 275 | ------ |
| 276 | Part of link:index.html[Gerrit Code Review] |
| Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 277 | |
| 278 | SEARCHBOX |
| 279 | --------- |