blob: 6157d37921f86134f83ae1691f7760206120d0eb [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - /changes/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01002
3This page describes the change related REST endpoints.
4Please also take note of the general information on the
5link:rest-api.html[REST API].
6
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007[[change-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008== Change Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +01009
David Ostrovsky837c0ee2014-04-27 12:54:20 +020010[[create-change]]
11=== Create Change
12--
13'POST /changes'
14--
15
16The change info link:#change-info[ChangeInfo] entity must be provided in the
17request body. Only the following attributes are honored: `project`,
18`branch`, `subject`, `status` and `topic`. The first three attributes are
19mandatory. Valid values for status are: `DRAFT` and `NEW`.
20
21.Request
22----
23 POST /changes HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090024 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020025
26 {
27 "project" : "myProject",
28 "subject" : "Let's support 100% Gerrit workflow direct in browser",
29 "branch" : "master",
30 "topic" : "create-change-in-browser",
31 "status" : "DRAFT"
32 }
33----
34
35As response a link:#change-info[ChangeInfo] entity is returned that describes
36the resulting change.
37
38.Response
39----
40 HTTP/1.1 200 OK
41 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090042 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020043
44 )]}'
45 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020046 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
47 "project": "myProject",
48 "branch": "master",
49 "topic": "create-change-in-browser",
50 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
51 "subject": "Let's support 100% Gerrit workflow direct in browser",
52 "status": "DRAFT",
53 "created": "2014-05-05 07:15:44.639000000",
54 "updated": "2014-05-05 07:15:44.639000000",
55 "mergeable": true,
56 "insertions": 0,
57 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020058 "_number": 4711,
59 "owner": {
60 "name": "John Doe"
61 }
62 }
63----
64
Edwin Kempin76202742013-02-15 13:51:50 +010065[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080066=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080067--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010068'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080069--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010070
Saša Živkovdd804022014-06-23 16:44:03 +020071Queries changes visible to the caller. The
72link:user-search.html#_search_operators[query string] must be provided
73by the `q` parameter. The `n` parameter can be used to limit the
74returned results.
Edwin Kempind0a63922013-01-23 16:32:59 +010075
Edwin Kempine3446292013-02-19 16:40:14 +010076As result a list of link:#change-info[ChangeInfo] entries is returned.
77The change output is sorted by the last update time, most recently
78updated to oldest updated.
79
Edwin Kempind0a63922013-01-23 16:32:59 +010080Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010081
82.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010083----
Edwin Kempin2091edb2013-01-23 19:07:38 +010084 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010085----
Edwin Kempind0a63922013-01-23 16:32:59 +010086
Edwin Kempin37440832013-02-06 11:36:00 +010087.Response
88----
Edwin Kempind0a63922013-01-23 16:32:59 +010089 HTTP/1.1 200 OK
90 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090091 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010092
93 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050094 [
95 {
John Spurlockd25fad12013-03-09 11:48:49 -050096 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
97 "project": "demo",
98 "branch": "master",
99 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
100 "subject": "One change",
101 "status": "NEW",
102 "created": "2012-07-17 07:18:30.854000000",
103 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500104 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100105 "insertions": 26,
106 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500107 "_number": 1756,
108 "owner": {
109 "name": "John Doe"
110 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100111 },
John Spurlockd25fad12013-03-09 11:48:49 -0500112 {
John Spurlockd25fad12013-03-09 11:48:49 -0500113 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
114 "project": "demo",
115 "branch": "master",
116 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
117 "subject": "Another change",
118 "status": "NEW",
119 "created": "2012-07-17 07:18:30.884000000",
120 "updated": "2012-07-17 07:18:30.885000000",
121 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100122 "insertions": 12,
123 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500124 "_number": 1757,
125 "owner": {
126 "name": "John Doe"
127 },
128 "_more_changes": true
129 }
130 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100131----
132
Edwin Kempind0a63922013-01-23 16:32:59 +0100133If the `n` query parameter is supplied and additional changes exist
134that match the query beyond the end, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900135`_more_changes: true` JSON field set.
136
137The `S` or `start` query parameter can be supplied to skip a number
138of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100139
140Clients are allowed to specify more than one query by setting the `q`
141parameter multiple times. In this case the result is an array of
142arrays, one per query in the same order the queries were given in.
143
Edwin Kempina64c4b92013-01-23 11:30:40 +0100144.Query for the 25 most recent open changes of the projects that you watch
145****
146get::/changes/?q=status:open+is:watched&n=25
147****
148
Edwin Kempind0a63922013-01-23 16:32:59 +0100149Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100150
151.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100152----
153 GET /changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100154----
Edwin Kempind0a63922013-01-23 16:32:59 +0100155
Edwin Kempin37440832013-02-06 11:36:00 +0100156.Response
157----
Edwin Kempind0a63922013-01-23 16:32:59 +0100158 HTTP/1.1 200 OK
159 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900160 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100161
162 )]}'
163 [
164 [
165 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100166 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
167 "project": "demo",
168 "branch": "master",
169 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
170 "subject": "One change",
171 "status": "NEW",
172 "created": "2012-07-17 07:18:30.854000000",
173 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100174 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100175 "insertions": 4,
176 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100177 "_number": 1756,
178 "owner": {
179 "name": "John Doe"
180 },
181 "labels": {
182 "Verified": {},
183 "Code-Review": {}
184 }
185 }
186 ],
187 [],
188 []
189 ]
190----
191
Edwin Kempina64c4b92013-01-23 11:30:40 +0100192.Query the changes for your user dashboard
193****
194get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
195****
196
Edwin Kempind0a63922013-01-23 16:32:59 +0100197Additional fields can be obtained by adding `o` parameters, each
198option requires more database lookups and slows down the query
199response time to the client so they are generally disabled by
200default. Optional fields are:
201
Edwin Kempine3446292013-02-19 16:40:14 +0100202[[labels]]
203--
Edwin Kempind0a63922013-01-23 16:32:59 +0100204* `LABELS`: a summary of each label required for submit, and
205 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100206--
Edwin Kempind0a63922013-01-23 16:32:59 +0100207
Edwin Kempine3446292013-02-19 16:40:14 +0100208[[detailed-labels]]
209--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800210* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800211 values of all existing approvals, recognized label values, values
212 permitted to be set by the current user, and reviewers that may be
213 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100214--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800215
Edwin Kempine3446292013-02-19 16:40:14 +0100216[[current-revision]]
217--
Edwin Kempind0a63922013-01-23 16:32:59 +0100218* `CURRENT_REVISION`: describe the current revision (patch set)
219 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100220--
Edwin Kempind0a63922013-01-23 16:32:59 +0100221
Edwin Kempine3446292013-02-19 16:40:14 +0100222[[all-revisions]]
223--
Edwin Kempind0a63922013-01-23 16:32:59 +0100224* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100225--
Edwin Kempind0a63922013-01-23 16:32:59 +0100226
Edwin Kempinea621482013-10-16 12:58:24 +0200227[[download_commands]]
228--
229* `DOWNLOAD_COMMANDS`: include the `commands` field in the
230 link:#fetch-info[FetchInfo] for revisions. Only valid when the
231 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
232--
233
David Ostrovsky17d0d332013-09-30 21:36:09 +0200234[[draft_comments]]
235--
236* `DRAFT_COMMENTS`: include the `has_draft_comments` field for
237 revisions. Only valid when the `CURRENT_REVISION` or `ALL_REVISIONS`
238 option is selected.
Dave Borowitz685bad92013-10-03 11:24:07 -0700239--
David Ostrovsky17d0d332013-09-30 21:36:09 +0200240
Edwin Kempine3446292013-02-19 16:40:14 +0100241[[current-commit]]
242--
Edwin Kempind0a63922013-01-23 16:32:59 +0100243* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900244 commit object, including message. Only valid when the
245 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100246--
Edwin Kempind0a63922013-01-23 16:32:59 +0100247
Edwin Kempine3446292013-02-19 16:40:14 +0100248[[all-commits]]
249--
Edwin Kempind0a63922013-01-23 16:32:59 +0100250* `ALL_COMMITS`: parse and output all header fields from the
251 output revisions. If only `CURRENT_REVISION` was requested
252 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100253--
Edwin Kempind0a63922013-01-23 16:32:59 +0100254
Edwin Kempine3446292013-02-19 16:40:14 +0100255[[current-files]]
256--
Edwin Kempind0a63922013-01-23 16:32:59 +0100257* `CURRENT_FILES`: list files modified by the commit, including
258 basic line counts inserted/deleted per file. Only valid when
David Pursehouse98006e82013-10-02 10:15:52 +0900259 the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100260--
Edwin Kempind0a63922013-01-23 16:32:59 +0100261
Edwin Kempine3446292013-02-19 16:40:14 +0100262[[all-files]]
263--
Edwin Kempind0a63922013-01-23 16:32:59 +0100264* `ALL_FILES`: list files modified by the commit, including
265 basic line counts inserted/deleted per file. If only the
David Pursehouse98006e82013-10-02 10:15:52 +0900266 `CURRENT_REVISION` was requested then only that commit's
Edwin Kempind0a63922013-01-23 16:32:59 +0100267 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100268--
Edwin Kempind0a63922013-01-23 16:32:59 +0100269
Edwin Kempine3446292013-02-19 16:40:14 +0100270[[detailed-accounts]]
271--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200272* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
273 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100274--
Dave Borowitz8926a882013-02-01 14:32:48 -0800275
John Spurlock74a70cc2013-03-23 16:41:50 -0400276[[messages]]
277--
278* `MESSAGES`: include messages associated with the change.
279--
280
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700281[[actions]]
282--
283* `CURRENT_ACTIONS`: include information on available actions
284 for the change and its current revision. The caller must be
285 authenticated to obtain the available actions.
286--
287
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700288[[reviewed]]
289--
290* `REVIEWED`: include the `reviewed` field if the caller is
291 authenticated and has commented on the current revision.
292--
293
Khai Do2a23ec82014-09-19 16:33:02 -0700294[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100295--
Sven Selbergd26bd542014-11-21 16:28:10 +0100296* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
297 therefore only valid in combination with `CURRENT_COMMIT` or
298 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100299--
300
Dave Borowitz4c46c242014-12-03 16:46:45 -0800301[[check]]
302--
303* `CHECK`: include potential problems with the change.
304--
305
Edwin Kempin37440832013-02-06 11:36:00 +0100306.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100307----
Edwin Kempinea621482013-10-16 12:58:24 +0200308 GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES&o=DOWNLOAD_COMMANDS HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100309----
Edwin Kempind0a63922013-01-23 16:32:59 +0100310
Edwin Kempin37440832013-02-06 11:36:00 +0100311.Response
312----
Edwin Kempind0a63922013-01-23 16:32:59 +0100313 HTTP/1.1 200 OK
314 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900315 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100316
317 )]}'
318 [
319 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900320 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100321 "project": "gerrit",
322 "branch": "master",
323 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
324 "subject": "Use an EventBus to manage star icons",
325 "status": "NEW",
326 "created": "2012-04-25 00:52:25.580000000",
327 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100328 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100329 "insertions": 16,
330 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100331 "_number": 97,
332 "owner": {
333 "name": "Shawn Pearce"
334 },
335 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
336 "revisions": {
337 "184ebe53805e102605d11f6b143486d15c23a09c": {
338 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100339 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100340 "fetch": {
341 "git": {
342 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200343 "ref": "refs/changes/97/97/1",
344 "commands": {
345 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
346 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
347 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
348 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
349 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100350 },
351 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200352 "url": "http://myuser@127.0.0.1:8080/gerrit",
353 "ref": "refs/changes/97/97/1",
354 "commands": {
355 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
356 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
357 "Format-Patch": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
358 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
359 }
360 },
361 "ssh": {
362 "url": "ssh://myuser@*:29418/gerrit",
363 "ref": "refs/changes/97/97/1",
364 "commands": {
365 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
366 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
367 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
368 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
369 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100370 }
371 },
372 "commit": {
373 "parents": [
374 {
375 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
376 "subject": "Migrate contributor agreements to All-Projects."
377 }
378 ],
379 "author": {
380 "name": "Shawn O. Pearce",
381 "email": "sop@google.com",
382 "date": "2012-04-24 18:08:08.000000000",
383 "tz": -420
384 },
385 "committer": {
386 "name": "Shawn O. Pearce",
387 "email": "sop@google.com",
388 "date": "2012-04-24 18:08:08.000000000",
389 "tz": -420
390 },
391 "subject": "Use an EventBus to manage star icons",
392 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
393 },
394 "files": {
395 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
396 "lines_deleted": 8
397 },
398 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
399 "lines_inserted": 1
400 },
401 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
402 "lines_inserted": 11,
403 "lines_deleted": 19
404 },
405 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
406 "lines_inserted": 23,
407 "lines_deleted": 20
408 },
409 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
410 "status": "D",
411 "lines_deleted": 139
412 },
413 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
414 "status": "A",
415 "lines_inserted": 204
416 },
417 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
418 "lines_deleted": 9
419 }
420 }
421 }
422 }
423 }
424 ]
425----
426
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100427[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800428=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800429--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100430'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800431--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100432
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100433Retrieves a change.
434
Dave Borowitz0314f732013-10-03 09:34:30 -0700435Additional fields can be obtained by adding `o` parameters, each
436option requires more database lookups and slows down the query
437response time to the client so they are generally disabled by
438default. Fields are described in link:#list-changes[Query Changes].
439
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100440.Request
441----
442 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
443----
444
445As response a link:#change-info[ChangeInfo] entity is returned that
446describes the change.
447
448.Response
449----
450 HTTP/1.1 200 OK
451 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900452 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100453
454 )]}'
455 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100456 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
457 "project": "myProject",
458 "branch": "master",
459 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
460 "subject": "Implementing Feature X",
461 "status": "NEW",
462 "created": "2013-02-01 09:59:32.126000000",
463 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100464 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100465 "insertions": 34,
466 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100467 "_number": 3965,
468 "owner": {
469 "name": "John Doe"
470 }
471 }
472----
473
Edwin Kempin8e492202013-02-21 15:38:25 +0100474[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800475=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800476--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100477'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800478--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100479
Edwin Kempin8e492202013-02-21 15:38:25 +0100480Retrieves a change with link:#labels[labels], link:#detailed-labels[
John Spurlock74a70cc2013-03-23 16:41:50 -0400481detailed labels], link:#detailed-accounts[detailed accounts], and
482link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100483
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700484Additional fields can be obtained by adding `o` parameters, each
485option requires more database lookups and slows down the query
486response time to the client so they are generally disabled by
487default. Fields are described in link:#list-changes[Query Changes].
488
Edwin Kempin8e492202013-02-21 15:38:25 +0100489.Request
490----
491 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
492----
493
494As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700495describes the change. This response will contain all votes for each
496label and include one combined vote. The combined label vote is
497calculated in the following order (from highest to lowest):
498REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100499
500.Response
501----
502 HTTP/1.1 200 OK
503 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900504 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100505
506 )]}'
507 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100508 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
509 "project": "myProject",
510 "branch": "master",
511 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
512 "subject": "Implementing Feature X",
513 "status": "NEW",
514 "created": "2013-02-01 09:59:32.126000000",
515 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100516 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100517 "insertions": 126,
518 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100519 "_number": 3965,
520 "owner": {
521 "_account_id": 1000096,
522 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200523 "email": "john.doe@example.com",
524 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100525 },
526 "labels": {
527 "Verified": {
528 "all": [
529 {
530 "value": 0,
531 "_account_id": 1000096,
532 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200533 "email": "john.doe@example.com",
534 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100535 },
536 {
537 "value": 0,
538 "_account_id": 1000097,
539 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200540 "email": "jane.roe@example.com",
541 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100542 }
543 ],
544 "values": {
545 "-1": "Fails",
546 " 0": "No score",
547 "+1": "Verified"
548 }
549 },
550 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100551 "disliked": {
552 "_account_id": 1000096,
553 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200554 "email": "john.doe@example.com",
555 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100556 },
557 "all": [
558 {
559 "value": -1,
560 "_account_id": 1000096,
561 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200562 "email": "john.doe@example.com",
563 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100564 },
565 {
566 "value": 1,
567 "_account_id": 1000097,
568 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200569 "email": "jane.roe@example.com",
570 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100571 }
572 ]
573 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400574 "-2": "This shall not be merged",
575 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100576 " 0": "No score",
577 "+1": "Looks good to me, but someone else must approve",
578 "+2": "Looks good to me, approved"
579 }
580 }
581 },
582 "permitted_labels": {
583 "Verified": [
584 "-1",
585 " 0",
586 "+1"
587 ],
588 "Code-Review": [
589 "-2",
590 "-1",
591 " 0",
592 "+1",
593 "+2"
594 ]
595 },
596 "removable_reviewers": [
597 {
598 "_account_id": 1000096,
599 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200600 "email": "john.doe@example.com",
601 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100602 },
603 {
604 "_account_id": 1000097,
605 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200606 "email": "jane.roe@example.com",
607 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100608 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400609 ],
610 "messages": [
611 {
612 "id": "YH-egE",
613 "author": {
614 "_account_id": 1000096,
615 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200616 "email": "john.doe@example.com",
617 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400618 },
619 "updated": "2013-03-23 21:34:02.419000000",
620 "message": "Patch Set 1:\n\nThis is the first message.",
621 "revision_number": 1
622 },
623 {
624 "id": "WEEdhU",
625 "author": {
626 "_account_id": 1000097,
627 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200628 "email": "jane.roe@example.com",
629 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400630 },
631 "updated": "2013-03-23 21:36:52.332000000",
632 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
633 "revision_number": 1
634 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100635 ]
636 }
637----
638
Edwin Kempin64006bb2013-02-22 08:17:04 +0100639[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800640=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800641--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100642'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800643--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100644
Edwin Kempin64006bb2013-02-22 08:17:04 +0100645Retrieves the topic of a change.
646
647.Request
648----
649 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
650----
651
652.Response
653----
654 HTTP/1.1 200 OK
655 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900656 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100657
658 )]}'
659 "Documentation"
660----
661
662If the change does not have a topic an empty string is returned.
663
664[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800665=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800666--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100667'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800668--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100669
Edwin Kempin64006bb2013-02-22 08:17:04 +0100670Sets the topic of a change.
671
672The new topic must be provided in the request body inside a
673link:#topic-input[TopicInput] entity.
674
675.Request
676----
677 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900678 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100679
680 {
681 "topic": "Documentation"
682 }
683----
684
685As response the new topic is returned.
686
687.Response
688----
689 HTTP/1.1 200 OK
690 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900691 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100692
693 )]}'
694 "Documentation"
695----
696
697If the topic was deleted the response is "`204 No Content`".
698
699[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800700=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800701--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100702'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800703--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100704
Edwin Kempin64006bb2013-02-22 08:17:04 +0100705Deletes the topic of a change.
706
707The request body does not need to include a link:#topic-input[
708TopicInput] entity if no review comment is added.
709
710Please note that some proxies prohibit request bodies for DELETE
711requests. In this case, if you want to specify a commit message, use
712link:#set-topic[PUT] to delete the topic.
713
714.Request
715----
716 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
717----
718
719.Response
720----
721 HTTP/1.1 204 No Content
722----
723
Edwin Kempined5364b2013-02-22 10:39:33 +0100724[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800725=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800726--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100727'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800728--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100729
Edwin Kempined5364b2013-02-22 10:39:33 +0100730Abandons a change.
731
732The request body does not need to include a link:#abandon-input[
733AbandonInput] entity if no review comment is added.
734
735.Request
736----
737 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
738----
739
740As response a link:#change-info[ChangeInfo] entity is returned that
741describes the abandoned change.
742
743.Response
744----
745 HTTP/1.1 200 OK
746 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900747 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100748
749 )]}'
750 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100751 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
752 "project": "myProject",
753 "branch": "master",
754 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
755 "subject": "Implementing Feature X",
756 "status": "ABANDONED",
757 "created": "2013-02-01 09:59:32.126000000",
758 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100759 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100760 "insertions": 3,
761 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +0100762 "_number": 3965,
763 "owner": {
764 "name": "John Doe"
765 }
766 }
767----
768
769If the change cannot be abandoned because the change state doesn't
770allow abandoning of the change, the response is "`409 Conflict`" and
771the error message is contained in the response body.
772
773.Response
774----
775 HTTP/1.1 409 Conflict
776 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900777 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100778
779 change is merged
780----
781
782[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800783=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800784--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100785'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800786--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100787
Edwin Kempined5364b2013-02-22 10:39:33 +0100788Restores a change.
789
790The request body does not need to include a link:#restore-input[
791RestoreInput] entity if no review comment is added.
792
793.Request
794----
795 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
796----
797
798As response a link:#change-info[ChangeInfo] entity is returned that
799describes the restored change.
800
801.Response
802----
803 HTTP/1.1 200 OK
804 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900805 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100806
807 )]}'
808 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100809 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
810 "project": "myProject",
811 "branch": "master",
812 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
813 "subject": "Implementing Feature X",
814 "status": "NEW",
815 "created": "2013-02-01 09:59:32.126000000",
816 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100817 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100818 "insertions": 2,
819 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +0100820 "_number": 3965,
821 "owner": {
822 "name": "John Doe"
823 }
824 }
825----
826
827If the change cannot be restored because the change state doesn't
828allow restoring the change, the response is "`409 Conflict`" and
829the error message is contained in the response body.
830
831.Response
832----
833 HTTP/1.1 409 Conflict
834 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900835 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100836
837 change is new
838----
839
Edwin Kempincdae63b2013-03-15 15:06:59 +0100840[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800841=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800842--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100843'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800844--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100845
846Rebases a change.
847
848.Request
849----
850 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
851----
852
853As response a link:#change-info[ChangeInfo] entity is returned that
854describes the rebased change. Information about the current patch set
855is included.
856
857.Response
858----
859 HTTP/1.1 200 OK
860 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900861 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +0100862
863 )]}'
864 {
Edwin Kempincdae63b2013-03-15 15:06:59 +0100865 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
866 "project": "myProject",
867 "branch": "master",
868 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
869 "subject": "Implement Feature X",
870 "status": "NEW",
871 "created": "2013-02-01 09:59:32.126000000",
872 "updated": "2013-02-21 11:16:36.775000000",
873 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100874 "insertions": 33,
875 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +0100876 "_number": 4799,
877 "owner": {
878 "name": "John Doe"
879 },
880 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
881 "revisions": {
882 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
883 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100884 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +0100885 "fetch": {
886 "http": {
887 "url": "http://gerrit:8080/myProject",
888 "ref": "refs/changes/99/4799/2"
889 }
890 },
891 "commit": {
892 "parents": [
893 {
894 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
895 "subject": "Implement Feature A"
896 }
897 ],
898 "author": {
899 "name": "John Doe",
900 "email": "john.doe@example.com",
901 "date": "2013-05-07 15:21:27.000000000",
902 "tz": 120
903 },
904 "committer": {
905 "name": "Gerrit Code Review",
906 "email": "gerrit-server@example.com",
907 "date": "2013-05-07 15:35:43.000000000",
908 "tz": 120
909 },
910 "subject": "Implement Feature X",
911 "message": "Implement Feature X\n\nAdded feature X."
912 }
913 }
914 }
915----
916
917If the change cannot be rebased, e.g. due to conflicts, the response is
918"`409 Conflict`" and the error message is contained in the response
919body.
920
921.Response
922----
923 HTTP/1.1 409 Conflict
924 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900925 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +0100926
927 The change could not be rebased due to a path conflict during merge.
928----
929
Edwin Kempind2ec4152013-02-22 12:17:19 +0100930[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800931=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800932--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100933'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800934--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100935
Edwin Kempind2ec4152013-02-22 12:17:19 +0100936Reverts a change.
937
938The request body does not need to include a link:#revert-input[
939RevertInput] entity if no review comment is added.
940
941.Request
942----
943 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
944----
945
946As response a link:#change-info[ChangeInfo] entity is returned that
947describes the reverting change.
948
949.Response
950----
951 HTTP/1.1 200 OK
952 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900953 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +0100954
955 )]}'
956 {
Edwin Kempind2ec4152013-02-22 12:17:19 +0100957 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
958 "project": "myProject",
959 "branch": "master",
960 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
961 "subject": "Revert \"Implementing Feature X\"",
962 "status": "NEW",
963 "created": "2013-02-01 09:59:32.126000000",
964 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +0100965 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100966 "insertions": 6,
967 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +0100968 "_number": 3965,
969 "owner": {
970 "name": "John Doe"
971 }
972 }
973----
974
975If the change cannot be reverted because the change state doesn't
976allow reverting the change, the response is "`409 Conflict`" and
977the error message is contained in the response body.
978
979.Response
980----
981 HTTP/1.1 409 Conflict
982 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900983 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +0100984
985 change is new
986----
987
Edwin Kempin0eddba02013-02-22 15:30:12 +0100988[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800989=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800990--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100991'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800992--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100993
Edwin Kempin0eddba02013-02-22 15:30:12 +0100994Submits a change.
995
996The request body only needs to include a link:#submit-input[
997SubmitInput] entity if the request should wait for the merge to
998complete.
999
1000.Request
1001----
1002 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001003 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001004
1005 {
1006 "wait_for_merge": true
1007 }
1008----
1009
1010As response a link:#change-info[ChangeInfo] entity is returned that
1011describes the submitted/merged change.
1012
1013.Response
1014----
1015 HTTP/1.1 200 OK
1016 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001017 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001018
1019 )]}'
1020 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001021 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1022 "project": "myProject",
1023 "branch": "master",
1024 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1025 "subject": "Implementing Feature X",
1026 "status": "MERGED",
1027 "created": "2013-02-01 09:59:32.126000000",
1028 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001029 "_number": 3965,
1030 "owner": {
1031 "name": "John Doe"
1032 }
1033 }
1034----
1035
1036If the change cannot be submitted because the submit rule doesn't allow
1037submitting the change, the response is "`409 Conflict`" and the error
1038message is contained in the response body.
1039
1040.Response
1041----
1042 HTTP/1.1 409 Conflict
1043 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001044 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001045
1046 blocked by Verified
1047----
1048
David Ostrovsky0d69c232013-09-10 23:10:23 +02001049[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001050=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001051--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001052'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001053--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001054
1055Publishes a draft change.
1056
1057.Request
1058----
1059 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001060 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001061----
1062
1063.Response
1064----
1065 HTTP/1.1 204 No Content
1066----
1067
1068[[delete-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001069=== Delete Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001070--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001071'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001072--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001073
1074Deletes a draft change.
1075
1076.Request
1077----
1078 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001079 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001080----
1081
1082.Response
1083----
1084 HTTP/1.1 204 No Content
1085----
1086
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001087[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001088=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001089--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001090'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001091--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001092
1093Retrieves the branches and tags in which a change is included. As result
1094an link:#included-in-info[IncludedInInfo] entity is returned.
1095
1096.Request
1097----
1098 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1099----
1100
1101.Response
1102----
1103 HTTP/1.1 200 OK
1104 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001105 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001106
1107 )]}'
1108 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001109 "branches": [
1110 "master"
1111 ],
1112 "tags": []
1113 }
1114----
1115
David Pursehouse4e38b972014-05-30 10:36:40 +09001116[[index-change]]
1117=== Index Change
1118--
1119'POST /changes/link:#change-id[\{change-id\}]/index'
1120--
1121
1122Adds or updates the change in the secondary index.
1123
1124.Request
1125----
1126 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1127----
1128
1129.Response
1130----
1131 HTTP/1.1 204 No Content
1132----
1133
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001134[[check-change]]
1135=== Check change
1136--
1137'GET /changes/link:#change-id[\{change-id\}]/check'
1138--
1139
1140Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05001141link:#change-info[ChangeInfo] entity with the `problems` field set to a
1142list of link:#problem-info[ProblemInfo] entities.
1143
1144Depending on the type of problem, some fields not marked optional may be
1145missing from the result. At least `id`, `project`, `branch`, and
1146`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001147
1148.Request
1149----
1150 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1151----
1152
1153.Response
1154----
1155 HTTP/1.1 200 OK
1156 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001157 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001158
1159 )]}'
1160 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05001161 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1162 "project": "myProject",
1163 "branch": "master",
1164 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1165 "subject": "Implementing Feature X",
1166 "status": "NEW",
1167 "created": "2013-02-01 09:59:32.126000000",
1168 "updated": "2013-02-21 11:16:36.775000000",
1169 "mergeable": true,
1170 "insertions": 34,
1171 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05001172 "_number": 3965,
1173 "owner": {
1174 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001175 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05001176 "problems": [
1177 {
1178 "message": "Current patch set 1 not found"
1179 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001180 ]
1181 }
1182----
1183
Dave Borowitz3be39d02014-12-03 17:57:38 -08001184[[fix-change]]
1185=== Fix change
1186--
1187'POST /changes/link:#change-id[\{change-id\}]/check'
1188--
1189
1190Performs consistency checks on the change as with link:#check-change[GET
1191/check], and additionally fixes any problems that can be fixed
1192automatically. The returned field values reflect any fixes.
1193
1194Only the change owner, a project owner, or an administrator may fix changes.
1195
1196.Request
1197----
1198 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1199----
1200
1201.Response
1202----
1203 HTTP/1.1 200 OK
1204 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001205 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08001206
1207 )]}'
1208 {
1209 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1210 "project": "myProject",
1211 "branch": "master",
1212 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1213 "subject": "Implementing Feature X",
1214 "status": "MERGED",
1215 "created": "2013-02-01 09:59:32.126000000",
1216 "updated": "2013-02-21 11:16:36.775000000",
1217 "mergeable": true,
1218 "insertions": 34,
1219 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08001220 "_number": 3965,
1221 "owner": {
1222 "name": "John Doe"
1223 },
1224 "problems": [
1225 {
1226 "message": "Current patch set 2 not found"
1227 },
1228 {
1229 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
1230 "status": FIXED,
1231 "outcome": "Marked change as merged"
1232 }
1233 ]
1234 }
1235----
1236
David Ostrovsky1a49f622014-07-29 00:40:02 +02001237[[edit-endpoints]]
1238== Change Edit Endpoints
1239
1240These endpoints are considered to be unstable and can be changed in
1241backwards incompatible way any time without notice.
1242
1243[[get-edit-detail]]
1244=== Get Change Edit Details
1245--
1246'GET /changes/link:#change-id[\{change-id\}]/edit
1247--
1248
1249Retrieves a change edit details.
1250
1251.Request
1252----
1253 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1254----
1255
1256As response an link:#edit-info[EditInfo] entity is returned that
1257describes the change edit, or "`204 No Content`" when change edit doesn't
1258exist for this change. Change edits are stored on special branches and there
1259can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02001260When request parameter `list` is provided the response also includes the file
1261list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02001262against this base revision. When request parameter `download-commands` is
1263provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02001264
1265.Response
1266----
1267 HTTP/1.1 200 OK
1268 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001269 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02001270
1271 )]}'
1272 {
1273 "commit":{
1274 "parents":[
1275 {
1276 "commit":"1eee2c9d8f352483781e772f35dc586a69ff5646",
1277 }
1278 ],
1279 "author":{
1280 "name":"Shawn O. Pearce",
1281 "email":"sop@google.com",
1282 "date":"2012-04-24 18:08:08.000000000",
1283 "tz":-420
1284 },
1285 "committer":{
1286 "name":"Shawn O. Pearce",
1287 "email":"sop@google.com",
1288 "date":"2012-04-24 18:08:08.000000000",
1289 "tz":-420
1290 },
1291 "subject":"Use an EventBus to manage star icons",
1292 "message":"Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1293 },
1294 }
1295----
David Pursehouse4e38b972014-05-30 10:36:40 +09001296
David Ostrovskya5ab8292014-08-01 02:11:39 +02001297[[put-edit-file]]
1298=== Change file content in Change Edit
1299--
1300'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
1301--
1302
1303Put content of a file to a change edit.
1304
1305.Request
1306----
1307 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1308----
1309
1310When change edit doesn't exist for this change yet it is created. When file
1311content isn't provided, it is wiped out for that file. As response
1312"`204 No Content`" is returned.
1313
1314.Response
1315----
1316 HTTP/1.1 204 No Content
1317----
1318
David Ostrovsky138edb42014-08-15 21:31:43 +02001319[[post-edit]]
1320=== Restore file content in Change Edit
1321--
1322'POST /changes/link:#change-id[\{change-id\}]/edit
1323--
1324
1325Creates empty change edit or restores file content in change edit. The
1326request body needs to include a link:#change-edit-input[ChangeEditInput]
1327entity when a file within change edit should be restored.
1328
1329.Request
1330----
1331 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001332 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02001333
1334 {
David Ostrovskybd12e172014-08-21 23:08:15 +02001335 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02001336 }
1337----
1338
1339When change edit doesn't exist for this change yet it is created. When path
1340and restore flag are provided in request body, this file is restored. As
1341response "`204 No Content`" is returned.
1342
1343.Response
1344----
1345 HTTP/1.1 204 No Content
1346----
1347
David Ostrovskyc967e152014-10-24 17:36:16 +02001348[[put-change-edit-message]]
1349=== Change commit message in Change Edit
1350--
1351'PUT /changes/link:#change-id[\{change-id\}]/edit:message
1352--
1353
1354Modify commit message. The request body needs to include a
1355link:#change-edit-message-input[ChangeEditMessageInput]
1356entity.
1357
1358.Request
1359----
1360 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001361 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02001362
1363 {
1364 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
1365 }
1366----
1367
1368If a change edit doesn't exist for this change yet, it is created. As
1369response "`204 No Content`" is returned.
1370
1371.Response
1372----
1373 HTTP/1.1 204 No Content
1374----
1375
David Ostrovsky2830c292014-08-01 02:24:31 +02001376[[delete-edit-file]]
1377=== Delete file in Change Edit
1378--
1379'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
1380--
1381
1382Deletes a file from a change edit. This deletes the file from the repository
1383completely. This is not the same as reverting or restoring a file to its
1384previous contents.
1385
1386.Request
1387----
1388 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1389----
1390
1391When change edit doesn't exist for this change yet it is created.
1392
1393.Response
1394----
1395 HTTP/1.1 204 No Content
1396----
1397
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001398[[get-edit-file]]
1399=== Retrieve file content from Change Edit
1400--
1401'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
1402--
1403
1404Retrieves content of a file from a change edit.
1405
1406.Request
1407----
1408 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1409----
1410
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05001411The content of the file is returned as text encoded inside base64.
1412The Content-Type header will always be `text/plain` reflecting the
1413outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
1414can be examined to find the server detected content type of the file.
1415
1416When the specified file was deleted in the change edit
1417"`204 No Content`" is returned.
1418
1419If only the content type is required, callers should use HEAD to
1420avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001421
1422.Response
1423----
1424 HTTP/1.1 200 OK
1425 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001426 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001427 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05001428 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001429
1430 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
1431----
1432
David Ostrovsky3d2c0702014-10-28 23:44:27 +01001433[[get-edit-message]]
1434=== Retrieve commit message from Change Edit or current patch set of the change
1435--
1436'GET /changes/link:#change-id[\{change-id\}]/edit:message
1437--
1438
David Ostrovsky25ad15e2014-12-15 21:18:59 +01001439Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01001440
1441.Request
1442----
1443 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
1444----
1445
1446The commit message is returned as base64 encoded string.
1447
1448.Response
1449----
1450 HTTP/1.1 200 OK
1451
1452 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
1453M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
1454----
1455
David Ostrovskye9988f92014-08-01 09:56:34 +02001456[[publish-edit]]
1457=== Publish Change Edit
1458--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001459'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02001460--
1461
1462Promotes change edit to a regular patch set.
1463
1464.Request
1465----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001466 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
David Ostrovskye9988f92014-08-01 09:56:34 +02001467----
1468
1469As response "`204 No Content`" is returned.
1470
1471.Response
1472----
1473 HTTP/1.1 204 No Content
1474----
1475
David Ostrovsky46999d22014-08-16 02:19:13 +02001476[[rebase-edit]]
1477=== Rebase Change Edit
1478--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001479'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02001480--
1481
1482Rebases change edit on top of latest patch set.
1483
1484.Request
1485----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001486 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02001487----
1488
1489When change was rebased on top of latest patch set, response
1490"`204 No Content`" is returned. When change edit is aready
1491based on top of the latest patch set, the response
1492"`409 Conflict`" is returned.
1493
1494.Response
1495----
1496 HTTP/1.1 204 No Content
1497----
1498
David Ostrovsky8e75f502014-08-10 00:36:31 +02001499[[delete-edit]]
1500=== Delete Change Edit
1501--
1502'DELETE /changes/link:#change-id[\{change-id\}]/edit'
1503--
1504
1505Deletes change edit.
1506
1507.Request
1508----
1509 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1510----
1511
1512As response "`204 No Content`" is returned.
1513
1514.Response
1515----
1516 HTTP/1.1 204 No Content
1517----
1518
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001519[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001520== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001521
1522[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001523=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001524--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001525'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001526--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001527
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001528Lists the reviewers of a change.
1529
1530As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
1531
1532.Request
1533----
1534 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
1535----
1536
1537.Response
1538----
1539 HTTP/1.1 200 OK
1540 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001541 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001542
1543 )]}'
1544 [
1545 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001546 "approvals": {
1547 "Verified": "+1",
1548 "Code-Review": "+2"
1549 },
1550 "_account_id": 1000096,
1551 "name": "John Doe",
1552 "email": "john.doe@example.com"
1553 },
1554 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001555 "approvals": {
1556 "Verified": " 0",
1557 "Code-Review": "-1"
1558 },
1559 "_account_id": 1000097,
1560 "name": "Jane Roe",
1561 "email": "jane.roe@example.com"
1562 }
1563 ]
1564----
1565
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001566[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001567=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001568--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001569'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001570--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001571
1572Suggest the reviewers for a given query `q` and result limit `n`. If result
1573limit is not passed, then the default 10 is used.
1574
1575As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
1576
1577.Request
1578----
1579 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
1580----
1581
1582.Response
1583----
1584 HTTP/1.1 200 OK
1585 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001586 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001587
1588 )]}'
1589 [
1590 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001591 "account": {
1592 "_account_id": 1000097,
1593 "name": "Jane Roe",
1594 "email": "jane.roe@example.com"
1595 }
1596 },
1597 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001598 "group": {
1599 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
1600 "name": "Joiner"
1601 }
1602 }
1603 ]
1604----
1605
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001606[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001607=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001608--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001609'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001610--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001611
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001612Retrieves a reviewer of a change.
1613
1614As response a link:#reviewer-info[ReviewerInfo] entity is returned that
1615describes the reviewer.
1616
1617.Request
1618----
1619 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
1620----
1621
1622.Response
1623----
1624 HTTP/1.1 200 OK
1625 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001626 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001627
1628 )]}'
1629 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001630 "approvals": {
1631 "Verified": "+1",
1632 "Code-Review": "+2"
1633 },
1634 "_account_id": 1000096,
1635 "name": "John Doe",
1636 "email": "john.doe@example.com"
1637 }
1638----
1639
Edwin Kempin392328e2013-02-25 12:50:03 +01001640[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001641=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001642--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001643'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001644--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001645
Edwin Kempin392328e2013-02-25 12:50:03 +01001646Adds one user or all members of one group as reviewer to the change.
1647
1648The reviewer to be added to the change must be provided in the request
1649body as a link:#reviewer-input[ReviewerInput] entity.
1650
1651.Request
1652----
1653 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001654 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01001655
1656 {
1657 "reviewer": "john.doe@example.com"
1658 }
1659----
1660
1661As response an link:#add-reviewer-result[AddReviewerResult] entity is
1662returned that describes the newly added reviewers.
1663
1664.Response
1665----
1666 HTTP/1.1 200 OK
1667 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001668 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01001669
1670 )]}'
1671 {
1672 "reviewers": [
1673 {
Edwin Kempin392328e2013-02-25 12:50:03 +01001674 "approvals": {
1675 "Verified": " 0",
1676 "Code-Review": " 0"
1677 },
1678 "_account_id": 1000096,
1679 "name": "John Doe",
1680 "email": "john.doe@example.com"
1681 }
1682 ]
1683 }
1684----
1685
1686If a group is specified, adding the group members as reviewers is an
1687atomic operation. This means if an error is returned, none of the
1688members are added as reviewer.
1689
1690If a group with many members is added as reviewer a confirmation may be
1691required.
1692
1693.Request
1694----
1695 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001696 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01001697
1698 {
1699 "reviewer": "MyProjectVerifiers"
1700 }
1701----
1702
1703.Response
1704----
1705 HTTP/1.1 200 OK
1706 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001707 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01001708
1709 )]}'
1710 {
1711 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
1712 "confirm": true
1713 }
1714----
1715
1716To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01001717`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01001718
1719.Request
1720----
1721 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001722 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01001723
1724 {
1725 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01001726 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01001727 }
1728----
1729
Edwin Kempin53301072013-02-25 12:57:07 +01001730[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001731=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001732--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001733'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001734--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001735
Edwin Kempin53301072013-02-25 12:57:07 +01001736Deletes a reviewer from a change.
1737
1738.Request
1739----
1740 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
1741----
1742
1743.Response
1744----
1745 HTTP/1.1 204 No Content
1746----
1747
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001748[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001749== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001750
Shawn Pearce728ba882013-07-08 23:13:08 -07001751[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001752=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001753--
Shawn Pearce728ba882013-07-08 23:13:08 -07001754'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001755--
Shawn Pearce728ba882013-07-08 23:13:08 -07001756
1757Retrieves a parsed commit of a revision.
1758
1759.Request
1760----
1761 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
1762----
1763
1764As response a link:#commit-info[CommitInfo] entity is returned that
1765describes the revision.
1766
1767.Response
1768----
1769 HTTP/1.1 200 OK
1770 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001771 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07001772
1773 )]}'
1774 {
Shawn Pearce728ba882013-07-08 23:13:08 -07001775 "parents": [
1776 {
1777 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
1778 "subject": "Migrate contributor agreements to All-Projects."
1779 }
1780 ],
1781 "author": {
1782 "name": "Shawn O. Pearce",
1783 "email": "sop@google.com",
1784 "date": "2012-04-24 18:08:08.000000000",
1785 "tz": -420
1786 },
1787 "committer": {
1788 "name": "Shawn O. Pearce",
1789 "email": "sop@google.com",
1790 "date": "2012-04-24 18:08:08.000000000",
1791 "tz": -420
1792 },
1793 "subject": "Use an EventBus to manage star icons",
1794 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1795 }
1796----
1797
Sven Selbergd26bd542014-11-21 16:28:10 +01001798Adding query parameter `links` (for example `/changes/.../commit?links`)
1799returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07001800
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001801[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001802=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001803--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001804'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001805--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001806
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001807Retrieves a review of a revision.
1808
1809.Request
1810----
1811 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1812----
1813
1814As response a link:#change-info[ChangeInfo] entity with
1815link:#detailed-labels[detailed labels] and link:#detailed-accounts[
1816detailed accounts] is returned that describes the review of the
1817revision. The revision for which the review is retrieved is contained
1818in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05001819set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001820revision of the change. Please note that the returned labels are always
1821for the current patch set.
1822
1823.Response
1824----
1825 HTTP/1.1 200 OK
1826 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001827 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001828
1829 )]}'
1830 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001831 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1832 "project": "myProject",
1833 "branch": "master",
1834 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1835 "subject": "Implementing Feature X",
1836 "status": "NEW",
1837 "created": "2013-02-01 09:59:32.126000000",
1838 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001839 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001840 "insertions": 34,
1841 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001842 "_number": 3965,
1843 "owner": {
1844 "_account_id": 1000096,
1845 "name": "John Doe",
1846 "email": "john.doe@example.com"
1847 },
1848 "labels": {
1849 "Verified": {
1850 "all": [
1851 {
1852 "value": 0,
1853 "_account_id": 1000096,
1854 "name": "John Doe",
1855 "email": "john.doe@example.com"
1856 },
1857 {
1858 "value": 0,
1859 "_account_id": 1000097,
1860 "name": "Jane Roe",
1861 "email": "jane.roe@example.com"
1862 }
1863 ],
1864 "values": {
1865 "-1": "Fails",
1866 " 0": "No score",
1867 "+1": "Verified"
1868 }
1869 },
1870 "Code-Review": {
1871 "all": [
1872 {
1873 "value": -1,
1874 "_account_id": 1000096,
1875 "name": "John Doe",
1876 "email": "john.doe@example.com"
1877 },
1878 {
1879 "value": 1,
1880 "_account_id": 1000097,
1881 "name": "Jane Roe",
1882 "email": "jane.roe@example.com"
1883 }
1884 ]
1885 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04001886 "-2": "This shall not be merged",
1887 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001888 " 0": "No score",
1889 "+1": "Looks good to me, but someone else must approve",
1890 "+2": "Looks good to me, approved"
1891 }
1892 }
1893 },
1894 "permitted_labels": {
1895 "Verified": [
1896 "-1",
1897 " 0",
1898 "+1"
1899 ],
1900 "Code-Review": [
1901 "-2",
1902 "-1",
1903 " 0",
1904 "+1",
1905 "+2"
1906 ]
1907 },
1908 "removable_reviewers": [
1909 {
1910 "_account_id": 1000096,
1911 "name": "John Doe",
1912 "email": "john.doe@example.com"
1913 },
1914 {
1915 "_account_id": 1000097,
1916 "name": "Jane Roe",
1917 "email": "jane.roe@example.com"
1918 }
1919 ],
1920 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1921 "revisions": {
1922 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1923 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001924 "ref": "refs/changes/65/3965/2",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001925 "fetch": {
1926 "http": {
1927 "url": "http://gerrit/myProject",
1928 "ref": "refs/changes/65/3965/2"
1929 }
1930 }
1931 }
1932 }
1933----
1934
David Pursehouse669f2512014-07-18 11:41:42 +09001935[[get-related-changes]]
1936=== Get Related Changes
1937--
1938'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
1939--
1940
1941Retrieves related changes of a revision. Related changes are changes that either
1942depend on, or are dependencies of the revision.
1943
1944.Request
1945----
1946 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
1947----
1948
1949As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
1950describing the related changes.
1951
1952.Response
1953----
1954 HTTP/1.1 200 OK
1955 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001956 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09001957
1958 )]}'
1959 {
1960 "changes": [
1961 {
1962 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
1963 "commit": {
1964 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
1965 "parents": [
1966 {
1967 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
1968 }
1969 ],
1970 "author": {
1971 "name": "David Ostrovsky",
1972 "email": "david@ostrovsky.org",
1973 "date": "2014-07-12 15:04:24.000000000",
1974 "tz": 120
1975 },
1976 "subject": "Remove Solr"
1977 },
1978 "_change_number": 58478,
1979 "_revision_number": 2,
1980 "_current_revision_number": 2
1981 },
1982 {
1983 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
1984 "commit": {
1985 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
1986 "parents": [
1987 {
1988 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
1989 }
1990 ],
1991 "author": {
1992 "name": "David Pursehouse",
1993 "email": "david.pursehouse@sonymobile.com",
1994 "date": "2014-06-24 02:01:28.000000000",
1995 "tz": 540
1996 },
1997 "subject": "Add support for secondary index with Elasticsearch"
1998 },
1999 "_change_number": 58081,
2000 "_revision_number": 10,
2001 "_current_revision_number": 10
2002 }
2003 ]
2004 }
2005----
2006
2007
Edwin Kempin67498de2013-02-25 16:15:34 +01002008[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002009=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002010--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002011'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002012--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002013
Edwin Kempin67498de2013-02-25 16:15:34 +01002014Sets a review on a revision.
2015
2016The review must be provided in the request body as a
2017link:#review-input[ReviewInput] entity.
2018
2019.Request
2020----
2021 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002022 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002023
2024 {
2025 "message": "Some nits need to be fixed.",
2026 "labels": {
2027 "Code-Review": -1
2028 },
2029 "comments": {
2030 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2031 {
2032 "line": 23,
2033 "message": "[nit] trailing whitespace"
2034 },
2035 {
2036 "line": 49,
2037 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09002038 },
2039 {
2040 "range": {
2041 "start_line": 50,
2042 "start_character": 0,
2043 "end_line": 55,
2044 "end_character": 20
2045 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09002046 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01002047 }
2048 ]
2049 }
2050 }
2051----
2052
2053As response a link:#review-info[ReviewInfo] entity is returned that
2054describes the applied labels.
2055
2056.Response
2057----
2058 HTTP/1.1 200 OK
2059 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002060 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002061
2062 )]}'
2063 {
2064 "labels": {
2065 "Code-Review": -1
2066 }
2067 }
2068----
2069
Edwin Kempincdae63b2013-03-15 15:06:59 +01002070[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002071=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002072--
Edwin Kempincdae63b2013-03-15 15:06:59 +01002073'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002074--
Edwin Kempincdae63b2013-03-15 15:06:59 +01002075
2076Rebases a revision.
2077
2078.Request
2079----
2080 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
2081----
2082
2083As response a link:#change-info[ChangeInfo] entity is returned that
2084describes the rebased change. Information about the current patch set
2085is included.
2086
2087.Response
2088----
2089 HTTP/1.1 200 OK
2090 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002091 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01002092
2093 )]}'
2094 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01002095 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
2096 "project": "myProject",
2097 "branch": "master",
2098 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
2099 "subject": "Implement Feature X",
2100 "status": "NEW",
2101 "created": "2013-02-01 09:59:32.126000000",
2102 "updated": "2013-02-21 11:16:36.775000000",
2103 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002104 "insertions": 21,
2105 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01002106 "_number": 4799,
2107 "owner": {
2108 "name": "John Doe"
2109 },
2110 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
2111 "revisions": {
2112 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
2113 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01002114 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01002115 "fetch": {
2116 "http": {
2117 "url": "http://gerrit:8080/myProject",
2118 "ref": "refs/changes/99/4799/2"
2119 }
2120 },
2121 "commit": {
2122 "parents": [
2123 {
2124 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
2125 "subject": "Implement Feature A"
2126 }
2127 ],
2128 "author": {
2129 "name": "John Doe",
2130 "email": "john.doe@example.com",
2131 "date": "2013-05-07 15:21:27.000000000",
2132 "tz": 120
2133 },
2134 "committer": {
2135 "name": "Gerrit Code Review",
2136 "email": "gerrit-server@example.com",
2137 "date": "2013-05-07 15:35:43.000000000",
2138 "tz": 120
2139 },
2140 "subject": "Implement Feature X",
2141 "message": "Implement Feature X\n\nAdded feature X."
2142 }
2143 }
2144 }
2145----
2146
2147If the revision cannot be rebased, e.g. due to conflicts, the response is
2148"`409 Conflict`" and the error message is contained in the response
2149body.
2150
2151.Response
2152----
2153 HTTP/1.1 409 Conflict
2154 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002155 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01002156
2157 The change could not be rebased due to a path conflict during merge.
2158----
2159
Edwin Kempin14b58112013-02-26 16:30:19 +01002160[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002161=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002162--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002163'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002164--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002165
Edwin Kempin14b58112013-02-26 16:30:19 +01002166Submits a revision.
2167
2168The request body only needs to include a link:#submit-input[
2169SubmitInput] entity if the request should wait for the merge to
2170complete.
2171
2172.Request
2173----
2174 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002175 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002176
2177 {
2178 "wait_for_merge": true
2179 }
2180----
2181
2182As response a link:#submit-info[SubmitInfo] entity is returned that
2183describes the status of the submitted change.
2184
2185.Response
2186----
2187 HTTP/1.1 200 OK
2188 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002189 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002190
2191 )]}'
2192 {
2193 "status": "MERGED"
2194 }
2195----
2196
2197If the revision cannot be submitted, e.g. because the submit rule
2198doesn't allow submitting the revision or the revision is not the
2199current revision, the response is "`409 Conflict`" and the error
2200message is contained in the response body.
2201
2202.Response
2203----
2204 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002205 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002206
2207 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
2208----
2209
David Ostrovsky0d69c232013-09-10 23:10:23 +02002210[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002211=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002212--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002213'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002214--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002215
2216Publishes a draft revision.
2217
2218.Request
2219----
2220 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002221 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002222----
2223
2224.Response
2225----
2226 HTTP/1.1 204 No Content
2227----
2228
2229[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002230=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002231--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002232'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002233--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002234
2235Deletes a draft revision.
2236
2237.Request
2238----
2239 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002240 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002241----
2242
2243.Response
2244----
2245 HTTP/1.1 204 No Content
2246----
2247
Edwin Kempin257d70f2013-03-28 14:31:14 +01002248[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002249=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002250--
Edwin Kempin257d70f2013-03-28 14:31:14 +01002251'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002252--
Edwin Kempin257d70f2013-03-28 14:31:14 +01002253
2254Gets the formatted patch for one revision.
2255
2256.Request
2257----
2258 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
2259----
2260
Shawn Pearce98361f72013-05-10 16:27:36 -07002261The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01002262
2263.Response
2264----
2265 HTTP/1.1 200 OK
2266 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002267 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07002268 X-FYI-Content-Encoding: base64
2269 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01002270
Shawn Pearce98361f72013-05-10 16:27:36 -07002271 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01002272----
2273
David Ostrovsky973f38b2013-08-22 00:24:51 -07002274Adding query parameter `zip` (for example `/changes/.../patch?zip`)
2275returns the patch as a single file inside of a ZIP archive. Clients
2276can expand the ZIP to obtain the plain text patch, avoiding the
2277need for a base64 decoding step. This option implies `download`.
2278
2279Query parameter `download` (e.g. `/changes/.../patch?download`)
2280will suggest the browser save the patch as `commitsha1.diff.base64`,
2281for later processing by command line tools.
2282
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002283[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002284=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002285--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002286'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002287--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002288
2289Gets the method the server will use to submit (merge) the change and
2290an indicator if the change is currently mergeable.
2291
2292.Request
2293----
2294 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
2295----
2296
Saša Živkov499873f2014-05-05 13:34:18 +02002297As response a link:#mergeable-info[MergeableInfo] entity is returned.
2298
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002299.Response
2300----
2301 HTTP/1.1 200 OK
2302 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002303 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002304
2305 )]}'
2306 {
2307 submit_type: "MERGE_IF_NECESSARY",
2308 mergeable: true,
2309 }
2310----
2311
Saša Živkov697cab22014-04-29 16:46:50 +02002312If the `other-branches` parameter is specified, the mergeability will also be
2313checked for all other branches.
2314
2315.Request
2316----
2317 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
2318----
2319
2320The response will then contain a list of all other branches where this changes
2321could merge cleanly.
2322
2323.Response
2324----
2325 HTTP/1.1 200 OK
2326 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002327 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02002328
2329 )]}'
2330 {
2331 submit_type: "MERGE_IF_NECESSARY",
2332 mergeable: true,
2333 mergeable_into: [
2334 "refs/heads/stable-2.7",
2335 "refs/heads/stable-2.8",
2336 ]
2337 }
2338----
2339
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002340[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002341=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002342--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002343'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002344--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002345
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002346Gets the method the server will use to submit (merge) the change.
2347
2348.Request
2349----
2350 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
2351----
2352
2353.Response
2354----
2355 HTTP/1.1 200 OK
2356 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002357 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002358
2359 )]}'
2360 "MERGE_IF_NECESSARY"
2361----
2362
2363[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002364=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002365--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002366'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002367--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002368
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002369Tests the submit_type Prolog rule in the project, or the one given.
2370
2371Request body may be either the Prolog code as `text/plain` or a
2372link:#rule-input[RuleInput] object. The query parameter `filters`
2373may be set to `SKIP` to bypass parent project filters while testing
2374a project-specific rule.
2375
2376.Request
2377----
2378 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002379 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002380
2381 submit_type(cherry_pick).
2382----
2383
2384.Response
2385----
2386 HTTP/1.1 200 OK
2387 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002388 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002389
2390 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07002391 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002392----
2393
2394[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002395=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002396--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002397'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002398--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002399
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002400Tests the submit_rule Prolog rule in the project, or the one given.
2401
2402Request body may be either the Prolog code as `text/plain` or a
2403link:#rule-input[RuleInput] object. The query parameter `filters`
2404may be set to `SKIP` to bypass parent project filters while testing
2405a project-specific rule.
2406
2407.Request
2408----
Shawn Pearcea3cce712014-03-21 08:16:11 -07002409 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002410 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002411
2412 submit_rule(submit(R)) :-
2413 R = label('Any-Label-Name', reject(_)).
2414----
2415
2416The response is a list of link:#submit-record[SubmitRecord] entries
2417describing the permutations that satisfy the tested submit rule.
2418
2419.Response
2420----
2421 HTTP/1.1 200 OK
2422 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002423 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002424
2425 )]}'
2426 [
2427 {
2428 "status": "NOT_READY",
2429 "reject": {
2430 "Any-Label-Name": {}
2431 }
2432 }
2433 ]
2434----
2435
Edwin Kempincb6724a2013-02-26 16:58:51 +01002436[[list-drafts]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002437=== List Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002438--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002439'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002440--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002441
Edwin Kempin3ca57192013-02-27 07:44:01 +01002442Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01002443user.
2444
2445As result a map is returned that maps the file path to a list of
2446link:#comment-info[CommentInfo] entries. The entries in the map are
2447sorted by file path.
2448
2449.Request
2450----
2451 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
2452----
2453
2454.Response
2455----
2456 HTTP/1.1 200 OK
2457 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002458 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01002459
2460 )]}'
2461 {
2462 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2463 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01002464 "id": "TvcXrmjM",
2465 "line": 23,
2466 "message": "[nit] trailing whitespace",
2467 "updated": "2013-02-26 15:40:43.986000000"
2468 },
2469 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01002470 "id": "TveXwFiA",
2471 "line": 49,
2472 "in_reply_to": "TfYX-Iuo",
2473 "message": "Done",
2474 "updated": "2013-02-26 15:40:45.328000000"
2475 }
2476 ]
2477 }
2478----
2479
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002480[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002481=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002482--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002483'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002484--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002485
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002486Creates a draft comment on a revision.
2487
2488The new draft comment must be provided in the request body inside a
2489link:#comment-input[CommentInput] entity.
2490
2491.Request
2492----
2493 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002494 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002495
2496 {
2497 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2498 "line": 23,
2499 "message": "[nit] trailing whitespace"
2500 }
2501----
2502
2503As response a link:#comment-info[CommentInfo] entity is returned that
2504describes the draft comment.
2505
2506.Response
2507----
2508 HTTP/1.1 200 OK
2509 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002510 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002511
2512 )]}'
2513 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002514 "id": "TvcXrmjM",
2515 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2516 "line": 23,
2517 "message": "[nit] trailing whitespace",
2518 "updated": "2013-02-26 15:40:43.986000000"
2519 }
2520----
2521
Edwin Kempin3ca57192013-02-27 07:44:01 +01002522[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002523=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002524--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002525'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002526--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002527
Edwin Kempin3ca57192013-02-27 07:44:01 +01002528Retrieves a draft comment of a revision that belongs to the calling
2529user.
2530
2531.Request
2532----
2533 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2534----
2535
2536As response a link:#comment-info[CommentInfo] entity is returned that
2537describes the draft comment.
2538
2539.Response
2540----
2541 HTTP/1.1 200 OK
2542 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002543 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01002544
2545 )]}'
2546 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01002547 "id": "TvcXrmjM",
2548 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2549 "line": 23,
2550 "message": "[nit] trailing whitespace",
2551 "updated": "2013-02-26 15:40:43.986000000"
2552 }
2553----
2554
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002555[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002556=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002557--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002558'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002559--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002560
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002561Updates a draft comment on a revision.
2562
2563The new draft comment must be provided in the request body inside a
2564link:#comment-input[CommentInput] entity.
2565
2566.Request
2567----
2568 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002569 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002570
2571 {
2572 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2573 "line": 23,
2574 "message": "[nit] trailing whitespace"
2575 }
2576----
2577
2578As response a link:#comment-info[CommentInfo] entity is returned that
2579describes the draft comment.
2580
2581.Response
2582----
2583 HTTP/1.1 200 OK
2584 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002585 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002586
2587 )]}'
2588 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002589 "id": "TvcXrmjM",
2590 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2591 "line": 23,
2592 "message": "[nit] trailing whitespace",
2593 "updated": "2013-02-26 15:40:43.986000000"
2594 }
2595----
2596
2597[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002598=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002599--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002600'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002601--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002602
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002603Deletes a draft comment from a revision.
2604
2605.Request
2606----
2607 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2608----
2609
2610.Response
2611----
2612 HTTP/1.1 204 No Content
2613----
2614
John Spurlock5e402f02013-03-24 11:35:04 -04002615[[list-comments]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002616=== List Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002617--
John Spurlock5e402f02013-03-24 11:35:04 -04002618'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002619--
John Spurlock5e402f02013-03-24 11:35:04 -04002620
2621Lists the published comments of a revision.
2622
2623As result a map is returned that maps the file path to a list of
2624link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07002625sorted by file path and only include file (or inline) comments. Use
2626the link:#get-change-detail[Get Change Detail] endpoint to retrieve
2627the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04002628
2629.Request
2630----
2631 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
2632----
2633
2634.Response
2635----
2636 HTTP/1.1 200 OK
2637 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002638 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04002639
2640 )]}'
2641 {
2642 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2643 {
John Spurlock5e402f02013-03-24 11:35:04 -04002644 "id": "TvcXrmjM",
2645 "line": 23,
2646 "message": "[nit] trailing whitespace",
2647 "updated": "2013-02-26 15:40:43.986000000",
2648 "author": {
2649 "_account_id": 1000096,
2650 "name": "John Doe",
2651 "email": "john.doe@example.com"
2652 }
2653 },
2654 {
John Spurlock5e402f02013-03-24 11:35:04 -04002655 "id": "TveXwFiA",
2656 "line": 49,
2657 "in_reply_to": "TfYX-Iuo",
2658 "message": "Done",
2659 "updated": "2013-02-26 15:40:45.328000000",
2660 "author": {
2661 "_account_id": 1000097,
2662 "name": "Jane Roe",
2663 "email": "jane.roe@example.com"
2664 }
2665 }
2666 ]
2667 }
2668----
2669
2670[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002671=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002672--
John Spurlock5e402f02013-03-24 11:35:04 -04002673'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002674--
John Spurlock5e402f02013-03-24 11:35:04 -04002675
2676Retrieves a published comment of a revision.
2677
2678.Request
2679----
2680 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
2681----
2682
2683As response a link:#comment-info[CommentInfo] entity is returned that
2684describes the published comment.
2685
2686.Response
2687----
2688 HTTP/1.1 200 OK
2689 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002690 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04002691
2692 )]}'
2693 {
John Spurlock5e402f02013-03-24 11:35:04 -04002694 "id": "TvcXrmjM",
2695 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2696 "line": 23,
2697 "message": "[nit] trailing whitespace",
2698 "updated": "2013-02-26 15:40:43.986000000",
2699 "author": {
2700 "_account_id": 1000096,
2701 "name": "John Doe",
2702 "email": "john.doe@example.com"
2703 }
2704 }
2705----
2706
Edwin Kempin682ac712013-05-14 13:40:46 +02002707[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002708=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002709--
Edwin Kempin682ac712013-05-14 13:40:46 +02002710'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002711--
Edwin Kempin682ac712013-05-14 13:40:46 +02002712
2713Lists the files that were modified, added or deleted in a revision.
2714
2715.Request
2716----
2717 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
2718----
2719
2720As result a map is returned that maps the file path to a list of
2721link:#file-info[FileInfo] entries. The entries in the map are
2722sorted by file path.
2723
2724.Response
2725----
2726 HTTP/1.1 200 OK
2727 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002728 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02002729
2730 )]}'
2731 {
2732 "/COMMIT_MSG": {
2733 "status": "A",
2734 "lines_inserted": 7
2735 },
2736 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
2737 "lines_inserted": 5,
2738 "lines_deleted": 3
2739 }
2740 }
2741----
2742
Shawn Pearce984747d2013-07-18 00:42:16 -07002743The request parameter `reviewed` changes the response to return a list
2744of the paths the caller has marked as reviewed. Clients that also
2745need the FileInfo should make two requests.
2746
2747.Request
2748----
2749 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
2750----
2751
2752.Response
2753----
2754 HTTP/1.1 200 OK
2755 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002756 Content-Type: application/json; charset=UTF-8
Shawn Pearce984747d2013-07-18 00:42:16 -07002757
2758 )]}'
2759 [
2760 "/COMMIT_MSG",
2761 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2762 ]
2763----
2764
Edwin Kempinaef44b02013-05-07 16:15:55 +02002765[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002766=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002767--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002768'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002769--
Edwin Kempinaef44b02013-05-07 16:15:55 +02002770
2771Gets the content of a file from a certain revision.
2772
2773.Request
2774----
2775 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
2776----
2777
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002778The content is returned as base64 encoded string. The HTTP response
2779Content-Type is always `text/plain`, reflecting the base64 wrapping.
2780A Gerrit-specific `X-FYI-Content-Type` header is returned describing
2781the server detected content type of the file.
2782
2783If only the content type is required, callers should use HEAD to
2784avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02002785
2786.Response
2787----
2788 HTTP/1.1 200 OK
2789 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002790 Content-Type: text/plain; charset=ISO-8859-1
2791 X-FYI-Content-Encoding: base64
2792 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02002793
2794 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
2795----
2796
David Pursehouse882aef22013-06-05 10:56:37 +09002797[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002798=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002799--
David Pursehouse882aef22013-06-05 10:56:37 +09002800'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/diff'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002801--
David Pursehouse882aef22013-06-05 10:56:37 +09002802
2803Gets the diff of a file from a certain revision.
2804
2805.Request
2806----
2807 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
2808----
2809
2810As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
2811
2812.Response
2813----
2814 HTTP/1.1 200 OK
2815 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002816 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09002817
2818 )]
2819 {
2820 "meta_a": {
2821 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002822 "content_type": "text/x-java-source",
2823 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002824 },
2825 "meta_b": {
2826 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002827 "content_type": "text/x-java-source",
2828 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002829 },
2830 "change_type": "MODIFIED",
2831 "diff_header": [
2832 "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2833 "index 59b7670..9faf81c 100644",
2834 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2835 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2836 ],
2837 "content": [
2838 {
2839 "ab": [
2840 "// Copyright (C) 2010 The Android Open Source Project",
2841 "//",
2842 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
2843 "// you may not use this file except in compliance with the License.",
2844 "// You may obtain a copy of the License at",
2845 "//",
2846 "// http://www.apache.org/licenses/LICENSE-2.0",
2847 "//",
2848 "// Unless required by applicable law or agreed to in writing, software",
2849 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
2850 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
2851 "// See the License for the specific language governing permissions and",
2852 "// limitations under the License."
2853 ]
2854 },
2855 {
2856 "b": [
2857 "//",
2858 "// Add some more lines in the header."
2859 ]
2860 },
2861 {
2862 "ab": [
2863 "",
2864 "package com.google.gerrit.server.project;",
2865 "",
2866 "import com.google.common.collect.Maps;",
2867 ...
2868 ]
2869 }
2870 ...
2871 ]
2872 }
2873----
2874
2875If the `intraline` parameter is specified, intraline differences are included in the diff.
2876
2877.Request
2878----
2879 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?intraline HTTP/1.0
2880----
2881
2882.Response
2883----
2884 HTTP/1.1 200 OK
2885 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002886 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09002887
2888 )]
2889 {
2890 "meta_a": {
2891 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002892 "content_type": "text/x-java-source",
2893 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002894 },
2895 "meta_b": {
2896 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002897 "content_type": "text/x-java-source",
2898 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002899 },
2900 "change_type": "MODIFIED",
2901 "diff_header": [
2902 "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2903 "index 59b7670..9faf81c 100644",
2904 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2905 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2906 ],
2907 "content": [
2908 ...
2909 {
2910 "a": [
2911 "/** Manages access control for Git references (aka branches, tags). */"
2912 ],
2913 "b": [
2914 "/** Manages access control for the Git references (aka branches, tags). */"
2915 ],
2916 "edit_a": [],
2917 "edit_b": [
2918 [
2919 31,
2920 4
2921 ]
2922 ]
2923 }
2924 ]
2925 }
2926----
2927
2928The `base` parameter can be specified to control the base patch set from which the diff should
2929be generated.
2930
Edwin Kempin8cdce502014-12-06 10:55:38 +01002931[[weblinks-only]]
2932If the `weblinks-only` parameter is specified, only the diff web links are returned.
2933
David Pursehouse882aef22013-06-05 10:56:37 +09002934.Request
2935----
2936 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?base=2 HTTP/1.0
2937----
2938
2939.Response
2940----
2941 HTTP/1.1 200 OK
2942 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002943 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09002944
2945 )]
2946 {
2947 "meta_a": {
2948 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002949 "content_type": "text/x-java-source",
2950 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002951 },
2952 "meta_b": {
2953 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002954 "content_type": "text/x-java-source",
2955 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002956 },
2957 "change_type": "MODIFIED",
2958 "content": [
2959 {
2960 "skip": 578
2961 }
2962 ]
2963 }
2964----
2965
2966The `ignore-whitespace` parameter can be specified to control how whitespace differences are
2967reported in the result. Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
2968
2969The `context` parameter can be specified to control the number of lines of surrounding context
2970in the diff. Valid values are `ALL` or number of lines.
2971
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002972[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002973=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002974--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002975'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002976--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002977
Edwin Kempinbea55a52013-05-14 13:53:39 +02002978Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002979
2980.Request
2981----
2982 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2983----
2984
2985.Response
2986----
2987 HTTP/1.1 201 Created
2988----
2989
Edwin Kempinbea55a52013-05-14 13:53:39 +02002990If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002991response is "`200 OK`".
2992
2993[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002994=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002995--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002996'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002997--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002998
Edwin Kempinbea55a52013-05-14 13:53:39 +02002999Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003000
3001.Request
3002----
3003 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
3004----
3005
3006.Response
3007----
3008 HTTP/1.1 204 No Content
3009----
3010
Gustaf Lundh019fb262012-11-28 14:20:22 +01003011[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003012=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003013--
Gustaf Lundh019fb262012-11-28 14:20:22 +01003014'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003015--
Gustaf Lundh019fb262012-11-28 14:20:22 +01003016
3017Cherry picks a revision to a destination branch.
3018
3019The commit message and destination branch must be provided in the request body inside a
3020link:#cherrypick-input[CherryPickInput] entity.
3021
3022.Request
3023----
3024 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003025 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01003026
3027 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01003028 "message" : "Implementing Feature X",
3029 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01003030 }
3031----
3032
3033As response a link:#change-info[ChangeInfo] entity is returned that
3034describes the resulting cherry picked change.
3035
3036.Response
3037----
3038 HTTP/1.1 200 OK
3039 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003040 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01003041
3042 )]}'
3043 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01003044 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
3045 "project": "myProject",
3046 "branch": "release-branch",
3047 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
3048 "subject": "Implementing Feature X",
3049 "status": "NEW",
3050 "created": "2013-02-01 09:59:32.126000000",
3051 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01003052 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003053 "insertions": 12,
3054 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01003055 "_number": 3965,
3056 "owner": {
3057 "name": "John Doe"
3058 }
3059 }
3060----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003061
David Ostrovskyae15e0502013-08-19 08:06:07 +02003062[[message]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003063=== Edit Commit Message
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003064--
David Ostrovskyae15e0502013-08-19 08:06:07 +02003065'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/message'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003066--
David Ostrovskyae15e0502013-08-19 08:06:07 +02003067
David Ostrovsky65b2c4e2014-10-29 00:14:21 +01003068Edit commit message. *Warning*: as of Gerrit 2.11 this REST endpoint is
3069deprecated and will be removed in a future version.
3070Use link:#put-change-edit-message[put commit message] and
3071link:#publish-edit[publish edit] instead.
David Ostrovskyae15e0502013-08-19 08:06:07 +02003072
3073The commit message must be provided in the request body inside a
3074link:#cherrypick-input[CherryPickInput] entity.
3075
3076.Request
3077----
3078 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003079 Content-Type: application/json; charset=UTF-8
David Ostrovskyae15e0502013-08-19 08:06:07 +02003080
3081 {
3082 "message" : "Reword Implementing Feature X",
3083 }
3084----
3085
3086As response a link:#change-info[ChangeInfo] entity is returned that
3087describes the change.
3088
3089.Response
3090----
3091 HTTP/1.1 200 OK
3092 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003093 Content-Type: application/json; charset=UTF-8
David Ostrovskyae15e0502013-08-19 08:06:07 +02003094
3095 )]}'
3096 {
David Ostrovskyae15e0502013-08-19 08:06:07 +02003097 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
3098 "project": "myProject",
3099 "branch": "release-branch",
3100 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
3101 "subject": "Reword Implementing Feature X",
3102 "status": "NEW",
3103 "created": "2013-02-01 09:59:32.126000000",
3104 "updated": "2013-02-21 11:16:36.775000000",
David Ostrovskyae15e0502013-08-19 08:06:07 +02003105 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003106 "insertions": 261,
3107 "deletions": 101,
David Ostrovskyae15e0502013-08-19 08:06:07 +02003108 "_number": 3965,
3109 "owner": {
3110 "name": "John Doe"
3111 }
3112 }
3113----
3114
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003115[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003116== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003117
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003118[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003119=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003120--
3121--
3122
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003123[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003124=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003125Identifier that uniquely identifies one change.
3126
3127This can be:
3128
3129* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
3130 where for the branch the `refs/heads/` prefix can be omitted
3131 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
3132* a Change-Id if it uniquely identifies one change
3133 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
3134* a legacy numeric change ID ("4247")
3135
John Spurlock5e402f02013-03-24 11:35:04 -04003136[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003137=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04003138UUID of a published comment.
3139
Edwin Kempin3ca57192013-02-27 07:44:01 +01003140[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003141=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01003142UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003143
Edwin Kempinbea55a52013-05-14 13:53:39 +02003144[[file-id]]
3145\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003146~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02003147The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003148
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003149[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003150=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003151Identifier that uniquely identifies one revision of a change.
3152
3153This can be:
3154
Shawn Pearce9c0722a2013-03-02 15:30:31 -08003155* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003156* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
3157* an abbreviated commit ID that uniquely identifies one revision of the
3158 change ("674ac754"), at least 4 digits are required
3159* a legacy numeric patch number ("1" for first patch set of the change)
3160
Edwin Kempine3446292013-02-19 16:40:14 +01003161[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003162== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01003163
Edwin Kempined5364b2013-02-22 10:39:33 +01003164[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003165=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01003166The `AbandonInput` entity contains information for abandoning a change.
3167
David Pursehouseae367192014-11-25 17:24:47 +09003168[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01003169|===========================
3170|Field Name ||Description
3171|`message` |optional|
3172Message to be added as review comment to the change when abandoning the
3173change.
3174|===========================
3175
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003176[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003177=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003178The `ActionInfo` entity describes a REST API call the client can
3179make to manipulate a resource. These are frequently implemented by
3180plugins and may be discovered at runtime.
3181
David Pursehouseae367192014-11-25 17:24:47 +09003182[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003183|====================================
3184|Field Name ||Description
3185|`method` |optional|
3186HTTP method to use with the action. Most actions use `POST`, `PUT`
3187or `DELETE` to cause state changes.
3188|`label` |optional|
3189Short title to display to a user describing the action. In the
3190Gerrit web interface the label is used as the text on the button
3191presented in the UI.
3192|`title` |optional|
3193Longer text to display describing the action. In a web UI this
3194should be the title attribute of the element, displaying when
3195the user hovers the mouse.
3196|`enabled` |optional|
3197If true the action is permitted at this time and the caller is
3198likely allowed to execute it. This may change if state is updated
3199at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003200|====================================
3201
Edwin Kempin392328e2013-02-25 12:50:03 +01003202[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003203=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01003204The `AddReviewerResult` entity describes the result of adding a
3205reviewer to a change.
3206
David Pursehouseae367192014-11-25 17:24:47 +09003207[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01003208|===========================
3209|Field Name ||Description
3210|`reviewers` |optional|
3211The newly added reviewers as a list of link:#reviewer-info[
3212ReviewerInfo] entities.
3213|`error` |optional|
3214Error message explaining why the reviewer could not be added. +
3215If a group was specified in the input and an error is returned, it
3216means that none of the members were added as reviewer.
3217|`confirm` |`false` if not set|
3218Whether adding the reviewer requires confirmation.
3219|===========================
3220
Edwin Kempine3446292013-02-19 16:40:14 +01003221[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003222=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003223The `ApprovalInfo` entity contains information about an approval from a
3224user for a label on a change.
3225
Edwin Kempin963dfd02013-02-27 12:39:32 +01003226`ApprovalInfo` has the same fields as
3227link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01003228In addition `ApprovalInfo` has the following fields:
3229
David Pursehouseae367192014-11-25 17:24:47 +09003230[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003231|===========================
3232|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07003233|`value` |optional|
3234The vote that the user has given for the label. If present and zero, the
3235user is permitted to vote on the label. If absent, the user is not
3236permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01003237|`date` |optional|
3238The time and date describing when the approval was made.
Edwin Kempine3446292013-02-19 16:40:14 +01003239|===========================
3240
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003241[[group-base-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003242=== GroupBaseInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003243The `GroupBaseInfo` entity contains base information about the group.
3244
David Pursehouseae367192014-11-25 17:24:47 +09003245[options="header",cols="1,6"]
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003246|==========================
3247|Field Name |Description
3248|`id` |The id of the group.
3249|`name` |The name of the group.
3250|==========================
3251
Edwin Kempine3446292013-02-19 16:40:14 +01003252[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003253=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003254The `ChangeInfo` entity contains information about a change.
3255
David Pursehouseae367192014-11-25 17:24:47 +09003256[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003257|==================================
3258|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003259|`id` ||
3260The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05003261where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01003262`refs/heads/` prefix is omitted.
3263|`project` ||The name of the project.
3264|`branch` ||
3265The name of the target branch. +
3266The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01003267|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01003268|`change_id` ||The Change-Id of the change.
3269|`subject` ||
3270The subject of the change (header line of the commit message).
3271|`status` ||
3272The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
3273`DRAFT`).
3274|`created` ||
3275The link:rest-api.html#timestamp[timestamp] of when the change was
3276created.
3277|`updated` ||
3278The link:rest-api.html#timestamp[timestamp] of when the change was last
3279updated.
3280|`starred` |not set if `false`|
3281Whether the calling user has starred this change.
3282|`reviewed` |not set if `false`|
3283Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07003284Only set if link:#reviewed[reviewed] is requested.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01003285|`mergeable` |optional|
3286Whether the change is mergeable. +
Dave Borowitze5fbeeb2014-06-27 09:47:49 -07003287Not set for merged changes, or if the change has not yet been tested.
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003288|`insertions` ||
3289Number of inserted lines.
3290|`deletions` ||
3291Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01003292|`_number` ||The legacy numeric ID of the change.
3293|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01003294The owner of the change as an link:rest-api-accounts.html#account-info[
3295AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07003296|`actions` |optional|
3297Actions the caller might be able to perform on this revision. The
3298information is a map of view name to link:#action-info[ActionInfo]
3299entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003300|`labels` |optional|
3301The labels of the change as a map that maps the label names to
3302link:#label-info[LabelInfo] entries. +
3303Only set if link:#labels[labels] or link:#detailed-labels[detailed
3304labels] are requested.
3305|`permitted_labels` |optional|
3306A map of the permitted labels that maps a label name to the list of
3307values that are allowed for that label. +
3308Only set if link:#detailed-labels[detailed labels] are requested.
3309|`removable_reviewers`|optional|
3310The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01003311link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01003312Only set if link:#detailed-labels[detailed labels] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04003313|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07003314Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04003315link:#change-message-info[ChangeMessageInfo] entities. +
3316Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003317|`current_revision` |optional|
3318The commit ID of the current patch set of this change. +
3319Only set if link:#current-revision[the current revision] is requested
3320or if link:#all-revisions[all revisions] are requested.
3321|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05003322All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01003323patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08003324Only set if link:#current-revision[the current revision] is requested
3325(in which case it will only contain a key for the current revision) or
3326if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003327|`_more_changes` |optional, not set if `false`|
3328Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08003329Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05003330|`problems` |optional|
3331A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08003332problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01003333|`base_change` |optional|
3334A link:#change-id[\{change-id\}] that identifies the base change for a create
3335change operation. Only used for the link:#create-change[CreateChange] endpoint.
Edwin Kempine3446292013-02-19 16:40:14 +01003336|==================================
3337
David Pursehouse669f2512014-07-18 11:41:42 +09003338[[related-changes-info]]
3339=== RelatedChangesInfo
3340The `RelatedChangesInfo` entity contains information about related
3341changes.
3342
David Pursehouseae367192014-11-25 17:24:47 +09003343[options="header",cols="1,6"]
David Pursehouse669f2512014-07-18 11:41:42 +09003344|===========================
3345|Field Name |Description
3346|`changes` |A list of
3347link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
3348describing the related changes. Sorted by git commit order, newest to
3349oldest. Empty if there are no related changes.
3350|===========================
3351
3352[[related-change-and-commit-info]]
3353=== RelatedChangeAndCommitInfo
3354
3355The `RelatedChangeAndCommitInfo` entity contains information about
3356a related change and commit.
3357
David Pursehouseae367192014-11-25 17:24:47 +09003358[options="header",cols="1,^1,5"]
David Pursehouse669f2512014-07-18 11:41:42 +09003359|===========================
3360|Field Name ||Description
3361|`change_id` |optional|The Change-Id of the change.
Edwin Kempin72d91932014-12-09 14:53:07 +01003362|`status` |optional|The status of the change.
David Pursehouse669f2512014-07-18 11:41:42 +09003363|`commit` ||The commit as a
3364link:#commit-info[CommitInfo] entity.
3365|`_change_number` |optional|The change number.
3366|`_revision_number` |optional|The revision number.
3367|`_current_revision_number`|optional|The current revision number.
3368|===========================
3369
John Spurlock74a70cc2013-03-23 16:41:50 -04003370[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003371=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04003372The `ChangeMessageInfo` entity contains information about a message
3373attached to a change.
3374
David Pursehouseae367192014-11-25 17:24:47 +09003375[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04003376|==================================
3377|Field Name ||Description
3378|`id` ||The ID of the message.
3379|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07003380Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04003381link:rest-api-accounts.html#account-info[AccountInfo] entity. +
3382Unset if written by the Gerrit system.
3383|`date` ||
3384The link:rest-api.html#timestamp[timestamp] this message was posted.
3385|`message` ||The text left by the user.
3386|`_revision_number` |optional|
3387Which patchset (if any) generated this message.
3388|==================================
3389
Gustaf Lundh019fb262012-11-28 14:20:22 +01003390[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003391=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01003392The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
3393
David Pursehouseae367192014-11-25 17:24:47 +09003394[options="header",cols="1,6"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01003395|===========================
3396|Field Name |Description
3397|`message` |Commit message for the cherry-picked change
David Ostrovsky9345ebc2014-04-28 23:19:55 +02003398|`destination` |Destination branch
Gustaf Lundh019fb262012-11-28 14:20:22 +01003399|===========================
3400
Edwin Kempincb6724a2013-02-26 16:58:51 +01003401[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003402=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05003403The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003404
David Pursehouseae367192014-11-25 17:24:47 +09003405[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01003406|===========================
3407|Field Name ||Description
John Spurlock5e402f02013-03-24 11:35:04 -04003408|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003409|`path` |optional|
3410The path of the file for which the inline comment was done. +
3411Not set if returned in a map where the key is the file path.
3412|`side` |optional|
3413The side on which the comment was added. +
3414Allowed values are `REVISION` and `PARENT`. +
3415If not set, the default is `REVISION`.
3416|`line` |optional|
3417The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04003418If range is set, this equals the end line of the range. +
3419If neither line nor range is set, it's a file comment.
3420|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09003421The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04003422entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003423|`in_reply_to` |optional|
3424The URL encoded UUID of the comment to which this comment is a reply.
3425|`message` |optional|The comment message.
3426|`updated` ||
3427The link:rest-api.html#timestamp[timestamp] of when this comment was
3428written.
John Spurlock5e402f02013-03-24 11:35:04 -04003429|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09003430The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04003431link:rest-api-accounts.html#account-info[AccountInfo] entity. +
3432Unset for draft comments, assumed to be the calling user.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003433|===========================
3434
Edwin Kempin67498de2013-02-25 16:15:34 +01003435[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003436=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03003437The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01003438comment.
3439
David Pursehouseae367192014-11-25 17:24:47 +09003440[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01003441|===========================
3442|Field Name ||Description
3443|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01003444The URL encoded UUID of the comment if an existing draft comment should
3445be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003446|`path` |optional|
3447The path of the file for which the inline comment should be added. +
3448Doesn't need to be set if contained in a map where the key is the file
3449path.
Edwin Kempin67498de2013-02-25 16:15:34 +01003450|`side` |optional|
3451The side on which the comment should be added. +
3452Allowed values are `REVISION` and `PARENT`. +
3453If not set, the default is `REVISION`.
3454|`line` |optional|
3455The number of the line for which the comment should be added. +
3456`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04003457If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09003458If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04003459|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09003460The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04003461entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01003462|`in_reply_to` |optional|
3463The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003464|`updated` |optional|
3465The link:rest-api.html#timestamp[timestamp] of this comment. +
3466Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01003467|`message` |optional|
3468The comment message. +
3469If not set and an existing draft comment is updated, the existing draft
3470comment is deleted.
3471|===========================
3472
Michael Zhou596c7682013-08-25 05:43:34 -04003473[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003474=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04003475The `CommentRange` entity describes the range of an inline comment.
3476
David Pursehouseae367192014-11-25 17:24:47 +09003477[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04003478|===========================
3479|Field Name ||Description
3480|`start_line` ||The start line number of the range.
3481|`start_character` ||The character position in the start line.
3482|`end_line` ||The end line number of the range.
3483|`end_character` ||The character position in the end line.
3484|===========================
3485
Edwin Kempine3446292013-02-19 16:40:14 +01003486[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003487=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003488The `CommitInfo` entity contains information about a commit.
3489
David Pursehouseae367192014-11-25 17:24:47 +09003490[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01003491|==========================
3492|Field Name |Description
3493|`commit` |The commit ID.
Edwin Kempinb89b0c82014-04-09 12:51:18 +02003494|`parents` |
Edwin Kempine3446292013-02-19 16:40:14 +01003495The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02003496link:#commit-info[CommitInfo] entities. In each parent
3497only the `commit` and `subject` fields are populated.
Edwin Kempine3446292013-02-19 16:40:14 +01003498|`author` |The author of the commit as a
3499link:#git-person-info[GitPersonInfo] entity.
3500|`committer` |The committer of the commit as a
3501link:#git-person-info[GitPersonInfo] entity.
3502|`subject` |
3503The subject of the commit (header line of the commit message).
3504|`message` |The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01003505|`web_links` |optional|
3506Links to the commit in external sites as a list of
3507link:#web-link-info[WebLinkInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003508|==========================
3509
David Pursehouse882aef22013-06-05 10:56:37 +09003510[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003511=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09003512The `DiffContent` entity contains information about the content differences
3513in a file.
3514
David Pursehouseae367192014-11-25 17:24:47 +09003515[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09003516|==========================
3517|Field Name ||Description
3518|`a` |optional|Content only in the file on side A (deleted in B).
3519|`b` |optional|Content only in the file on side B (added in B).
3520|`ab` |optional|Content in the file on both sides (unchanged).
3521|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
3522Text sections deleted from side A as a
3523link:#diff-intraline-info[DiffIntralineInfo] entity.
3524|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
3525Text sections inserted in side B as a
3526link:#diff-intraline-info[DiffIntralineInfo] entity.
3527|`skip` |optional|count of lines skipped on both sides when the file is
3528too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08003529|`common` |optional|Set to `true` if the region is common according
3530to the requested ignore-whitespace parameter, but a and b contain
3531differing amounts of whitespace. When present and true a and b are
3532used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09003533|==========================
3534
3535[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003536=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09003537The `DiffFileMetaInfo` entity contains meta information about a file diff.
3538
David Pursehouseae367192014-11-25 17:24:47 +09003539[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09003540|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02003541|Field Name ||Description
3542|`name` ||The name of the file.
3543|`content_type`||The content type of the file.
3544|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01003545|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02003546Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07003547link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09003548|==========================
3549
3550[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003551=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09003552The `DiffInfo` entity contains information about the diff of a file
3553in a revision.
3554
Edwin Kempin8cdce502014-12-06 10:55:38 +01003555If the link:#weblinks-only[weblinks-only] parameter is specified, only
3556the `web_links` field is set.
3557
David Pursehouseae367192014-11-25 17:24:47 +09003558[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09003559|==========================
3560|Field Name ||Description
3561|`meta_a` |not present when the file is added|
3562Meta information about the file on side A as a
3563link:#diff-file-meta-info[DiffFileMetaInfo] entity.
3564|`meta_b` |not present when the file is deleted|
3565Meta information about the file on side B as a
3566link:#diff-file-meta-info[DiffFileMetaInfo] entity.
3567|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
3568`COPIED`, `REWRITE`).
3569|`intraline_status`|only set when the `intraline` parameter was specified in the request|
3570Intraline status (`OK`, `ERROR`, `TIMEOUT`).
3571|`diff_header` ||A list of strings representing the patch set diff header.
3572|`content` ||The content differences in the file as a list of
3573link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01003574|`web_links` |optional|
3575Links to the file diff in external sites as a list of
3576link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09003577|==========================
3578
3579[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003580=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09003581The `DiffIntralineInfo` entity contains information about intraline edits in a
3582file.
3583
David Pursehouse31203f52013-06-08 17:05:45 +09003584The information consists of a list of `<skip length, mark length>` pairs, where
3585the skip length is the number of characters between the end of the previous edit
3586and the start of this edit, and the mark length is the number of edited characters
3587following the skip. The start of the edits is from the beginning of the related
3588diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09003589
David Pursehouse31203f52013-06-08 17:05:45 +09003590Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07003591the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09003592
Edwin Kempin8cdce502014-12-06 10:55:38 +01003593[[diff-web-link-info]]
3594=== DiffWebLinkInfo
3595The `DiffWebLinkInfo` entity describes a link on a diff screen to an
3596external site.
3597
3598[options="header",cols="1,6"]
3599|=======================
3600|Field Name|Description
3601|`name` |The link name.
3602|`url` |The link URL.
3603|`image_url`|URL to the icon of the link.
3604|show_on_side_by_side_diff_view|
3605Whether the web link should be shown on the side-by-side diff screen.
3606|show_on_unified_diff_view|
3607Whether the web link should be shown on the unified diff screen.
3608|=======================
3609
Edwin Kempine3446292013-02-19 16:40:14 +01003610[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003611=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003612The `FetchInfo` entity contains information about how to fetch a patch
3613set via a certain protocol.
3614
David Pursehouseae367192014-11-25 17:24:47 +09003615[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003616|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02003617|Field Name ||Description
3618|`url` ||The URL of the project.
3619|`ref` ||The ref of the patch set.
3620|`commands` |optional|
3621The download commands for this patch set as a map that maps the command
3622names to the commands. +
3623Only set if link:#download_commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003624|==========================
3625
3626[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003627=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003628The `FileInfo` entity contains information about a file in a patch set.
3629
David Pursehouseae367192014-11-25 17:24:47 +09003630[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003631|=============================
3632|Field Name ||Description
3633|`status` |optional|
3634The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
3635"`C`"=Copied, "`W`"=Rewritten). +
3636Not set if the file was Modified ("`M`").
3637|`binary` |not set if `false`|Whether the file is binary.
3638|`old_path` |optional|
3639The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05003640Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01003641|`lines_inserted`|optional|
3642Number of inserted lines. +
3643Not set for binary files or if no lines were inserted.
3644|`lines_deleted` |optional|
3645Number of deleted lines. +
3646Not set for binary files or if no lines were deleted.
3647|=============================
3648
3649[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003650=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003651The `GitPersonInfo` entity contains information about the
3652author/committer of a commit.
3653
David Pursehouseae367192014-11-25 17:24:47 +09003654[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01003655|==========================
3656|Field Name |Description
3657|`name` |The name of the author/committer.
3658|`email` |The email address of the author/committer.
3659|`date` |The link:rest-api.html#timestamp[timestamp] of when
3660this identity was constructed.
3661|`tz` |The timezone offset from UTC of when this identity was
3662constructed.
3663|==========================
3664
3665[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003666=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07003667The `LabelInfo` entity contains information about a label on a change, always
3668corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01003669
Dave Borowitz88159512013-06-14 14:21:50 -07003670There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07003671link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07003672
3673* For a quick summary of the state of labels, use `LABELS`.
3674* For detailed information about labels, including exact numeric votes for all
3675 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
3676
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003677==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09003678[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003679|===========================
3680|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003681|`optional` |not set if `false`|
3682Whether the label is optional. Optional means the label may be set, but
3683it's neither necessary for submission nor does it block submission if
3684set.
Dave Borowitz88159512013-06-14 14:21:50 -07003685|===========================
3686
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003687==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09003688[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07003689|===========================
3690|Field Name ||Description
3691|`approved` |optional|One user who approved this label on the change
3692(voted the maximum value) as an
3693link:rest-api-accounts.html#account-info[AccountInfo] entity.
3694|`rejected` |optional|One user who rejected this label on the change
3695(voted the minimum value) as an
3696link:rest-api-accounts.html#account-info[AccountInfo] entity.
3697|`recommended` |optional|One user who recommended this label on the
3698change (voted positively, but not the maximum value) as an
3699link:rest-api-accounts.html#account-info[AccountInfo] entity.
3700|`disliked` |optional|One user who disliked this label on the change
3701(voted negatively, but not the minimum value) as an
3702link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01003703|`blocking` |optional|If `true`, the label blocks submit operation.
3704If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07003705|`value` |optional|The voting value of the user who
3706recommended/disliked this label on the change if it is not
3707"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07003708|`default_value`|optional|The default voting value for the label.
3709This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07003710|===========================
3711
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003712==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09003713[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07003714|===========================
3715|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003716|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07003717of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003718|`values` |optional|A map of all values that are allowed for this
3719label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07003720to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01003721|===========================
3722
Saša Živkov499873f2014-05-05 13:34:18 +02003723[[mergeable-info]]
3724=== MergeableInfo
3725The `MergeableInfo` entity contains information about the mergeability of a
3726change.
3727
David Pursehouseae367192014-11-25 17:24:47 +09003728[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02003729|============================
Saša Živkov697cab22014-04-29 16:46:50 +02003730|Field Name ||Description
3731|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02003732Submit type used for this change, can be `MERGE_IF_NECESSARY`,
3733`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
3734`CHERRY_PICK`.
Saša Živkov697cab22014-04-29 16:46:50 +02003735|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02003736`true` if this change is cleanly mergeable, `false` otherwise
Saša Živkov697cab22014-04-29 16:46:50 +02003737|`mergeable_into`|optional|
3738A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02003739|============================
Dave Borowitz88159512013-06-14 14:21:50 -07003740
Edwin Kempined5364b2013-02-22 10:39:33 +01003741[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003742=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01003743The `RestoreInput` entity contains information for restoring a change.
3744
David Pursehouseae367192014-11-25 17:24:47 +09003745[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01003746|===========================
3747|Field Name ||Description
3748|`message` |optional|
3749Message to be added as review comment to the change when restoring the
3750change.
3751|===========================
3752
Edwin Kempind2ec4152013-02-22 12:17:19 +01003753[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003754=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01003755The `RevertInput` entity contains information for reverting a change.
3756
David Pursehouseae367192014-11-25 17:24:47 +09003757[options="header",cols="1,^1,5"]
Edwin Kempind2ec4152013-02-22 12:17:19 +01003758|===========================
3759|Field Name ||Description
3760|`message` |optional|
3761Message to be added as review comment to the change when reverting the
3762change.
3763|===========================
3764
Edwin Kempin67498de2013-02-25 16:15:34 +01003765[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003766=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01003767The `ReviewInfo` entity contains information about a review.
3768
David Pursehouseae367192014-11-25 17:24:47 +09003769[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01003770|===========================
3771|Field Name |Description
3772|`labels` |
3773The labels of the review as a map that maps the label names to the
3774voting values.
3775|===========================
3776
3777[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003778=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01003779The `ReviewInput` entity contains information for adding a review to a
3780revision.
3781
David Pursehouseae367192014-11-25 17:24:47 +09003782[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01003783|============================
3784|Field Name ||Description
3785|`message` |optional|
3786The message to be added as review comment.
3787|`labels` |optional|
3788The votes that should be added to the revision as a map that maps the
3789label names to the voting values.
3790|`comments` |optional|
3791The comments that should be added as a map that maps a file path to a
3792list of link:#comment-input[CommentInput] entities.
3793|`strict_labels`|`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05003794Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01003795based on access controls. +
3796If `true`, attempting to use a label not granted to the user will fail
3797the entire modify operation early. +
3798If `false`, the operation will execute anyway, but the proposed labels
3799will be modified to be the "best" value allowed by the access controls.
3800|`drafts` |optional|
3801Draft handling that defines how draft comments are handled that are
3802already in the database but that were not also described in this
3803input. +
3804Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
3805If not set, the default is `DELETE`.
3806|`notify` |optional|
3807Notify handling that defines to whom email notifications should be sent
3808after the review is stored. +
3809Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
3810If not set, the default is `ALL`.
Shawn Pearce9d783122013-06-11 18:18:03 -07003811|`on_behalf_of`|optional|
3812link:rest-api-accounts.html#account-id[\{account-id\}] the review
3813should be posted on behalf of. To use this option the caller must
3814have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01003815|============================
3816
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003817[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003818=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003819The `ReviewerInfo` entity contains information about a reviewer and its
3820votes on a change.
3821
Edwin Kempin963dfd02013-02-27 12:39:32 +01003822`ReviewerInfo` has the same fields as
3823link:rest-api-accounts.html#account-info[AccountInfo] and includes
3824link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003825In addition `ReviewerInfo` has the following fields:
3826
David Pursehouseae367192014-11-25 17:24:47 +09003827[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003828|==========================
3829|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003830|`approvals` |
3831The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09003832approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003833|==========================
3834
Edwin Kempin392328e2013-02-25 12:50:03 +01003835[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003836=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01003837The `ReviewerInput` entity contains information for adding a reviewer
3838to a change.
3839
David Pursehouseae367192014-11-25 17:24:47 +09003840[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01003841|===========================
3842|Field Name ||Description
3843|`reviewer` ||
3844The link:rest-api-accounts.html#account-id[ID] of one account that
3845should be added as reviewer or the link:rest-api-groups.html#group-id[
3846ID] of one group for which all members should be added as reviewers. +
3847If an ID identifies both an account and a group, only the account is
3848added as reviewer to the change.
3849|`confirmed` |optional|
3850Whether adding the reviewer is confirmed. +
3851The Gerrit server may be configured to
3852link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
3853confirmation] when adding a group as reviewer that has many members.
3854|===========================
3855
Edwin Kempine3446292013-02-19 16:40:14 +01003856[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003857=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003858The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07003859Not all fields are returned by default. Additional fields can
3860be obtained by adding `o` parameters as described in
3861link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01003862
David Pursehouseae367192014-11-25 17:24:47 +09003863[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003864|===========================
3865|Field Name ||Description
3866|`draft` |not set if `false`|Whether the patch set is a draft.
David Ostrovsky17d0d332013-09-30 21:36:09 +02003867|`has_draft_comments` |not set if `false`|Whether the patch
3868set has one or more draft comments by the calling user. Only set if
Khai Dob3139b7532014-09-19 15:13:04 -07003869link:#draft_comments[DRAFT_COMMENTS] option is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003870|`_number` ||The patch set number.
Edwin Kempin4569ced2014-11-25 16:45:05 +01003871|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01003872|`fetch` ||
3873Information about how to fetch this patch set. The fetch information is
3874provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07003875"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
3876only included if a plugin implementing the
3877link:intro-project-owner.html#download-commands[download commands]
3878interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07003879|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01003880link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07003881|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01003882The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07003883link:#file-info[FileInfo] entities. Only set if
3884link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
3885option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07003886|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003887Actions the caller might be able to perform on this revision. The
3888information is a map of view name to link:#action-info[ActionInfo]
3889entities.
Khai Dob3139b7532014-09-19 15:13:04 -07003890|`reviewed` |optional|
3891Indicates whether the caller is authenticated and has commented on the
3892current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003893|===========================
3894
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003895[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003896=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003897The `RuleInput` entity contains information to test a Prolog rule.
3898
David Pursehouseae367192014-11-25 17:24:47 +09003899[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003900|===========================
3901|Field Name ||Description
3902|`rule`||
3903Prolog code to execute instead of the code in `refs/meta/config`.
3904|`filters`|`RUN` if not set|
3905When `RUN` filter rules in the parent projects are called to
3906post-process the results of the project specific rule. This
3907behavior matches how the rule will execute if installed. +
3908If `SKIP` the parent filters are not called, allowing the test
3909to return results from the input rule.
3910|===========================
3911
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003912[[suggested-reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003913=== SuggestedReviewerInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003914The `SuggestedReviewerInfo` entity contains information about a reviewer
3915that can be added to a change (an account or a group).
3916
3917`SuggestedReviewerInfo` has either the `account` field that contains
3918the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
3919the `group` field that contains the
3920link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
3921
Edwin Kempin14b58112013-02-26 16:30:19 +01003922[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003923=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01003924The `SubmitInfo` entity contains information about the change status
3925after submitting.
3926
David Pursehouseae367192014-11-25 17:24:47 +09003927[options="header",cols="1,6"]
Edwin Kempin14b58112013-02-26 16:30:19 +01003928|==========================
3929|Field Name |Description
3930|`status` |
3931The status of the change after submitting, can be `MERGED` or
3932`SUBMITTED`. +
3933If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
3934`false` the returned status is `SUBMITTED` and the caller can't know
3935whether the change could be merged successfully.
David Ostrovsky868e3412014-01-30 19:50:57 +01003936|`on_behalf_of`|optional|
3937The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
3938whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09003939have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
3940The user named by `on_behalf_of` does not need to be granted the `Submit`
3941permission. This feature is aimed for CI solutions: the CI account can be
3942granted both permssions, so individual users don't need `Submit` permission
3943themselves. Still the changes can be submited on behalf of real users and
3944not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01003945|==========================
3946
Edwin Kempin0eddba02013-02-22 15:30:12 +01003947[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003948=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01003949The `SubmitInput` entity contains information for submitting a change.
3950
David Pursehouseae367192014-11-25 17:24:47 +09003951[options="header",cols="1,^1,5"]
Edwin Kempin0eddba02013-02-22 15:30:12 +01003952|===========================
3953|Field Name ||Description
3954|`wait_for_merge`|`false` if not set|
3955Whether the request should wait for the merge to complete. +
3956If `false` the request returns immediately after the change has been
3957added to the merge queue and the caller can't know whether the change
3958could be merged successfully.
3959|===========================
3960
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003961[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003962=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003963The `SubmitRecord` entity describes results from a submit_rule.
3964
David Pursehouseae367192014-11-25 17:24:47 +09003965[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003966|===========================
3967|Field Name ||Description
3968|`status`||
3969`OK`, the change can be submitted. +
3970`NOT_READY`, additional labels are required before submit. +
3971`CLOSED`, closed changes cannot be submitted. +
3972`RULE_ERROR`, rule code failed with an error.
3973|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003974Map of labels that are approved; an
3975link:rest-api-accounts.html#account-info[AccountInfo] identifies the
3976voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003977|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003978Map of labels that are preventing submit;
3979link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003980|`need`|optional|
3981Map of labels that need to be given to submit. The value is
3982currently an empty object.
3983|`may`|optional|
3984Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01003985link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
3986if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003987|`impossible`|optional|
3988Map of labels that should have been in `need` but cannot be
3989used by any user because of access restrictions. The value
3990is currently an empty object.
3991|`error_message`|optional|
3992When status is RULE_ERROR this message provides some text describing
3993the failure of the rule predicate.
3994|===========================
3995
Edwin Kempin64006bb2013-02-22 08:17:04 +01003996[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003997=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01003998The `TopicInput` entity contains information for setting a topic.
3999
David Pursehouseae367192014-11-25 17:24:47 +09004000[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01004001|===========================
4002|Field Name ||Description
4003|`topic` |optional|The topic. +
4004The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01004005|===========================
4006
David Ostrovsky83e8aee2013-09-30 22:37:26 +02004007[[included-in-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004008=== IncludedInInfo
David Ostrovsky83e8aee2013-09-30 22:37:26 +02004009The `IncludedInInfo` entity contains information about the branches a
4010change was merged into and tags it was tagged with.
4011
David Pursehouseae367192014-11-25 17:24:47 +09004012[options="header",cols="1,6"]
David Ostrovsky83e8aee2013-09-30 22:37:26 +02004013|==========================
4014|Field Name |Description
David Ostrovsky83e8aee2013-09-30 22:37:26 +02004015|`branches` | The list of branches this change was merged into.
4016Each branch is listed without the 'refs/head/' prefix.
4017|`tags` | The list of tags this change was tagged with.
4018Each tag is listed without the 'refs/tags/' prefix.
4019|==========================
4020
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004021[[web-link-info]]
4022=== WebLinkInfo
4023The `WebLinkInfo` entity describes a link to an external site.
4024
David Pursehouseae367192014-11-25 17:24:47 +09004025[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004026|======================
4027|Field Name|Description
4028|`name` |The link name.
4029|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02004030|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004031|======================
4032
David Ostrovsky1a49f622014-07-29 00:40:02 +02004033[[edit-info]]
4034=== EditInfo
4035The `EditInfo` entity contains information about a change edit.
4036
David Pursehouseae367192014-11-25 17:24:47 +09004037[options="header",cols="1,^1,5"]
David Ostrovsky1a49f622014-07-29 00:40:02 +02004038|===========================
4039|Field Name ||Description
4040|`commit` ||The commit of change edit as
4041link:#commit-info[CommitInfo] entity.
David Ostrovsky0619f652014-09-11 13:33:45 +02004042|`baseRevision`||The revision of the patch set change edit is based on.
David Ostrovskycdda3312014-08-03 14:03:13 +02004043|`actions` ||
4044Actions the caller might be able to perform on this change edit. The
4045information is a map of view name to link:#action-info[ActionInfo]
4046entities.
David Ostrovsky5562fe52014-08-12 22:36:27 +02004047|`fetch` ||
4048Information about how to fetch this patch set. The fetch information is
4049provided as a map that maps the protocol name ("`git`", "`http`",
4050"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Ostrovsky5d98e342014-08-01 09:23:28 +02004051|`files` |optional|
4052The files of the change edit as a map that maps the file names to
4053link:#file-info[FileInfo] entities.
David Ostrovsky1a49f622014-07-29 00:40:02 +02004054|===========================
4055
David Ostrovskybd12e172014-08-21 23:08:15 +02004056[[change-edit-input]]
4057=== ChangeEditInput
4058The `ChangeEditInput` entity contains information for restoring a
David Ostrovsky138edb42014-08-15 21:31:43 +02004059path within change edit.
4060
David Pursehouseae367192014-11-25 17:24:47 +09004061[options="header",cols="1,^1,5"]
David Ostrovsky138edb42014-08-15 21:31:43 +02004062|===========================
4063|Field Name ||Description
4064|`restore_path`|optional|Path to file to restore.
4065|===========================
4066
David Ostrovskyc967e152014-10-24 17:36:16 +02004067[[change-edit-message-input]]
4068=== ChangeEditMessageInput
4069The `ChangeEditMessageInput` entity contains information for changing
4070the commit message within a change edit.
4071
4072[options="header",cols="1,^1,5"]
4073|===========================
4074|Field Name ||Description
4075|`message` ||New commit message.
4076|===========================
4077
Dave Borowitz5c894d42014-11-25 17:43:06 -05004078[[problem-info]]
4079=== ProblemInfo
4080The `ProblemInfo` entity contains a description of a potential consistency problem
4081with a change. These are not related to the code review process, but rather
4082indicate some inconsistency in Gerrit's database or repository metadata related
4083to the enclosing change.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08004084
Dave Borowitz3be39d02014-12-03 17:57:38 -08004085[options="header",cols="1,^1,5"]
Dave Borowitzfd508ca2014-11-06 15:24:04 -08004086|===========================
Dave Borowitz3be39d02014-12-03 17:57:38 -08004087|Field Name||Description
4088|`message` ||Plaintext message describing the problem with the change.
4089|`status` |optional|
4090The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
4091fix was attempted.
4092|`outcome` |optional|
4093If `status` is set, an additional plaintext message describing the
4094outcome of the fix.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08004095|===========================
4096
Edwin Kempind0a63922013-01-23 16:32:59 +01004097GERRIT
4098------
4099Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07004100
4101SEARCHBOX
4102---------