Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 2 | = Gerrit Code Review - REST API |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 3 | |
| 4 | Gerrit Code Review comes with a REST like API available over HTTP. |
| 5 | The API is suitable for automated tools to build upon, as well as |
| 6 | supporting some ad-hoc scripting use cases. |
| 7 | |
David Pursehouse | ed32132 | 2013-05-17 13:53:32 +0100 | [diff] [blame] | 8 | See also: link:dev-rest-api.html[REST API Developers' Notes]. |
David Pursehouse | 567e57b | 2013-05-07 16:41:48 +0100 | [diff] [blame] | 9 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 10 | == Endpoints |
Edwin Kempin | 87340e6 | 2013-06-24 16:46:34 +0200 | [diff] [blame] | 11 | link:rest-api-access.html[/access/]:: |
| 12 | Access Right related REST endpoints |
Edwin Kempin | 361ed76 | 2013-04-03 13:52:24 +0200 | [diff] [blame] | 13 | link:rest-api-accounts.html[/accounts/]:: |
| 14 | Account related REST endpoints |
| 15 | link:rest-api-changes.html[/changes/]:: |
| 16 | Change related REST endpoints |
David Ostrovsky | 28b8ea6 | 2013-06-09 02:16:57 +0200 | [diff] [blame] | 17 | link:rest-api-config.html[/config/]:: |
| 18 | Config related REST endpoints |
Edwin Kempin | 361ed76 | 2013-04-03 13:52:24 +0200 | [diff] [blame] | 19 | link:rest-api-groups.html[/groups/]:: |
| 20 | Group related REST endpoints |
Edwin Kempin | 36eeee2 | 2013-08-30 15:57:34 +0200 | [diff] [blame] | 21 | link:rest-api-plugins.html[/plugins/]:: |
| 22 | Plugin related REST endpoints |
Edwin Kempin | 361ed76 | 2013-04-03 13:52:24 +0200 | [diff] [blame] | 23 | link:rest-api-projects.html[/projects/]:: |
| 24 | Project related REST endpoints |
Yuxuan 'fishy' Wang | ec4b06a | 2013-10-14 12:39:30 -0700 | [diff] [blame] | 25 | link:rest-api-documentation.html[/Documentation/]:: |
| 26 | Documentation related REST endpoints |
Edwin Kempin | 361ed76 | 2013-04-03 13:52:24 +0200 | [diff] [blame] | 27 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 28 | == Protocol Details |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 29 | |
Edwin Kempin | d089fc4 | 2012-07-18 14:58:40 +0200 | [diff] [blame] | 30 | [[authentication]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 31 | === Authentication |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 32 | By default all REST endpoints assume anonymous access and filter |
| 33 | results to correspond to what anonymous users can read (which may |
| 34 | be nothing at all). |
| 35 | |
Shawn Pearce | d79dcef | 2017-06-10 11:57:30 -0700 | [diff] [blame] | 36 | Users (and programs) can authenticate with HTTP passwords by prefixing |
| 37 | the endpoint URL with `/a/`. For example to authenticate to |
| 38 | `/projects/`, request the URL `/a/projects/`. Gerrit will use HTTP basic |
| 39 | authentication with the HTTP password from the user's account settings |
| 40 | page. This form of authentication bypasses the need for XSRF tokens. |
David Pursehouse | 62fe040 | 2014-05-01 17:14:35 +0900 | [diff] [blame] | 41 | |
Shawn Pearce | d79dcef | 2017-06-10 11:57:30 -0700 | [diff] [blame] | 42 | An authorization cookie may be presented in the request URL inside the |
| 43 | `access_token` query parameter. XSRF tokens are not required when a |
| 44 | valid `access_token` is used in the URL. |
| 45 | |
| 46 | [[cors]] |
| 47 | === CORS |
| 48 | |
| 49 | Cross-site scripting may be supported if the administrator has configured |
| 50 | link:config-gerrit.html#site.allowOriginRegex[site.allowOriginRegex]. |
| 51 | |
| 52 | Approved web applications running from an allowed origin can rely on |
| 53 | CORS preflight to authorize requests requiring cookie based |
| 54 | authentication, or mutations (POST, PUT, DELETE). Mutations require a |
| 55 | valid XSRF token in the `X-Gerrit-Auth` request header. |
| 56 | |
| 57 | Alternatively applications can use `access_token` in the URL (see |
| 58 | above) to authorize requests. Mutations sent as POST with a request |
| 59 | content type of `text/plain` can skip CORS preflight. Gerrit accepts |
| 60 | additional query parameters `$m` to override the correct method (PUT, |
| 61 | POST, DELETE) and `$ct` to specify the actual content type, such as |
| 62 | `application/json; charset=UTF-8`. Example: |
| 63 | |
| 64 | ---- |
| 65 | POST /changes/42/topic?$m=PUT&$ct=application/json%3B%20charset%3DUTF-8&access_token=secret HTTP/1.1 |
| 66 | Content-Type: text/plain |
| 67 | Content-Length: 23 |
| 68 | |
| 69 | {"topic": "new-topic"} |
| 70 | ---- |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 71 | |
Shawn Pearce | a90a43a | 2013-01-26 12:50:56 -0800 | [diff] [blame] | 72 | [[preconditions]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 73 | === Preconditions |
Shawn Pearce | a90a43a | 2013-01-26 12:50:56 -0800 | [diff] [blame] | 74 | Clients can request PUT to create a new resource and not overwrite |
| 75 | an existing one by adding `If-None-Match: *` to the request HTTP |
| 76 | headers. If the named resource already exists the server will respond |
| 77 | with HTTP 412 Precondition Failed. |
| 78 | |
Edwin Kempin | e2f9103 | 2022-10-12 13:43:03 +0200 | [diff] [blame] | 79 | [[backwards-compatibility]] |
| 80 | === Backwards Compatibility |
| 81 | |
| 82 | The REST API is regularly extended (e.g. addition of new REST endpoints or new fields in existing |
| 83 | JSON entities). Callers of the REST API must be able to deal with this (e.g. ignore unknown fields |
| 84 | in the REST responses). Incompatible changes (e.g. removal of REST endpoints, altering/removal of |
| 85 | existing fields in JSON entities) are avoided if possible, but can happen in rare cases. If they |
| 86 | happen, they are announced in the link:https://www.gerritcodereview.com/releases-readme.html[release |
| 87 | notes]. |
| 88 | |
Edwin Kempin | d089fc4 | 2012-07-18 14:58:40 +0200 | [diff] [blame] | 89 | [[output]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 90 | === Output Format |
David Pursehouse | 0ddcb08 | 2014-05-01 21:50:18 +0900 | [diff] [blame] | 91 | JSON responses are encoded using UTF-8 and use content type |
| 92 | `application/json`. |
| 93 | |
| 94 | By default most APIs return pretty-printed JSON, which uses extra |
| 95 | whitespace to make the output more readable for humans. |
| 96 | |
| 97 | Compact JSON can be requested by setting the `pp=0` query parameter, |
| 98 | or by setting the `Accept` HTTP request header to include `application/json`: |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 99 | |
| 100 | ---- |
| 101 | GET /projects/ HTTP/1.0 |
| 102 | Accept: application/json |
| 103 | ---- |
| 104 | |
David Pursehouse | 0ddcb08 | 2014-05-01 21:50:18 +0900 | [diff] [blame] | 105 | Producing (and parsing) the non-pretty compact format is more efficient, |
| 106 | so tools should request it whenever possible. |
David Pursehouse | f6c0bec | 2013-08-26 16:31:51 +0900 | [diff] [blame] | 107 | |
| 108 | To prevent against Cross Site Script Inclusion (XSSI) attacks, the JSON |
| 109 | response body starts with a magic prefix line that must be stripped before |
| 110 | feeding the rest of the response body to a JSON parser: |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 111 | |
| 112 | ---- |
| 113 | )]}' |
| 114 | [ ... valid JSON ... ] |
| 115 | ---- |
| 116 | |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 117 | Responses will be gzip compressed by the server if the HTTP |
| 118 | `Accept-Encoding` request header is set to `gzip`. This may |
| 119 | save on network transfer time for larger responses. |
| 120 | |
Patrick Hiesel | d527c35 | 2017-04-28 12:44:10 +0200 | [diff] [blame] | 121 | [[input]] |
| 122 | === Input Format |
| 123 | Unknown JSON parameters will simply be ignored by Gerrit without causing |
| 124 | an exception. This also applies to case-sensitive parameters, such as |
| 125 | map keys. |
| 126 | |
Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 127 | [[timestamp]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 128 | === Timestamp |
Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 129 | Timestamps are given in UTC and have the format |
David Pursehouse | 0ddcb08 | 2014-05-01 21:50:18 +0900 | [diff] [blame] | 130 | "'yyyy-mm-dd hh:mm:ss.fffffffff'" where "'ffffffffff'" represents |
Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 131 | nanoseconds. |
| 132 | |
Edwin Kempin | 7fe2f7f | 2013-02-06 10:12:52 +0100 | [diff] [blame] | 133 | [[encoding]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 134 | === Encoding |
Edwin Kempin | 7fe2f7f | 2013-02-06 10:12:52 +0100 | [diff] [blame] | 135 | All IDs that appear in the URL of a REST call (e.g. project name, group name) |
| 136 | must be URL encoded. |
| 137 | |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 138 | [[response-codes]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 139 | === Response Codes |
David Pursehouse | 62fe040 | 2014-05-01 17:14:35 +0900 | [diff] [blame] | 140 | The Gerrit REST endpoints use HTTP status codes as described |
| 141 | in the link:http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html[ |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 142 | HTTP specification,role=external,window=_blank]. |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 143 | |
Dave Borowitz | 2f692b2 | 2016-07-28 10:04:03 -0400 | [diff] [blame] | 144 | In most cases, the response body of an error response will be a |
| 145 | plaintext, human-readable error message. |
| 146 | |
David Pursehouse | 62fe040 | 2014-05-01 17:14:35 +0900 | [diff] [blame] | 147 | Here are examples that show how HTTP status codes are used in the |
| 148 | context of the Gerrit REST API. |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 149 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 150 | ==== 400 Bad Request |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 151 | "`400 Bad Request`" is returned if the request is not understood by the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 152 | server due to malformed syntax. |
| 153 | |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 154 | E.g. "`400 Bad Request`" is returned if JSON input is expected but the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 155 | 'Content-Type' of the request is not 'application/json' or the request |
| 156 | body doesn't contain valid JSON. |
| 157 | |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 158 | "`400 Bad Request`" is also returned if required input fields are not set or |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 159 | if options are set which cannot be used together. |
| 160 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 161 | ==== 403 Forbidden |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 162 | "`403 Forbidden`" is returned if the operation is not allowed because the |
David Pursehouse | 62fe040 | 2014-05-01 17:14:35 +0900 | [diff] [blame] | 163 | calling user does not have sufficient permissions. |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 164 | |
| 165 | E.g. some REST endpoints require that the calling user has certain |
David Pursehouse | 8becc2a | 2013-04-23 18:51:04 +0900 | [diff] [blame] | 166 | link:access-control.html#global_capabilities[global capabilities] |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 167 | assigned. |
| 168 | |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 169 | "`403 Forbidden`" is also returned if `self` is used as account ID and the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 170 | REST call was done without authentication. |
| 171 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 172 | ==== 404 Not Found |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 173 | "`404 Not Found`" is returned if the resource that is specified by the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 174 | URL is not found or is not visible to the calling user. A resource |
| 175 | cannot be found if the URL contains a non-existing ID or view. |
| 176 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 177 | ==== 405 Method Not Allowed |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 178 | "`405 Method Not Allowed`" is returned if the resource exists but doesn't |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 179 | support the operation. |
| 180 | |
| 181 | E.g. some of the `/groups/` endpoints are only supported for Gerrit |
David Pursehouse | 0ddcb08 | 2014-05-01 21:50:18 +0900 | [diff] [blame] | 182 | internal groups; if they are invoked for an external group the response |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 183 | is "`405 Method Not Allowed`". |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 184 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 185 | ==== 409 Conflict |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 186 | "`409 Conflict`" is returned if the request cannot be completed because the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 187 | current state of the resource doesn't allow the operation. |
| 188 | |
| 189 | E.g. if you try to submit a change that is abandoned, this fails with |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 190 | "`409 Conflict`" because the state of the change doesn't allow the submit |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 191 | operation. |
| 192 | |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 193 | "`409 Conflict`" is also returned if you try to create a resource but the |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 194 | name is already occupied by an existing resource. |
| 195 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 196 | ==== 412 Precondition Failed |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 197 | "`412 Precondition Failed`" is returned if a precondition from the request |
David Pursehouse | 62fe040 | 2014-05-01 17:14:35 +0900 | [diff] [blame] | 198 | header fields is not fulfilled, as described in the link:#preconditions[ |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 199 | Preconditions] section. |
| 200 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 201 | ==== 422 Unprocessable Entity |
David Pursehouse | 10829f64 | 2015-01-21 11:42:32 +0900 | [diff] [blame] | 202 | "`422 Unprocessable Entity`" is returned if the ID of a resource that is |
Edwin Kempin | e026a7d | 2013-03-13 11:03:42 +0100 | [diff] [blame] | 203 | specified in the request body cannot be resolved. |
| 204 | |
Patrick Hiesel | c0a28ce | 2018-11-15 15:28:06 +0100 | [diff] [blame] | 205 | ==== 429 Too Many Requests |
| 206 | "`429 Too Many Requests`" is returned if the request exhausted any set |
| 207 | quota limits. Depending on the exhausted quota, the request may be retried |
| 208 | with exponential backoff. |
| 209 | |
Edwin Kempin | 0ade5aa | 2018-08-10 08:49:32 +0200 | [diff] [blame] | 210 | [[tracing]] |
| 211 | === Request Tracing |
Edwin Kempin | da82378 | 2018-08-29 22:52:54 +0200 | [diff] [blame] | 212 | For each REST endpoint tracing can be enabled by setting the |
| 213 | `trace=<trace-id>` request parameter. It is recommended to use the ID |
| 214 | of the issue that is being investigated as trace ID. |
| 215 | |
| 216 | .Example Request |
| 217 | ---- |
| 218 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?trace=issue/123&q=J |
| 219 | ---- |
| 220 | |
| 221 | It is also possible to omit the trace ID and get a unique trace ID |
| 222 | generated. |
Edwin Kempin | 0ade5aa | 2018-08-10 08:49:32 +0200 | [diff] [blame] | 223 | |
| 224 | .Example Request |
| 225 | ---- |
| 226 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?trace&q=J |
| 227 | ---- |
| 228 | |
Edwin Kempin | 99ccd92 | 2018-09-10 10:06:53 +0200 | [diff] [blame] | 229 | Alternatively request tracing can also be enabled by setting the |
| 230 | `X-Gerrit-Trace` header: |
| 231 | |
| 232 | .Example Request |
| 233 | ---- |
| 234 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J |
| 235 | X-Gerrit-Trace: issue/123 |
| 236 | ---- |
| 237 | |
Edwin Kempin | 0ade5aa | 2018-08-10 08:49:32 +0200 | [diff] [blame] | 238 | Enabling tracing results in additional logs with debug information that |
| 239 | are written to the `error_log`. All logs that correspond to the traced |
Edwin Kempin | da82378 | 2018-08-29 22:52:54 +0200 | [diff] [blame] | 240 | request are associated with the trace ID. The trace ID is returned with |
| 241 | the REST response in the `X-Gerrit-Trace` header. |
Edwin Kempin | 0ade5aa | 2018-08-10 08:49:32 +0200 | [diff] [blame] | 242 | |
| 243 | .Example Response |
| 244 | ---- |
| 245 | HTTP/1.1 200 OK |
| 246 | Content-Disposition: attachment |
| 247 | Content-Type: application/json; charset=UTF-8 |
| 248 | X-Gerrit-Trace: 1533885943749-8257c498 |
| 249 | |
| 250 | )]}' |
| 251 | ... <json> ... |
| 252 | ---- |
| 253 | |
| 254 | Given the trace ID an administrator can find the corresponding logs and |
| 255 | investigate issues more easily. |
| 256 | |
Edwin Kempin | 0a5c161 | 2021-07-30 09:35:30 +0200 | [diff] [blame] | 257 | [[deadline]] |
| 258 | === Setting a deadline |
| 259 | |
| 260 | When invoking a REST endpoint it's possible that the client sets a deadline |
| 261 | after which the request should be aborted. To do this the `X-Gerrit-Deadline` |
| 262 | header must be set on the request. Values must be specified using standard time |
| 263 | unit abbreviations ('ms', 'sec', 'min', etc.). |
| 264 | |
| 265 | .Example Request |
| 266 | ---- |
| 267 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J |
| 268 | X-Gerrit-Deadline: 5m |
| 269 | ---- |
| 270 | |
Edwin Kempin | 927ff82 | 2021-08-03 15:46:34 +0200 | [diff] [blame] | 271 | |
| 272 | Setting a deadline on the request overrides any |
| 273 | link:config-gerrit.html#deadline.id[server-side deadline] that has been |
| 274 | configured on the host. |
| 275 | |
Gal Paikin | 756f561 | 2021-06-08 13:38:00 +0200 | [diff] [blame] | 276 | [[updated-refs]] |
| 277 | === X-Gerrit-UpdatedRef |
Gal Paikin | 676dc51 | 2021-06-28 16:13:08 +0200 | [diff] [blame] | 278 | This is only enabled when "X-Gerrit-UpdatedRef-Enabled" is set to "true" in the |
| 279 | request header. |
| 280 | |
Gal Paikin | 756f561 | 2021-06-08 13:38:00 +0200 | [diff] [blame] | 281 | For each write REST request, we return X-Gerrit-UpdatedRef headers as the refs |
| 282 | that were updated in the current request (involved in a ref transaction in the |
| 283 | current request). |
| 284 | |
Gal Paikin | eb0854b | 2021-06-28 16:26:54 +0200 | [diff] [blame] | 285 | The format of those headers is `PROJECT_NAME\~REF_NAME\~OLD_SHA-1\~NEW_SHA-1`. |
| 286 | The project and ref names are URL-encoded, and must use %7E for '~'. |
Gal Paikin | 756f561 | 2021-06-08 13:38:00 +0200 | [diff] [blame] | 287 | |
| 288 | A new SHA-1 of `0000000000000000000000000000000000000000` is treated as a |
| 289 | deleted ref. |
| 290 | If the new SHA-1 is not `0000000000000000000000000000000000000000`, the ref was |
| 291 | either updated or created. |
| 292 | If the old SHA-1 is `0000000000000000000000000000000000000000`, the ref was |
| 293 | created. |
| 294 | |
| 295 | .Example Request |
| 296 | ---- |
| 297 | DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 |
| 298 | ---- |
| 299 | |
| 300 | .Example Response |
| 301 | ---- |
| 302 | HTTP/1.1 204 NO CONTENT |
| 303 | Content-Disposition: attachment |
| 304 | Content-Type: application/json; charset=UTF-8 |
| 305 | X-Gerrit-UpdatedRef: myProject~refs%2Fchanges%2F01%2F1%2F1~deadbeefdeadbeefdeadbeefdeadbeefdeadbeef~0000000000000000000000000000000000000000 |
| 306 | X-Gerrit-UpdatedRef: myProject~refs%2Fchanges%2F01%2F1%2Fmeta~deadbeefdeadbeefdeadbeefdeadbeefdeadbeef~0000000000000000000000000000000000000000 |
| 307 | |
| 308 | )]}' |
| 309 | ---- |
| 310 | |
Shawn O. Pearce | ec9efd7 | 2012-04-04 20:44:39 -0700 | [diff] [blame] | 311 | GERRIT |
| 312 | ------ |
| 313 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 314 | |
| 315 | SEARCHBOX |
| 316 | --------- |