blob: e39355c71b96cc206853a0238395dfd2dc397714 [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--
David Pursehousea92d2e92017-08-03 06:03:47 +000013'POST /changes/'
David Ostrovsky837c0ee2014-04-27 12:54:20 +020014--
15
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -080016The change input link:#change-input[ChangeInput] entity must be provided in the
17request body.
David Ostrovsky837c0ee2014-04-27 12:54:20 +020018
Edwin Kempin088eeb9a2018-01-25 08:39:41 +010019To create a change the calling user must be allowed to
20link:access-control.html#category_push_review[upload to code review].
21
David Ostrovsky837c0ee2014-04-27 12:54:20 +020022.Request
23----
Paladox none4bac1952017-08-03 00:09:25 +000024 POST /changes/ HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090025 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020026
27 {
28 "project" : "myProject",
29 "subject" : "Let's support 100% Gerrit workflow direct in browser",
30 "branch" : "master",
31 "topic" : "create-change-in-browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010032 "status" : "NEW"
David Ostrovsky837c0ee2014-04-27 12:54:20 +020033 }
34----
35
36As response a link:#change-info[ChangeInfo] entity is returned that describes
37the resulting change.
38
39.Response
40----
Paladox none4bac1952017-08-03 00:09:25 +000041 HTTP/1.1 201 OK
David Ostrovsky837c0ee2014-04-27 12:54:20 +020042 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090043 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020044
45 )]}'
46 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020047 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
48 "project": "myProject",
49 "branch": "master",
50 "topic": "create-change-in-browser",
51 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
52 "subject": "Let's support 100% Gerrit workflow direct in browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010053 "status": "NEW",
David Ostrovsky837c0ee2014-04-27 12:54:20 +020054 "created": "2014-05-05 07:15:44.639000000",
55 "updated": "2014-05-05 07:15:44.639000000",
56 "mergeable": true,
57 "insertions": 0,
58 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020059 "_number": 4711,
60 "owner": {
61 "name": "John Doe"
62 }
63 }
64----
65
Edwin Kempin76202742013-02-15 13:51:50 +010066[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080067=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080068--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010069'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080070--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010071
Saša Živkovdd804022014-06-23 16:44:03 +020072Queries changes visible to the caller. The
73link:user-search.html#_search_operators[query string] must be provided
74by the `q` parameter. The `n` parameter can be used to limit the
75returned results.
Edwin Kempind0a63922013-01-23 16:32:59 +010076
Edwin Kempine3446292013-02-19 16:40:14 +010077As result a list of link:#change-info[ChangeInfo] entries is returned.
78The change output is sorted by the last update time, most recently
79updated to oldest updated.
80
Edwin Kempind0a63922013-01-23 16:32:59 +010081Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010082
83.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010084----
Edwin Kempin2091edb2013-01-23 19:07:38 +010085 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010086----
Edwin Kempind0a63922013-01-23 16:32:59 +010087
Edwin Kempin37440832013-02-06 11:36:00 +010088.Response
89----
Edwin Kempind0a63922013-01-23 16:32:59 +010090 HTTP/1.1 200 OK
91 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090092 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010093
94 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050095 [
96 {
John Spurlockd25fad12013-03-09 11:48:49 -050097 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
98 "project": "demo",
99 "branch": "master",
100 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
101 "subject": "One change",
102 "status": "NEW",
103 "created": "2012-07-17 07:18:30.854000000",
104 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500105 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100106 "insertions": 26,
107 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500108 "_number": 1756,
109 "owner": {
110 "name": "John Doe"
111 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100112 },
John Spurlockd25fad12013-03-09 11:48:49 -0500113 {
John Spurlockd25fad12013-03-09 11:48:49 -0500114 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
115 "project": "demo",
116 "branch": "master",
117 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
118 "subject": "Another change",
119 "status": "NEW",
120 "created": "2012-07-17 07:18:30.884000000",
121 "updated": "2012-07-17 07:18:30.885000000",
122 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100123 "insertions": 12,
124 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500125 "_number": 1757,
126 "owner": {
127 "name": "John Doe"
128 },
129 "_more_changes": true
130 }
131 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100132----
133
Sebastian Schuberth02bafe02016-01-20 21:38:11 +0100134If the number of changes matching the query exceeds either the internal
135limit or a supplied `n` query parameter, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900136`_more_changes: true` JSON field set.
137
138The `S` or `start` query parameter can be supplied to skip a number
139of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100140
Matthias Sohn0b2bf612020-12-24 00:15:32 +0100141Administrators can use the `skip-visibility` query parameter to skip visibility filtering.
142This can be used to ensure that no changes are missed e.g. when querying for changes which
143need to be reindexed. Without this parameter query results the user has no permission to read
144are filtered out. REST requests with the skip-visibility option are rejected when the current
145user doesn't have the ADMINISTRATE_SERVER capability.
146
Edwin Kempind0a63922013-01-23 16:32:59 +0100147Clients are allowed to specify more than one query by setting the `q`
148parameter multiple times. In this case the result is an array of
149arrays, one per query in the same order the queries were given in.
150
Edwin Kempina64c4b92013-01-23 11:30:40 +0100151.Query for the 25 most recent open changes of the projects that you watch
152****
153get::/changes/?q=status:open+is:watched&n=25
154****
155
Edwin Kempind0a63922013-01-23 16:32:59 +0100156Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100157
158.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100159----
160 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 +0100161----
Edwin Kempind0a63922013-01-23 16:32:59 +0100162
Edwin Kempin37440832013-02-06 11:36:00 +0100163.Response
164----
Edwin Kempind0a63922013-01-23 16:32:59 +0100165 HTTP/1.1 200 OK
166 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900167 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100168
169 )]}'
170 [
171 [
172 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100173 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
174 "project": "demo",
175 "branch": "master",
176 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
177 "subject": "One change",
178 "status": "NEW",
179 "created": "2012-07-17 07:18:30.854000000",
180 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100181 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100182 "insertions": 4,
183 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100184 "_number": 1756,
185 "owner": {
186 "name": "John Doe"
187 },
188 "labels": {
189 "Verified": {},
190 "Code-Review": {}
191 }
192 }
193 ],
194 [],
195 []
196 ]
197----
198
Edwin Kempina64c4b92013-01-23 11:30:40 +0100199.Query the changes for your user dashboard
200****
201get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
202****
203
David Pursehouse2cf28432016-08-21 23:20:08 +0900204[[query-options]]
Edwin Kempind0a63922013-01-23 16:32:59 +0100205Additional fields can be obtained by adding `o` parameters, each
206option requires more database lookups and slows down the query
207response time to the client so they are generally disabled by
208default. Optional fields are:
209
Edwin Kempine3446292013-02-19 16:40:14 +0100210[[labels]]
211--
Edwin Kempind0a63922013-01-23 16:32:59 +0100212* `LABELS`: a summary of each label required for submit, and
213 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100214--
Edwin Kempind0a63922013-01-23 16:32:59 +0100215
Edwin Kempine3446292013-02-19 16:40:14 +0100216[[detailed-labels]]
217--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800218* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800219 values of all existing approvals, recognized label values, values
Edwin Kempin66af3d82015-11-10 17:38:40 -0800220 permitted to be set by the current user, all reviewers by state, and
221 reviewers that may be removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100222--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800223
Edwin Kempine3446292013-02-19 16:40:14 +0100224[[current-revision]]
225--
Edwin Kempind0a63922013-01-23 16:32:59 +0100226* `CURRENT_REVISION`: describe the current revision (patch set)
227 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100228--
Edwin Kempind0a63922013-01-23 16:32:59 +0100229
Edwin Kempine3446292013-02-19 16:40:14 +0100230[[all-revisions]]
231--
Edwin Kempind0a63922013-01-23 16:32:59 +0100232* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100233--
Edwin Kempind0a63922013-01-23 16:32:59 +0100234
David Pursehouse025c1af2015-11-20 17:02:50 +0900235[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200236--
237* `DOWNLOAD_COMMANDS`: include the `commands` field in the
238 link:#fetch-info[FetchInfo] for revisions. Only valid when the
239 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
240--
241
Edwin Kempine3446292013-02-19 16:40:14 +0100242[[current-commit]]
243--
Edwin Kempind0a63922013-01-23 16:32:59 +0100244* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900245 commit object, including message. Only valid when the
246 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100247--
Edwin Kempind0a63922013-01-23 16:32:59 +0100248
Edwin Kempine3446292013-02-19 16:40:14 +0100249[[all-commits]]
250--
Edwin Kempind0a63922013-01-23 16:32:59 +0100251* `ALL_COMMITS`: parse and output all header fields from the
252 output revisions. If only `CURRENT_REVISION` was requested
253 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100254--
Edwin Kempind0a63922013-01-23 16:32:59 +0100255
Edwin Kempine3446292013-02-19 16:40:14 +0100256[[current-files]]
257--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100258* `CURRENT_FILES`: list files modified by the commit and magic files,
259 including basic line counts inserted/deleted per file. Only valid
260 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100261--
Edwin Kempind0a63922013-01-23 16:32:59 +0100262
Edwin Kempine3446292013-02-19 16:40:14 +0100263[[all-files]]
264--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100265* `ALL_FILES`: list files modified by the commit and magic files,
266 including basic line counts inserted/deleted per file. If only the
267 `CURRENT_REVISION` was requested then only that commit's modified
268 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100269--
Edwin Kempind0a63922013-01-23 16:32:59 +0100270
Edwin Kempine3446292013-02-19 16:40:14 +0100271[[detailed-accounts]]
272--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200273* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
274 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100275--
Dave Borowitz8926a882013-02-01 14:32:48 -0800276
Viktar Donich316bf7a2016-07-06 11:29:01 -0700277[[reviewer-updates]]
278--
279* `REVIEWER_UPDATES`: include updates to reviewers set as
280 link:#review-update-info[ReviewerUpdateInfo] entities.
281--
282
John Spurlock74a70cc2013-03-23 16:41:50 -0400283[[messages]]
284--
285* `MESSAGES`: include messages associated with the change.
286--
287
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700288[[actions]]
289--
290* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800291 for the change and its current revision. Ignored if the caller
292 is not authenticated.
293--
294
295[[change-actions]]
296--
297* `CHANGE_ACTIONS`: include information on available
298 change actions for the change. Ignored if the caller
299 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700300--
301
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700302[[reviewed]]
303--
Dave Borowitz86669b32015-05-27 14:56:10 -0700304* `REVIEWED`: include the `reviewed` field if all of the following are
305 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100306 - the change is open
307 - the caller is authenticated
308 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700309 from the change owner, i.e. this change would show up in the results of
310 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700311--
312
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100313[[skip_mergeable]]
314--
315* `SKIP_MERGEABLE`: skip the `mergeable` field in
316link:#change-info[ChangeInfo]. For fast moving projects, this field must
317be recomputed often, which is slow for projects with big trees.
Patrick Hieseldb8df482019-01-24 10:11:23 +0100318+
David Pursehouseec176922019-02-05 12:31:29 +0900319When link:config-gerrit.html#change.api.excludeMergeableInChangeInfo[
320`change.api.excludeMergeableInChangeInfo`] is set in the `gerrit.config`,
321the `mergeable` field will always be omitted and `SKIP_MERGEABLE` has no
322effect.
323+
324A change's mergeability can be requested separately by calling the
325link:#get-mergeable[get-mergeable] endpoint.
Alice Kober-Sotzeka19fd752018-01-19 15:31:46 +0100326--
Gal Paikin3a2aa012019-06-21 18:30:01 +0200327[[skip_diffstat]]
328--
329* `SKIP_DIFFSTAT`: skip the 'insertions' and 'deletions' field in link:#change-info[ChangeInfo].
330 For large trees, their computation may be expensive.
331--
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100332
Jonathan Niedercb51d742016-09-23 11:37:57 -0700333[[submittable]]
334--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700335* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700336 which can be used to tell if the change is reviewed and ready for submit.
337--
338
Khai Do2a23ec82014-09-19 16:33:02 -0700339[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100340--
Sven Selbergd26bd542014-11-21 16:28:10 +0100341* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
342 therefore only valid in combination with `CURRENT_COMMIT` or
343 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100344--
345
Dave Borowitz4c46c242014-12-03 16:46:45 -0800346[[check]]
347--
348* `CHECK`: include potential problems with the change.
349--
350
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700351[[commit-footers]]
352--
353* `COMMIT_FOOTERS`: include the full commit message with
354 Gerrit-specific commit footers in the
355 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700356--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700357
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400358[[push-certificates]]
359--
360* `PUSH_CERTIFICATES`: include push certificate information in the
361 link:#revision-info[RevisionInfo]. Ignored if signed push is not
362 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
363 server.
364--
365
Makson Lee3568a932017-08-28 17:12:03 +0800366[[tracking-ids]]
367--
368* `TRACKING_IDS`: include references to external tracking systems
369 as link:#tracking-id-info[TrackingIdInfo].
370--
371
Martin Fickb186cd72018-12-02 23:34:23 -0700372[[no-limit]]
373--
374* `NO-LIMIT`: Return all results
375--
376
Edwin Kempin37440832013-02-06 11:36:00 +0100377.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100378----
Edwin Kempinea621482013-10-16 12:58:24 +0200379 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 +0100380----
Edwin Kempind0a63922013-01-23 16:32:59 +0100381
Edwin Kempin37440832013-02-06 11:36:00 +0100382.Response
383----
Edwin Kempind0a63922013-01-23 16:32:59 +0100384 HTTP/1.1 200 OK
385 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900386 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100387
388 )]}'
389 [
390 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900391 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100392 "project": "gerrit",
393 "branch": "master",
394 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
395 "subject": "Use an EventBus to manage star icons",
396 "status": "NEW",
397 "created": "2012-04-25 00:52:25.580000000",
398 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100399 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100400 "insertions": 16,
401 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100402 "_number": 97,
403 "owner": {
404 "name": "Shawn Pearce"
405 },
406 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
407 "revisions": {
408 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900409 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100410 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100411 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100412 "fetch": {
413 "git": {
414 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200415 "ref": "refs/changes/97/97/1",
416 "commands": {
417 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
418 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
419 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
420 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
421 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100422 },
423 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200424 "url": "http://myuser@127.0.0.1:8080/gerrit",
425 "ref": "refs/changes/97/97/1",
426 "commands": {
427 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
428 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
429 "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",
430 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
431 }
432 },
433 "ssh": {
434 "url": "ssh://myuser@*:29418/gerrit",
435 "ref": "refs/changes/97/97/1",
436 "commands": {
437 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
438 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
439 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
440 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
441 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100442 }
443 },
444 "commit": {
445 "parents": [
446 {
447 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
448 "subject": "Migrate contributor agreements to All-Projects."
449 }
450 ],
451 "author": {
452 "name": "Shawn O. Pearce",
453 "email": "sop@google.com",
454 "date": "2012-04-24 18:08:08.000000000",
455 "tz": -420
456 },
457 "committer": {
458 "name": "Shawn O. Pearce",
459 "email": "sop@google.com",
460 "date": "2012-04-24 18:08:08.000000000",
461 "tz": -420
462 },
463 "subject": "Use an EventBus to manage star icons",
464 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
465 },
466 "files": {
467 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200468 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100469 "size_delta": -412,
470 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100471 },
472 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200473 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100474 "size_delta": 23,
475 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100476 },
477 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
478 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200479 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100480 "size_delta": -298,
481 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100482 },
483 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
484 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200485 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100486 "size_delta": 132,
487 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100488 },
489 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
490 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200491 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100492 "size_delta": -5512,
493 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100494 },
495 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
496 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200497 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100498 "size_delta": 8345,
499 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100500 },
501 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200502 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100503 "size_delta": -343,
504 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100505 }
506 }
507 }
508 }
509 }
510 ]
511----
512
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100513[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800514=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800515--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100516'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800517--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100518
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100519Retrieves a change.
520
Dave Borowitz0314f732013-10-03 09:34:30 -0700521Additional fields can be obtained by adding `o` parameters, each
522option requires more database lookups and slows down the query
523response time to the client so they are generally disabled by
524default. Fields are described in link:#list-changes[Query Changes].
525
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100526.Request
527----
528 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
529----
530
531As response a link:#change-info[ChangeInfo] entity is returned that
532describes the change.
533
534.Response
535----
536 HTTP/1.1 200 OK
537 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900538 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100539
540 )]}'
541 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100542 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
543 "project": "myProject",
544 "branch": "master",
545 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
546 "subject": "Implementing Feature X",
547 "status": "NEW",
548 "created": "2013-02-01 09:59:32.126000000",
549 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100550 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100551 "insertions": 34,
552 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100553 "_number": 3965,
554 "owner": {
555 "name": "John Doe"
556 }
557 }
558----
559
Edwin Kempin8e492202013-02-21 15:38:25 +0100560[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800561=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800562--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100563'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800564--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100565
Edwin Kempin8e492202013-02-21 15:38:25 +0100566Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700567detailed labels], link:#detailed-accounts[detailed accounts],
568link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100569
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700570Additional fields can be obtained by adding `o` parameters, each
571option requires more database lookups and slows down the query
572response time to the client so they are generally disabled by
573default. Fields are described in link:#list-changes[Query Changes].
574
Edwin Kempin8e492202013-02-21 15:38:25 +0100575.Request
576----
577 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
578----
579
580As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700581describes the change. This response will contain all votes for each
582label and include one combined vote. The combined label vote is
583calculated in the following order (from highest to lowest):
584REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100585
586.Response
587----
588 HTTP/1.1 200 OK
589 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900590 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100591
592 )]}'
593 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100594 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
595 "project": "myProject",
596 "branch": "master",
597 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
598 "subject": "Implementing Feature X",
599 "status": "NEW",
600 "created": "2013-02-01 09:59:32.126000000",
601 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100602 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100603 "insertions": 126,
604 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100605 "_number": 3965,
606 "owner": {
607 "_account_id": 1000096,
608 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200609 "email": "john.doe@example.com",
610 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100611 },
612 "labels": {
613 "Verified": {
614 "all": [
615 {
616 "value": 0,
617 "_account_id": 1000096,
618 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200619 "email": "john.doe@example.com",
620 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100621 },
622 {
623 "value": 0,
624 "_account_id": 1000097,
625 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200626 "email": "jane.roe@example.com",
627 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100628 }
629 ],
630 "values": {
631 "-1": "Fails",
632 " 0": "No score",
633 "+1": "Verified"
634 }
635 },
636 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100637 "disliked": {
638 "_account_id": 1000096,
639 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200640 "email": "john.doe@example.com",
641 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100642 },
643 "all": [
644 {
645 "value": -1,
646 "_account_id": 1000096,
647 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200648 "email": "john.doe@example.com",
649 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100650 },
651 {
652 "value": 1,
653 "_account_id": 1000097,
654 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200655 "email": "jane.roe@example.com",
656 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100657 }
658 ]
659 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400660 "-2": "This shall not be merged",
661 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100662 " 0": "No score",
663 "+1": "Looks good to me, but someone else must approve",
664 "+2": "Looks good to me, approved"
665 }
666 }
667 },
668 "permitted_labels": {
669 "Verified": [
670 "-1",
671 " 0",
672 "+1"
673 ],
674 "Code-Review": [
675 "-2",
676 "-1",
677 " 0",
678 "+1",
679 "+2"
680 ]
681 },
682 "removable_reviewers": [
683 {
684 "_account_id": 1000096,
685 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200686 "email": "john.doe@example.com",
687 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100688 },
689 {
690 "_account_id": 1000097,
691 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200692 "email": "jane.roe@example.com",
693 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100694 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400695 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800696 "reviewers": {
697 "REVIEWER": [
698 {
699 "_account_id": 1000096,
700 "name": "John Doe",
701 "email": "john.doe@example.com",
702 "username": "jdoe"
703 },
704 {
705 "_account_id": 1000097,
706 "name": "Jane Roe",
707 "email": "jane.roe@example.com",
708 "username": "jroe"
709 }
710 ]
711 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700712 "reviewer_updates": [
713 {
714 "state": "REVIEWER",
715 "reviewer": {
716 "_account_id": 1000096,
717 "name": "John Doe",
718 "email": "john.doe@example.com",
719 "username": "jdoe"
720 },
721 "updated_by": {
722 "_account_id": 1000096,
723 "name": "John Doe",
724 "email": "john.doe@example.com",
725 "username": "jdoe"
726 },
727 "updated": "2016-07-21 20:12:39.000000000"
728 },
729 {
730 "state": "REMOVED",
731 "reviewer": {
732 "_account_id": 1000096,
733 "name": "John Doe",
734 "email": "john.doe@example.com",
735 "username": "jdoe"
736 },
737 "updated_by": {
738 "_account_id": 1000096,
739 "name": "John Doe",
740 "email": "john.doe@example.com",
741 "username": "jdoe"
742 },
743 "updated": "2016-07-21 20:12:33.000000000"
744 },
745 {
746 "state": "CC",
747 "reviewer": {
748 "_account_id": 1000096,
749 "name": "John Doe",
750 "email": "john.doe@example.com",
751 "username": "jdoe"
752 },
753 "updated_by": {
754 "_account_id": 1000096,
755 "name": "John Doe",
756 "email": "john.doe@example.com",
757 "username": "jdoe"
758 },
759 "updated": "2016-03-23 21:34:02.419000000",
760 },
761 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400762 "messages": [
763 {
764 "id": "YH-egE",
765 "author": {
766 "_account_id": 1000096,
767 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200768 "email": "john.doe@example.com",
769 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400770 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100771 "date": "2013-03-23 21:34:02.419000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400772 "message": "Patch Set 1:\n\nThis is the first message.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100773 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400774 },
775 {
776 "id": "WEEdhU",
777 "author": {
778 "_account_id": 1000097,
779 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200780 "email": "jane.roe@example.com",
781 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400782 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100783 "date": "2013-03-23 21:36:52.332000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400784 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100785 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400786 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100787 ]
788 }
789----
790
Aaron Gable9b413072017-08-24 13:15:21 -0700791[[create-merge-patch-set-for-change]]
792=== Create Merge Patch Set For Change
793--
794'POST /changes/link:#change-id[\{change-id\}]/merge'
795--
796
797Update an existing change by using a
798link:#merge-patch-set-input[MergePatchSetInput] entity.
799
800Gerrit will create a merge commit based on the information of
801MergePatchSetInput and add a new patch set to the change corresponding
802to the new merge commit.
803
804.Request
805----
806 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
807 Content-Type: application/json; charset=UTF-8
808
809 {
810 "subject": "Merge dev_branch into master",
811 "merge": {
David Pursehousef4fb1042018-03-18 23:03:46 +0900812 "source": "refs/changes/34/1234/1"
Aaron Gable9b413072017-08-24 13:15:21 -0700813 }
814 }
815----
816
817As response a link:#change-info[ChangeInfo] entity with current revision is
818returned that describes the resulting change.
819
820.Response
821----
822 HTTP/1.1 200 OK
823 Content-Disposition: attachment
824 Content-Type: application/json; charset=UTF-8
825
826 )]}'
827 {
828 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
829 "project": "test",
830 "branch": "master",
831 "hashtags": [],
832 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
833 "subject": "Merge dev_branch into master",
834 "status": "NEW",
835 "created": "2016-09-23 18:08:53.238000000",
836 "updated": "2016-09-23 18:09:25.934000000",
837 "submit_type": "MERGE_IF_NECESSARY",
838 "mergeable": true,
839 "insertions": 5,
840 "deletions": 0,
841 "_number": 72,
842 "owner": {
843 "_account_id": 1000000
844 },
845 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
846 }
847----
848
849[[set-message]]
850=== Set Commit Message
851--
852'PUT /changes/link:#change-id[\{change-id\}]/message'
853--
854
855Creates a new patch set with a new commit message.
856
857The new commit message must be provided in the request body inside a
Han-Wen Nienhuys098580a2019-07-24 20:17:41 +0200858link:#commit-message-input[CommitMessageInput] entity. If a Change-Id
859footer is specified, it must match the current Change-Id footer. If
860the Change-Id footer is absent, the current Change-Id is added to the
861message.
Aaron Gable9b413072017-08-24 13:15:21 -0700862
863.Request
864----
865 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
866 Content-Type: application/json; charset=UTF-8
867
868 {
869 "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n"
870 }
871----
872
873.Notifications
874
875An email will be sent using the "newpatchset" template.
876
877[options="header",cols="1,1"]
878|=============================
879|WIP State |Default
880|Ready for review|owner, reviewers, CCs, stars, NEW_PATCHSETS watchers
881|Work in progress|owner
882|=============================
883
Edwin Kempin64006bb2013-02-22 08:17:04 +0100884[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800885=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800886--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100887'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800888--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100889
Edwin Kempin64006bb2013-02-22 08:17:04 +0100890Retrieves the topic of a change.
891
892.Request
893----
894 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
895----
896
897.Response
898----
899 HTTP/1.1 200 OK
900 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900901 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100902
903 )]}'
904 "Documentation"
905----
906
907If the change does not have a topic an empty string is returned.
908
909[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800910=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800911--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100912'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800913--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100914
Edwin Kempin64006bb2013-02-22 08:17:04 +0100915Sets the topic of a change.
916
917The new topic must be provided in the request body inside a
Patrick Hiesel4aa14562018-06-19 15:07:50 +0200918link:#topic-input[TopicInput] entity. Any leading or trailing whitespace
919in the topic name will be removed.
Edwin Kempin64006bb2013-02-22 08:17:04 +0100920
921.Request
922----
923 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900924 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100925
926 {
927 "topic": "Documentation"
928 }
929----
930
931As response the new topic is returned.
932
933.Response
934----
935 HTTP/1.1 200 OK
936 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900937 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100938
939 )]}'
940 "Documentation"
941----
942
943If the topic was deleted the response is "`204 No Content`".
944
945[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800946=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800947--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100948'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800949--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100950
Edwin Kempin64006bb2013-02-22 08:17:04 +0100951Deletes the topic of a change.
952
Edwin Kempin64006bb2013-02-22 08:17:04 +0100953.Request
954----
955 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
956----
957
958.Response
959----
960 HTTP/1.1 204 No Content
961----
962
Sven Selberg273a4aa2016-09-21 16:28:10 +0200963[[get-assignee]]
964=== Get Assignee
965--
966'GET /changes/link:#change-id[\{change-id\}]/assignee'
967--
968
969Retrieves the account of the user assigned to a change.
970
971.Request
972----
973 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
974----
975
976As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
977describing the assigned account is returned.
978
979.Response
980----
981 HTTP/1.1 200 OK
982 Content-Disposition: attachment
983 Content-Type: application/json; charset=UTF-8
984
985 )]}'
986 {
987 "_account_id": 1000096,
988 "name": "John Doe",
989 "email": "john.doe@example.com",
990 "username": "jdoe"
991 }
992----
993
994If the change has no assignee the response is "`204 No Content`".
995
996[[get-past-assignees]]
997=== Get Past Assignees
998--
999'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
1000--
1001
1002Returns a list of every user ever assigned to a change, in the order in which
1003they were first assigned.
1004
1005.Request
1006----
1007 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
1008----
1009
1010As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
1011entities is returned.
1012
1013.Response
1014----
1015 HTTP/1.1 200 OK
1016 Content-Disposition: attachment
1017 Content-Type: application/json; charset=UTF-8
1018
1019 )]}'
1020 [
1021 {
1022 "_account_id": 1000051,
1023 "name": "Jane Doe",
1024 "email": "jane.doe@example.com",
1025 "username": "janed"
1026 },
1027 {
1028 "_account_id": 1000096,
1029 "name": "John Doe",
1030 "email": "john.doe@example.com",
1031 "username": "jdoe"
1032 }
1033 ]
1034
1035----
1036
1037
1038[[set-assignee]]
1039=== Set Assignee
1040--
1041'PUT /changes/link:#change-id[\{change-id\}]/assignee'
1042--
1043
1044Sets the assignee of a change.
1045
1046The new assignee must be provided in the request body inside a
1047link:#assignee-input[AssigneeInput] entity.
1048
1049.Request
1050----
1051 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1052 Content-Type: application/json; charset=UTF-8
1053
1054 {
1055 "assignee": "jdoe"
1056 }
1057----
1058
1059As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1060describing the assigned account is returned.
1061
1062.Response
1063----
1064 HTTP/1.1 200 OK
1065 Content-Disposition: attachment
1066 Content-Type: application/json; charset=UTF-8
1067
1068 )]}'
1069 {
1070 "_account_id": 1000096,
1071 "name": "John Doe",
1072 "email": "john.doe@example.com",
1073 "username": "jdoe"
1074 }
1075----
1076
1077[[delete-assignee]]
1078=== Delete Assignee
1079--
1080'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
1081--
1082
1083Deletes the assignee of a change.
1084
1085
1086.Request
1087----
1088 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1089----
1090
1091As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1092describing the account of the deleted assignee is returned.
1093
1094.Response
1095----
1096 HTTP/1.1 200 OK
1097 Content-Disposition: attachment
1098 Content-Type: application/json; charset=UTF-8
1099
1100 )]}'
1101 {
1102 "_account_id": 1000096,
1103 "name": "John Doe",
1104 "email": "john.doe@example.com",
1105 "username": "jdoe"
1106 }
1107----
1108
1109If the change had no assignee the response is "`204 No Content`".
1110
Patrick Hieselbb84fd72017-08-23 11:11:22 +02001111[[get-pure-revert]]
1112=== Get Pure Revert
1113--
1114'GET /changes/link:#change-id[\{change-id\}]/pure_revert'
1115--
1116
1117Check if the given change is a pure revert of the change it references in `revertOf`.
1118Optionally, the query parameter `o` can be passed in to specify a commit (SHA1 in
111940 digit hex representation) to check against. It takes precedence over `revertOf`.
1120If the change has no reference in `revertOf`, the parameter is mandatory.
1121
1122As response a link:#pure-revert-info[PureRevertInfo] entity is returned.
1123
1124.Request
1125----
1126 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/pure_revert?o=247bccf56ae47634650bcc08b8aa784c3580ccas HTTP/1.0
1127----
1128
1129.Response
1130----
1131 HTTP/1.1 200 OK
1132 Content-Disposition: attachment
1133 Content-Type: application/json; charset=UTF-8
1134
1135 )]}'
1136 {
1137 "is_pure_revert" : false
1138 }
1139----
1140
Edwin Kempined5364b2013-02-22 10:39:33 +01001141[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001142=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001143--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001144'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001145--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001146
Edwin Kempined5364b2013-02-22 10:39:33 +01001147Abandons a change.
1148
1149The request body does not need to include a link:#abandon-input[
1150AbandonInput] entity if no review comment is added.
1151
1152.Request
1153----
1154 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1155----
1156
1157As response a link:#change-info[ChangeInfo] entity is returned that
1158describes the abandoned change.
1159
1160.Response
1161----
1162 HTTP/1.1 200 OK
1163 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001164 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001165
1166 )]}'
1167 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001168 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1169 "project": "myProject",
1170 "branch": "master",
1171 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1172 "subject": "Implementing Feature X",
1173 "status": "ABANDONED",
1174 "created": "2013-02-01 09:59:32.126000000",
1175 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001176 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001177 "insertions": 3,
1178 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001179 "_number": 3965,
1180 "owner": {
1181 "name": "John Doe"
1182 }
1183 }
1184----
1185
1186If the change cannot be abandoned because the change state doesn't
1187allow abandoning of the change, the response is "`409 Conflict`" and
1188the error message is contained in the response body.
1189
1190.Response
1191----
1192 HTTP/1.1 409 Conflict
1193 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001194 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001195
1196 change is merged
1197----
1198
Logan Hankse43b68e2017-05-23 13:16:22 -07001199.Notifications
1200
1201An email will be sent using the "abandon" template. The notify handling is ALL.
1202Notifications are suppressed on WIP changes that have never started review.
1203
Logan Hanks87607412017-05-30 13:49:04 -07001204[options="header",cols="1,2"]
Logan Hankse43b68e2017-05-23 13:16:22 -07001205|=============================
Logan Hanks87607412017-05-30 13:49:04 -07001206|WIP State |notify=ALL
Logan Hankse43b68e2017-05-23 13:16:22 -07001207|Ready for review|owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1208|Work in progress|not sent
1209|Reviewable WIP |owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1210|=============================
1211
Edwin Kempined5364b2013-02-22 10:39:33 +01001212[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001213=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001214--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001215'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001216--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001217
Edwin Kempined5364b2013-02-22 10:39:33 +01001218Restores a change.
1219
1220The request body does not need to include a link:#restore-input[
1221RestoreInput] entity if no review comment is added.
1222
1223.Request
1224----
1225 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1226----
1227
1228As response a link:#change-info[ChangeInfo] entity is returned that
1229describes the restored change.
1230
1231.Response
1232----
1233 HTTP/1.1 200 OK
1234 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001235 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001236
1237 )]}'
1238 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001239 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1240 "project": "myProject",
1241 "branch": "master",
1242 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1243 "subject": "Implementing Feature X",
1244 "status": "NEW",
1245 "created": "2013-02-01 09:59:32.126000000",
1246 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001247 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001248 "insertions": 2,
1249 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001250 "_number": 3965,
1251 "owner": {
1252 "name": "John Doe"
1253 }
1254 }
1255----
1256
1257If the change cannot be restored because the change state doesn't
1258allow restoring the change, the response is "`409 Conflict`" and
1259the error message is contained in the response body.
1260
1261.Response
1262----
1263 HTTP/1.1 409 Conflict
1264 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001265 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001266
1267 change is new
1268----
1269
Edwin Kempincdae63b2013-03-15 15:06:59 +01001270[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001271=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001272--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001273'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001274--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001275
1276Rebases a change.
1277
Zalan Blenessy874aed72015-01-12 13:26:18 +01001278Optionally, the parent revision can be changed to another patch set through the
1279link:#rebase-input[RebaseInput] entity.
1280
Edwin Kempincdae63b2013-03-15 15:06:59 +01001281.Request
1282----
1283 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001284 Content-Type: application/json;charset=UTF-8
1285
1286 {
1287 "base" : "1234",
1288 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001289----
1290
1291As response a link:#change-info[ChangeInfo] entity is returned that
1292describes the rebased change. Information about the current patch set
1293is included.
1294
1295.Response
1296----
1297 HTTP/1.1 200 OK
1298 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001299 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001300
1301 )]}'
1302 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001303 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1304 "project": "myProject",
1305 "branch": "master",
1306 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1307 "subject": "Implement Feature X",
1308 "status": "NEW",
1309 "created": "2013-02-01 09:59:32.126000000",
1310 "updated": "2013-02-21 11:16:36.775000000",
1311 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001312 "insertions": 33,
1313 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001314 "_number": 4799,
1315 "owner": {
1316 "name": "John Doe"
1317 },
1318 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1319 "revisions": {
1320 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001321 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001322 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001323 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001324 "fetch": {
1325 "http": {
1326 "url": "http://gerrit:8080/myProject",
1327 "ref": "refs/changes/99/4799/2"
1328 }
1329 },
1330 "commit": {
1331 "parents": [
1332 {
1333 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1334 "subject": "Implement Feature A"
1335 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001336 ],
1337 "author": {
1338 "name": "John Doe",
1339 "email": "john.doe@example.com",
1340 "date": "2013-05-07 15:21:27.000000000",
1341 "tz": 120
1342 },
1343 "committer": {
1344 "name": "Gerrit Code Review",
1345 "email": "gerrit-server@example.com",
1346 "date": "2013-05-07 15:35:43.000000000",
1347 "tz": 120
1348 },
1349 "subject": "Implement Feature X",
1350 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001351 }
1352 }
1353 }
1354----
1355
1356If the change cannot be rebased, e.g. due to conflicts, the response is
1357"`409 Conflict`" and the error message is contained in the response
1358body.
1359
1360.Response
1361----
1362 HTTP/1.1 409 Conflict
1363 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001364 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001365
1366 The change could not be rebased due to a path conflict during merge.
1367----
1368
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301369[[move-change]]
1370=== Move Change
1371--
1372'POST /changes/link:#change-id[\{change-id\}]/move'
1373--
1374
1375Move a change.
1376
1377The destination branch must be provided in the request body inside a
1378link:#move-input[MoveInput] entity.
1379
1380.Request
1381----
1382 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1383 Content-Type: application/json; charset=UTF-8
1384
1385 {
1386 "destination_branch" : "release-branch"
1387 }
1388
1389----
1390
1391As response a link:#change-info[ChangeInfo] entity is returned that
1392describes the moved change.
1393
1394.Response
1395----
1396 HTTP/1.1 200 OK
1397 Content-Disposition: attachment
1398 Content-Type: application/json; charset=UTF-8
1399
1400 )]}'
1401 {
1402 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1403 "project": "myProject",
1404 "branch": "release-branch",
1405 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1406 "subject": "Implementing Feature X",
1407 "status": "NEW",
1408 "created": "2013-02-01 09:59:32.126000000",
1409 "updated": "2013-02-21 11:16:36.775000000",
1410 "mergeable": true,
1411 "insertions": 2,
1412 "deletions": 13,
1413 "_number": 3965,
1414 "owner": {
1415 "name": "John Doe"
1416 }
1417 }
1418----
1419
Changcheng Xiao6dc90422017-08-09 10:21:58 +02001420Note that this endpoint will not update the change's parents, which is
1421different from the link:#cherry-pick[cherry-pick] endpoint.
1422
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301423If the change cannot be moved because the change state doesn't
1424allow moving the change, the response is "`409 Conflict`" and
1425the error message is contained in the response body.
1426
1427.Response
1428----
1429 HTTP/1.1 409 Conflict
1430 Content-Disposition: attachment
1431 Content-Type: text/plain; charset=UTF-8
1432
1433 change is merged
1434----
1435
1436If the change cannot be moved because the user doesn't have
1437abandon permission on the change or upload permission on the destination,
1438the response is "`409 Conflict`" and the error message is contained in the
1439response body.
1440
1441.Response
1442----
1443 HTTP/1.1 409 Conflict
1444 Content-Disposition: attachment
1445 Content-Type: text/plain; charset=UTF-8
1446
1447 move not permitted
1448----
1449
Edwin Kempind2ec4152013-02-22 12:17:19 +01001450[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001451=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001452--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001453'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001454--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001455
Edwin Kempind2ec4152013-02-22 12:17:19 +01001456Reverts a change.
1457
1458The request body does not need to include a link:#revert-input[
1459RevertInput] entity if no review comment is added.
1460
1461.Request
1462----
Michael Zhou10270492016-03-24 22:35:40 -04001463 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001464----
1465
1466As response a link:#change-info[ChangeInfo] entity is returned that
1467describes the reverting change.
1468
1469.Response
1470----
1471 HTTP/1.1 200 OK
1472 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001473 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001474
1475 )]}'
1476 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001477 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1478 "project": "myProject",
1479 "branch": "master",
1480 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1481 "subject": "Revert \"Implementing Feature X\"",
1482 "status": "NEW",
1483 "created": "2013-02-01 09:59:32.126000000",
1484 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001485 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001486 "insertions": 6,
1487 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001488 "_number": 3965,
1489 "owner": {
1490 "name": "John Doe"
1491 }
1492 }
1493----
1494
1495If the change cannot be reverted because the change state doesn't
1496allow reverting the change, the response is "`409 Conflict`" and
1497the error message is contained in the response body.
1498
1499.Response
1500----
1501 HTTP/1.1 409 Conflict
1502 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001503 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001504
1505 change is new
1506----
1507
Edwin Kempin0eddba02013-02-22 15:30:12 +01001508[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001509=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001510--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001511'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001512--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001513
Edwin Kempin0eddba02013-02-22 15:30:12 +01001514Submits a change.
1515
1516The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001517SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001518
1519.Request
1520----
1521 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001522 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001523
1524 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001525 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001526 }
1527----
1528
1529As response a link:#change-info[ChangeInfo] entity is returned that
1530describes the submitted/merged change.
1531
1532.Response
1533----
1534 HTTP/1.1 200 OK
1535 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001536 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001537
1538 )]}'
1539 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001540 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1541 "project": "myProject",
1542 "branch": "master",
1543 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1544 "subject": "Implementing Feature X",
1545 "status": "MERGED",
1546 "created": "2013-02-01 09:59:32.126000000",
1547 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001548 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001549 "_number": 3965,
1550 "owner": {
1551 "name": "John Doe"
1552 }
1553 }
1554----
1555
1556If the change cannot be submitted because the submit rule doesn't allow
1557submitting the change, the response is "`409 Conflict`" and the error
1558message is contained in the response body.
1559
1560.Response
1561----
1562 HTTP/1.1 409 Conflict
1563 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001564 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001565
1566 blocked by Verified
1567----
1568
David Pursehouse025c1af2015-11-20 17:02:50 +09001569[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001570=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001571--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001572'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001573--
1574
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001575Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001576link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001577including the current change itself.
1578
Stefan Bellera7ad6612015-06-26 10:05:43 -07001579The list consists of:
1580
1581* The given change.
1582* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1583 is enabled, include all open changes with the same topic.
1584* For each change whose submit type is not CHERRY_PICK, include unmerged
1585 ancestors targeting the same branch.
1586
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001587As a special case, the list is empty if this change would be
1588submitted by itself (without other changes).
1589
1590.Request
1591----
1592 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1593 Content-Type: application/json; charset=UTF-8
1594----
1595
1596As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1597entity is returned that describes what would happen if the change were
1598submitted. This response contains a list of changes and a count of
1599changes that are not visible to the caller that are part of the set of
1600changes to be merged.
1601
1602The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001603link:#list-changes[Query Changes] with the
1604link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Patrick Hiesel6fbbdaa2018-04-05 15:10:13 +02001605link:#current-revision[`CURRENT_REVISION`],and
Jonathan Niedercb51d742016-09-23 11:37:57 -07001606link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001607
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001608Standard link:#query-options[formatting options] can be specified
1609with the `o` parameter, as well as the `submitted_together` specific
1610option `NON_VISIBLE_CHANGES`.
1611
Stefan Bellera7ad6612015-06-26 10:05:43 -07001612.Response
1613----
1614 HTTP/1.1 200 OK
1615 Content-Disposition: attachment
1616 Content-Type: application/json; charset=UTF-8
1617
1618)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001619{
1620 "changes": [
1621 {
1622 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1623 "project": "gerrit",
1624 "branch": "master",
1625 "hashtags": [],
1626 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1627 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1628 "status": "NEW",
1629 "created": "2015-05-01 15:39:57.979000000",
1630 "updated": "2015-05-20 19:25:21.592000000",
1631 "mergeable": true,
1632 "insertions": 303,
1633 "deletions": 210,
1634 "_number": 1779,
1635 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001636 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001637 },
1638 "labels": {
1639 "Code-Review": {
1640 "approved": {
1641 "_account_id": 1000000
1642 },
1643 "all": [
1644 {
1645 "value": 2,
1646 "date": "2015-05-20 19:25:21.592000000",
1647 "_account_id": 1000000
1648 }
1649 ],
1650 "values": {
1651 "-2": "This shall not be merged",
1652 "-1": "I would prefer this is not merged as is",
1653 " 0": "No score",
1654 "+1": "Looks good to me, but someone else must approve",
1655 "+2": "Looks good to me, approved"
1656 },
1657 "default_value": 0
1658 },
1659 "Verified": {
1660 "approved": {
1661 "_account_id": 1000000
1662 },
1663 "all": [
1664 {
1665 "value": 1,
1666 "date": "2015-05-20 19:25:21.592000000",
1667 "_account_id": 1000000
1668 }
1669 ],
1670 "values": {
1671 "-1": "Fails",
1672 " 0": "No score",
1673 "+1": "Verified"
1674 },
1675 "default_value": 0
1676 }
1677 },
1678 "permitted_labels": {
1679 "Code-Review": [
1680 "-2",
1681 "-1",
1682 " 0",
1683 "+1",
1684 "+2"
1685 ],
1686 "Verified": [
1687 "-1",
1688 " 0",
1689 "+1"
1690 ]
1691 },
1692 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001693 {
1694 "_account_id": 1000000
1695 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001696 ],
1697 "reviewers": {
1698 "REVIEWER": [
1699 {
1700 "_account_id": 1000000
1701 }
1702 ]
1703 },
1704 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1705 "revisions": {
1706 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001707 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001708 "_number": 1,
1709 "created": "2015-05-01 15:39:57.979000000",
1710 "uploader": {
1711 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001712 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001713 "ref": "refs/changes/79/1779/1",
1714 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07001715 }
1716 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001717 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001718 {
1719 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1720 "project": "gerrit",
1721 "branch": "master",
1722 "hashtags": [],
1723 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1724 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1725 "status": "NEW",
1726 "created": "2015-05-01 15:39:57.979000000",
1727 "updated": "2015-05-20 19:25:21.546000000",
1728 "mergeable": true,
1729 "insertions": 15,
1730 "deletions": 6,
1731 "_number": 1780,
1732 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001733 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001734 },
1735 "labels": {
1736 "Code-Review": {
1737 "approved": {
1738 "_account_id": 1000000
1739 },
1740 "all": [
1741 {
1742 "value": 2,
1743 "date": "2015-05-20 19:25:21.546000000",
1744 "_account_id": 1000000
1745 }
1746 ],
1747 "values": {
1748 "-2": "This shall not be merged",
1749 "-1": "I would prefer this is not merged as is",
1750 " 0": "No score",
1751 "+1": "Looks good to me, but someone else must approve",
1752 "+2": "Looks good to me, approved"
1753 },
1754 "default_value": 0
1755 },
1756 "Verified": {
1757 "approved": {
1758 "_account_id": 1000000
1759 },
1760 "all": [
1761 {
1762 "value": 1,
1763 "date": "2015-05-20 19:25:21.546000000",
1764 "_account_id": 1000000
1765 }
1766 ],
1767 "values": {
1768 "-1": "Fails",
1769 " 0": "No score",
1770 "+1": "Verified"
1771 },
1772 "default_value": 0
1773 }
1774 },
1775 "permitted_labels": {
1776 "Code-Review": [
1777 "-2",
1778 "-1",
1779 " 0",
1780 "+1",
1781 "+2"
1782 ],
1783 "Verified": [
1784 "-1",
1785 " 0",
1786 "+1"
1787 ]
1788 },
1789 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001790 {
1791 "_account_id": 1000000
1792 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001793 ],
1794 "reviewers": {
1795 "REVIEWER": [
1796 {
1797 "_account_id": 1000000
1798 }
1799 ]
1800 },
1801 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
1802 "revisions": {
1803 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09001804 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001805 "_number": 1,
1806 "created": "2015-05-01 15:39:57.979000000",
1807 "uploader": {
1808 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001809 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001810 "ref": "refs/changes/80/1780/1",
1811 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07001812 }
1813 }
1814 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001815 ],
1816 "non_visible_changes": 0
1817}
Stefan Bellera7ad6612015-06-26 10:05:43 -07001818----
1819
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001820If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
1821instead of a link:#submitted-together-info[SubmittedTogetherInfo]
1822entity, the response is a list of changes, or a 403 response with a
1823message if the set of changes to be submitted with this change
1824includes changes the caller cannot read.
1825
Stefan Bellera7ad6612015-06-26 10:05:43 -07001826
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02001827[[delete-change]]
1828=== Delete Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001829--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001830'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001831--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001832
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02001833Deletes a change.
1834
Paladox none580ae0e2017-02-12 18:15:48 +00001835New or abandoned changes can be deleted by their owner if the user is granted
1836the link:access-control.html#category_delete_own_changes[Delete Own Changes] permission,
1837otherwise only by administrators.
1838
David Ostrovsky0d69c232013-09-10 23:10:23 +02001839.Request
1840----
1841 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001842 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001843----
1844
1845.Response
1846----
1847 HTTP/1.1 204 No Content
1848----
1849
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001850[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001851=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001852--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001853'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001854--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001855
1856Retrieves the branches and tags in which a change is included. As result
1857an link:#included-in-info[IncludedInInfo] entity is returned.
1858
1859.Request
1860----
1861 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1862----
1863
1864.Response
1865----
1866 HTTP/1.1 200 OK
1867 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001868 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001869
1870 )]}'
1871 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001872 "branches": [
1873 "master"
1874 ],
1875 "tags": []
1876 }
1877----
1878
David Pursehouse4e38b972014-05-30 10:36:40 +09001879[[index-change]]
1880=== Index Change
1881--
1882'POST /changes/link:#change-id[\{change-id\}]/index'
1883--
1884
1885Adds or updates the change in the secondary index.
1886
1887.Request
1888----
1889 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1890----
1891
1892.Response
1893----
1894 HTTP/1.1 204 No Content
1895----
1896
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001897[[list-change-comments]]
1898=== List Change Comments
1899--
1900'GET /changes/link:#change-id[\{change-id\}]/comments'
1901--
1902
1903Lists the published comments of all revisions of the change.
1904
1905Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1906entries. The entries in the map are sorted by file path, and the
1907comments for each path are sorted by patch set number. Each comment has
1908the `patch_set` and `author` fields set.
1909
1910.Request
1911----
1912 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
1913----
1914
1915.Response
1916----
1917 HTTP/1.1 200 OK
1918 Content-Disposition: attachment
1919 Content-Type: application/json; charset=UTF-8
1920
1921 )]}'
1922 {
1923 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1924 {
1925 "patch_set": 1,
1926 "id": "TvcXrmjM",
1927 "line": 23,
1928 "message": "[nit] trailing whitespace",
1929 "updated": "2013-02-26 15:40:43.986000000"
1930 "author": {
1931 "_account_id": 1000096,
1932 "name": "John Doe",
1933 "email": "john.doe@example.com"
1934 }
1935 },
1936 {
1937 "patch_set": 2,
1938 "id": "TveXwFiA",
1939 "line": 49,
1940 "in_reply_to": "TfYX-Iuo",
1941 "message": "Done",
1942 "updated": "2013-02-26 15:40:45.328000000"
1943 "author": {
1944 "_account_id": 1000097,
1945 "name": "Jane Roe",
1946 "email": "jane.roe@example.com"
1947 }
1948 }
1949 ]
1950 }
1951----
1952
Changcheng Xiao9b04c042016-12-28 12:45:29 +01001953[[list-change-robot-comments]]
1954=== List Change Robot Comments
1955--
1956'GET /changes/link:#change-id[\{change-id\}]/robotcomments'
1957--
1958
1959Lists the robot comments of all revisions of the change.
1960
1961Return a map that maps the file path to a list of
1962link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
1963map are sorted by file path.
1964
1965.Request
1966----
1967 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/robotcomments/ HTTP/1.0
1968----
1969
1970.Response
1971----
1972 HTTP/1.1 200 OK
1973 Content-Disposition: attachment
1974 Content-Type: application/json; charset=UTF-8
1975
1976 )]}'
1977 {
1978 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1979 {
1980 "id": "TvcXrmjM",
1981 "line": 23,
1982 "message": "unused import",
1983 "updated": "2016-02-26 15:40:43.986000000",
1984 "author": {
1985 "_account_id": 1000110,
1986 "name": "Code Analyzer",
1987 "email": "code.analyzer@example.com"
1988 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09001989 "robot_id": "importChecker",
1990 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01001991 },
1992 {
1993 "id": "TveXwFiA",
1994 "line": 49,
1995 "message": "wrong indention",
1996 "updated": "2016-02-26 15:40:45.328000000",
1997 "author": {
1998 "_account_id": 1000110,
1999 "name": "Code Analyzer",
2000 "email": "code.analyzer@example.com"
2001 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002002 "robot_id": "styleChecker",
2003 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002004 }
2005 ]
2006 }
2007----
2008
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002009[[list-change-drafts]]
2010=== List Change Drafts
2011--
2012'GET /changes/link:#change-id[\{change-id\}]/drafts'
2013--
2014
2015Lists the draft comments of all revisions of the change that belong to
2016the calling user.
2017
2018Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2019entries. The entries in the map are sorted by file path, and the
2020comments for each path are sorted by patch set number. Each comment has
2021the `patch_set` field set, and no `author`.
2022
2023.Request
2024----
2025 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
2026----
2027
2028.Response
2029----
2030 HTTP/1.1 200 OK
2031 Content-Disposition: attachment
2032 Content-Type: application/json; charset=UTF-8
2033
2034 )]}'
2035 {
2036 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2037 {
2038 "patch_set": 1,
2039 "id": "TvcXrmjM",
2040 "line": 23,
2041 "message": "[nit] trailing whitespace",
2042 "updated": "2013-02-26 15:40:43.986000000"
2043 },
2044 {
2045 "patch_set": 2,
2046 "id": "TveXwFiA",
2047 "line": 49,
2048 "in_reply_to": "TfYX-Iuo",
2049 "message": "Done",
2050 "updated": "2013-02-26 15:40:45.328000000"
2051 }
2052 ]
2053 }
2054----
2055
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002056[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002057=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002058--
2059'GET /changes/link:#change-id[\{change-id\}]/check'
2060--
2061
2062Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05002063link:#change-info[ChangeInfo] entity with the `problems` field set to a
2064list of link:#problem-info[ProblemInfo] entities.
2065
2066Depending on the type of problem, some fields not marked optional may be
2067missing from the result. At least `id`, `project`, `branch`, and
2068`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002069
2070.Request
2071----
2072 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2073----
2074
2075.Response
2076----
2077 HTTP/1.1 200 OK
2078 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002079 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002080
2081 )]}'
2082 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05002083 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2084 "project": "myProject",
2085 "branch": "master",
2086 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2087 "subject": "Implementing Feature X",
2088 "status": "NEW",
2089 "created": "2013-02-01 09:59:32.126000000",
2090 "updated": "2013-02-21 11:16:36.775000000",
2091 "mergeable": true,
2092 "insertions": 34,
2093 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05002094 "_number": 3965,
2095 "owner": {
2096 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002097 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05002098 "problems": [
2099 {
2100 "message": "Current patch set 1 not found"
2101 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002102 ]
2103 }
2104----
2105
Dave Borowitz3be39d02014-12-03 17:57:38 -08002106[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002107=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08002108--
2109'POST /changes/link:#change-id[\{change-id\}]/check'
2110--
2111
2112Performs consistency checks on the change as with link:#check-change[GET
2113/check], and additionally fixes any problems that can be fixed
2114automatically. The returned field values reflect any fixes.
2115
Dave Borowitzbad53ee2015-06-11 10:10:18 -04002116Some fixes have options controlling their behavior, which can be set in the
2117link:#fix-input[FixInput] entity body.
2118
Dave Borowitz3be39d02014-12-03 17:57:38 -08002119Only the change owner, a project owner, or an administrator may fix changes.
2120
2121.Request
2122----
2123 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2124----
2125
2126.Response
2127----
2128 HTTP/1.1 200 OK
2129 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002130 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08002131
2132 )]}'
2133 {
2134 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2135 "project": "myProject",
2136 "branch": "master",
2137 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2138 "subject": "Implementing Feature X",
2139 "status": "MERGED",
2140 "created": "2013-02-01 09:59:32.126000000",
2141 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002142 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08002143 "mergeable": true,
2144 "insertions": 34,
2145 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08002146 "_number": 3965,
2147 "owner": {
2148 "name": "John Doe"
2149 },
2150 "problems": [
2151 {
2152 "message": "Current patch set 2 not found"
2153 },
2154 {
2155 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
2156 "status": FIXED,
2157 "outcome": "Marked change as merged"
2158 }
2159 ]
2160 }
2161----
2162
Alan Tokaev392cfca2017-04-28 11:11:31 +02002163[[set-work-in-pogress]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002164=== Set Work-In-Progress
Alan Tokaev392cfca2017-04-28 11:11:31 +02002165--
2166'POST /changes/link:#change-id[\{change-id\}]/wip'
2167--
2168
David Ostrovsky44242452018-06-09 20:25:13 +02002169Marks the change as not ready for review yet. Changes may only be marked not
2170ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002171
2172The request body does not need to include a
2173link:#work-in-progress-input[WorkInProgressInput] entity if no review comment
2174is added. Actions that create a new patch set in a WIP change default to
2175notifying *OWNER* instead of *ALL*.
2176
2177.Request
2178----
2179 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/wip HTTP/1.0
2180 Content-Type: application/json; charset=UTF-8
2181
2182 {
2183 "message": "Refactoring needs to be done before we can proceed here."
2184 }
2185----
2186
2187.Response
2188----
2189 HTTP/1.1 200 OK
2190----
2191
2192[[set-ready-for-review]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002193=== Set Ready-For-Review
Alan Tokaev392cfca2017-04-28 11:11:31 +02002194--
2195'POST /changes/link:#change-id[\{change-id\}]/ready'
2196--
2197
David Ostrovsky44242452018-06-09 20:25:13 +02002198Marks the change as ready for review (set WIP property to false). Changes may
2199only be marked ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002200
2201Activates notifications of reviewer. The request body does not need
2202to include a link:#work-in-progress-input[WorkInProgressInput] entity
2203if no review comment is added.
2204
2205.Request
2206----
2207 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ready HTTP/1.0
2208 Content-Type: application/json;charset=UTF-8
2209
2210 {
2211 "message": "Refactoring is done."
2212 }
2213
2214----
2215
2216.Response
2217----
2218 HTTP/1.1 200 OK
2219----
2220
David Pursehouse7c5c3a52017-04-10 11:37:23 +09002221[[mark-private]]
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002222=== Mark Private
2223--
Edwin Kempin364a86b2017-04-27 12:34:00 +02002224'POST /changes/link:#change-id[\{change-id\}]/private'
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002225--
2226
Patrick Hiesel707e61a2019-02-13 18:28:48 +01002227Marks the change to be private. Only open changes can be marked private.
2228Changes may only be marked private by the owner or site administrators.
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002229
Edwin Kempin364a86b2017-04-27 12:34:00 +02002230A message can be specified in the request body inside a
2231link:#private-input[PrivateInput] entity.
2232
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002233.Request
2234----
Edwin Kempin364a86b2017-04-27 12:34:00 +02002235 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2236 Content-Type: application/json; charset=UTF-8
2237
2238 {
2239 "message": "After this security fix has been released we can make it public now."
2240 }
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002241----
2242
2243.Response
2244----
2245 HTTP/1.1 201 Created
2246----
2247
2248If the change was already private the response is "`200 OK`".
2249
2250[[unmark-private]]
2251=== Unmark Private
2252--
2253'DELETE /changes/link:#change-id[\{change-id\}]/private'
2254--
2255
2256Marks the change to be non-private. Note users can only unmark own private
2257changes.
2258
2259.Request
2260----
2261 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2262----
2263
2264.Response
2265----
2266 HTTP/1.1 204 No Content
2267----
2268
2269If the change was already not private, the response is "`409 Conflict`".
2270
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002271A message can be specified in the request body inside a
2272link:#private-input[PrivateInput] entity. Historically, this method allowed
2273a body in the DELETE, but that behavior is
2274link:https://www.gerritcodereview.com/releases/2.16.md[deprecated].
2275In this case, use a POST request instead:
Edwin Kempin364a86b2017-04-27 12:34:00 +02002276
2277.Request
2278----
2279 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private.delete HTTP/1.0
2280 Content-Type: application/json; charset=UTF-8
2281
2282 {
2283 "message": "This is a security fix that must not be public."
2284 }
2285----
2286
David Pursehoused656fa82017-04-28 06:51:26 +02002287[[ignore]]
2288=== Ignore
2289--
2290'PUT /changes/link:#change-id[\{change-id\}]/ignore'
2291--
2292
2293Marks a change as ignored. The change will not be shown in the incoming
David Pursehouseaa51cba2018-07-09 11:02:17 +09002294reviews dashboard, and email notifications will be suppressed. Ignoring
2295a change does not cause the change's "updated" timestamp to be modified,
2296and the owner is not notified.
David Pursehoused656fa82017-04-28 06:51:26 +02002297
2298.Request
2299----
2300 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ignore HTTP/1.0
2301----
2302
2303[[unignore]]
2304=== Unignore
2305--
2306'PUT /changes/link:#change-id[\{change-id\}]/unignore'
2307--
2308
2309Un-marks a change as ignored.
2310
2311.Request
2312----
2313 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unignore HTTP/1.0
2314----
2315
Edwin Kempinceb673e2017-10-01 12:29:05 +02002316[[mark-as-reviewed]]
2317=== Mark as Reviewed
2318--
2319'PUT /changes/link:#change-id[\{change-id\}]/reviewed'
2320--
2321
2322Marks a change as reviewed.
2323
2324This allows users to "de-highlight" changes in their dashboard until a new
2325patch set is uploaded.
2326
2327This differs from the link:#ignore[ignore] endpoint, which will mute
2328emails and hide the change from dashboard completely until it is
2329link:#unignore[unignored] again.
2330
2331
2332.Request
2333----
2334 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewed HTTP/1.0
2335----
2336
2337[[mark-as-unreviewed]]
2338=== Mark as Unreviewed
2339--
2340'PUT /changes/link:#change-id[\{change-id\}]/unreviewed'
2341--
2342
2343Marks a change as unreviewed.
2344
2345This allows users to "highlight" changes in their dashboard
2346
2347.Request
2348----
2349 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unreviewed HTTP/1.0
2350----
2351
David Pursehouse7c79b682017-08-25 13:18:32 +09002352[[get-hashtags]]
2353=== Get Hashtags
2354--
2355'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2356--
2357
2358Gets the hashtags associated with a change.
2359
David Pursehouse7c79b682017-08-25 13:18:32 +09002360.Request
2361----
2362 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2363----
2364
2365As response the change's hashtags are returned as a list of strings.
2366
2367.Response
2368----
2369 HTTP/1.1 200 OK
2370 Content-Disposition: attachment
2371 Content-Type: application/json; charset=UTF-8
2372
2373 )]}'
2374 [
2375 "hashtag1",
2376 "hashtag2"
2377 ]
2378----
2379
2380[[set-hashtags]]
2381=== Set Hashtags
2382--
2383'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2384--
2385
2386Adds and/or removes hashtags from a change.
2387
David Pursehouse7c79b682017-08-25 13:18:32 +09002388The hashtags to add or remove must be provided in the request body inside a
2389link:#hashtags-input[HashtagsInput] entity.
2390
2391.Request
2392----
2393 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2394 Content-Type: application/json; charset=UTF-8
2395
2396 {
2397 "add" : [
2398 "hashtag3"
2399 ],
2400 "remove" : [
2401 "hashtag2"
2402 ]
2403 }
2404----
2405
2406As response the change's hashtags are returned as a list of strings.
2407
2408.Response
2409----
2410 HTTP/1.1 200 OK
2411 Content-Disposition: attachment
2412 Content-Type: application/json; charset=UTF-8
2413
2414 )]}'
2415 [
2416 "hashtag1",
2417 "hashtag3"
2418 ]
2419----
2420
Changcheng Xiao7fb73292018-04-25 11:43:19 +02002421[[list-change-messages]]
2422=== List Change Messages
2423--
2424'GET /changes/link:#change-id[\{change-id\}]/messages'
2425--
2426
2427Lists all the messages of a change including link:#detailed-accounts[detailed account information].
2428
2429.Request
2430----
2431 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages
2432----
2433
2434As response a list of link:#change-message-info[ChangeMessageInfo] entities is returned.
2435
2436.Response
2437----
2438 HTTP/1.1 200 OK
2439 Content-Disposition: attachment
2440 Content-Type: application/json; charset=UTF-8
2441
2442 )]}'
2443 [
2444 {
2445 "id": "YH-egE",
2446 "author": {
2447 "_account_id": 1000096,
2448 "name": "John Doe",
2449 "email": "john.doe@example.com",
2450 "username": "jdoe"
2451 },
2452 "date": "2013-03-23 21:34:02.419000000",
2453 "message": "Patch Set 1:\n\nThis is the first message.",
2454 "_revision_number": 1
2455 },
2456 {
2457 "id": "WEEdhU",
2458 "author": {
2459 "_account_id": 1000097,
2460 "name": "Jane Roe",
2461 "email": "jane.roe@example.com",
2462 "username": "jroe"
2463 },
2464 "date": "2013-03-23 21:36:52.332000000",
2465 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
2466 "_revision_number": 1
2467 }
2468 ]
2469----
David Pursehousec32050d2017-08-25 16:27:47 +09002470
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002471[[get-change-message]]
2472=== Get Change Message
2473
2474Retrieves a change message including link:#detailed-accounts[detailed account information].
2475
2476--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002477'GET /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]'
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002478--
2479
2480As response a link:#change-message-info[ChangeMessageInfo] entity is returned.
2481
2482.Response
2483----
2484 HTTP/1.1 200 OK
2485 Content-Disposition: attachment
2486 Content-Type: application/json; charset=UTF-8
2487
2488 )]}'
2489 {
2490 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2491 "author": {
2492 "_account_id": 1000096,
2493 "name": "John Doe",
2494 "email": "john.doe@example.com",
2495 "username": "jdoe"
2496 },
2497 "date": "2013-03-23 21:34:02.419000000",
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002498 "message": "a change message",
2499 "_revision_number": 1
2500 }
2501----
2502
2503[[delete-change-message]]
2504=== Delete Change Message
2505--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002506'DELETE /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]' +
2507'POST /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]/delete'
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002508--
2509
2510Deletes a change message by replacing the change message with a new message,
2511which contains the name of the user who deleted the change message and the
2512reason why it was deleted. The reason can be provided in the request body as a
2513link:#delete-change-message-input[DeleteChangeMessageInput] entity.
2514
2515Note that only users with the
2516link:access-control.html#capability_administrateServer[Administrate Server]
2517global capability are permitted to delete a change message.
2518
2519To delete a change message, send a DELETE request:
2520
2521.Request
2522----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002523 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780 HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002524----
2525
2526To provide a reason for the deletion, use a POST request:
2527
2528.Request
2529----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002530 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780/delete HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002531 Content-Type: application/json; charset=UTF-8
2532
2533 {
2534 "reason": "spam"
2535 }
2536----
2537
2538As response a link:#change-message-info[ChangeMessageInfo] entity is returned that
2539describes the updated change message.
2540
2541.Response
2542----
2543 HTTP/1.1 200 OK
2544 Content-Disposition: attachment
2545 Content-Type: application/json; charset=UTF-8
2546
2547 )]}'
2548 {
2549 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2550 "author": {
2551 "_account_id": 1000096,
2552 "name": "John Doe",
2553 "email": "john.doe@example.com",
2554 "username": "jdoe"
2555 },
2556 "date": "2013-03-23 21:34:02.419000000",
2557 "message": "Change message removed by: Administrator\nReason: spam",
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002558 "_revision_number": 1
2559 }
2560----
Gustaf Lundhe8647c62017-04-28 06:51:26 +02002561
David Ostrovsky1a49f622014-07-29 00:40:02 +02002562[[edit-endpoints]]
2563== Change Edit Endpoints
2564
David Ostrovsky1a49f622014-07-29 00:40:02 +02002565[[get-edit-detail]]
2566=== Get Change Edit Details
2567--
2568'GET /changes/link:#change-id[\{change-id\}]/edit
2569--
2570
2571Retrieves a change edit details.
2572
2573.Request
2574----
2575 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2576----
2577
2578As response an link:#edit-info[EditInfo] entity is returned that
2579describes the change edit, or "`204 No Content`" when change edit doesn't
2580exist for this change. Change edits are stored on special branches and there
2581can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002582When request parameter `list` is provided the response also includes the file
2583list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002584against this base revision. When request parameter `download-commands` is
2585provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002586
2587.Response
2588----
2589 HTTP/1.1 200 OK
2590 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002591 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002592
2593 )]}'
2594 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002595 "commit": {
2596 "parents": [
David Ostrovsky1a49f622014-07-29 00:40:02 +02002597 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002598 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
David Ostrovsky1a49f622014-07-29 00:40:02 +02002599 }
2600 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01002601 "author": {
2602 "name": "Shawn O. Pearce",
2603 "email": "sop@google.com",
2604 "date": "2012-04-24 18:08:08.000000000",
2605 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002606 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002607 "committer": {
2608 "name": "Shawn O. Pearce",
2609 "email": "sop@google.com",
2610 "date": "2012-04-24 18:08:08.000000000",
2611 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002612 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002613 "subject": "Use an EventBus to manage star icons",
2614 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
David Ostrovsky1a49f622014-07-29 00:40:02 +02002615 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002616 "base_patch_set_number": 1,
2617 "base_revision": "c35558e0925e6985c91f3a16921537d5e572b7a3",
2618 "ref": "refs/users/01/1000001/edit-76482/1"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002619 }
2620----
David Pursehouse4e38b972014-05-30 10:36:40 +09002621
David Ostrovskya5ab8292014-08-01 02:11:39 +02002622[[put-edit-file]]
2623=== Change file content in Change Edit
2624--
2625'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2626--
2627
2628Put content of a file to a change edit.
2629
2630.Request
2631----
2632 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2633----
2634
2635When change edit doesn't exist for this change yet it is created. When file
2636content isn't provided, it is wiped out for that file. As response
2637"`204 No Content`" is returned.
2638
2639.Response
2640----
2641 HTTP/1.1 204 No Content
2642----
2643
Gal Paikin68d217b2019-10-07 21:01:22 +02002644When the change edit is a no-op, for example when providing the same file
2645content that the file already has, '409 no changes were made' is returned.
2646
2647.Response
2648----
2649 HTTP/1.1 409 no changes were made
2650----
2651
David Ostrovsky138edb42014-08-15 21:31:43 +02002652[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002653=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002654--
2655'POST /changes/link:#change-id[\{change-id\}]/edit
2656--
2657
David Ostrovskya00c9532015-01-21 00:17:49 +01002658Creates empty change edit, restores file content or renames files in change
2659edit. The request body needs to include a
2660link:#change-edit-input[ChangeEditInput] entity when a file within change
2661edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002662
2663.Request
2664----
2665 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002666 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002667
2668 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002669 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002670 }
2671----
2672
David Ostrovskya00c9532015-01-21 00:17:49 +01002673or for rename:
2674
2675.Request
2676----
2677 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2678 Content-Type: application/json; charset=UTF-8
2679
2680 {
2681 "old_path": "foo",
2682 "new_path": "bar"
2683 }
2684----
2685
David Ostrovsky138edb42014-08-15 21:31:43 +02002686When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01002687and restore flag are provided in request body, this file is restored. When
2688old and new file names are provided, the file is renamed. As response
2689"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02002690
2691.Response
2692----
2693 HTTP/1.1 204 No Content
2694----
2695
David Ostrovskyc967e152014-10-24 17:36:16 +02002696[[put-change-edit-message]]
2697=== Change commit message in Change Edit
2698--
2699'PUT /changes/link:#change-id[\{change-id\}]/edit:message
2700--
2701
2702Modify commit message. The request body needs to include a
2703link:#change-edit-message-input[ChangeEditMessageInput]
2704entity.
2705
2706.Request
2707----
2708 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002709 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02002710
2711 {
2712 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
2713 }
2714----
2715
2716If a change edit doesn't exist for this change yet, it is created. As
2717response "`204 No Content`" is returned.
2718
2719.Response
2720----
2721 HTTP/1.1 204 No Content
2722----
2723
David Ostrovsky2830c292014-08-01 02:24:31 +02002724[[delete-edit-file]]
2725=== Delete file in Change Edit
2726--
2727'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
2728--
2729
2730Deletes a file from a change edit. This deletes the file from the repository
2731completely. This is not the same as reverting or restoring a file to its
2732previous contents.
2733
2734.Request
2735----
2736 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2737----
2738
2739When change edit doesn't exist for this change yet it is created.
2740
2741.Response
2742----
2743 HTTP/1.1 204 No Content
2744----
2745
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002746[[get-edit-file]]
2747=== Retrieve file content from Change Edit
2748--
2749'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2750--
2751
2752Retrieves content of a file from a change edit.
2753
2754.Request
2755----
2756 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2757----
2758
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002759The content of the file is returned as text encoded inside base64.
2760The Content-Type header will always be `text/plain` reflecting the
2761outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
2762can be examined to find the server detected content type of the file.
2763
2764When the specified file was deleted in the change edit
2765"`204 No Content`" is returned.
2766
2767If only the content type is required, callers should use HEAD to
2768avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002769
Michael Zhou551ad0c2016-04-26 01:21:42 -04002770If the `base` parameter is set to true, the returned content is from the
2771revision that the edit is based on.
2772
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002773.Response
2774----
2775 HTTP/1.1 200 OK
2776 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002777 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002778 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002779 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002780
2781 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
2782----
2783
David Ostrovskyd0078672015-02-06 21:51:04 +01002784Alternatively, if the only value of the Accept request header is
2785`application/json` the content is returned as JSON string and
2786`X-FYI-Content-Encoding` is set to `json`.
2787
David Ostrovsky9ea9c112015-01-25 00:12:38 +01002788[[get-edit-meta-data]]
2789=== Retrieve meta data of a file from Change Edit
2790--
2791'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
2792--
2793
2794Retrieves meta data of a file from a change edit. Currently only
2795web links are returned.
2796
2797.Request
2798----
2799 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
2800----
2801
2802This REST endpoint retrieves additional information for a file in a
2803change edit. As result an link:#edit-file-info[EditFileInfo] entity is
2804returned.
2805
2806.Response
2807----
2808 HTTP/1.1 200 OK
2809 Content-Disposition: attachment
2810 Content-Type: application/json; charset=UTF-8
2811
2812 )]}'
2813 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002814 "web_links": [
David Ostrovsky9ea9c112015-01-25 00:12:38 +01002815 {
2816 "show_on_side_by_side_diff_view": true,
2817 "name": "side-by-side preview diff",
2818 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
2819 "url": "#/x/xdocs/c/42/1..0/README.md",
2820 "target": "_self"
2821 },
2822 {
2823 "show_on_unified_diff_view": true,
2824 "name": "unified preview diff",
2825 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
2826 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
2827 "target": "_self"
2828 }
2829 ]}
2830----
2831
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002832[[get-edit-message]]
2833=== Retrieve commit message from Change Edit or current patch set of the change
2834--
2835'GET /changes/link:#change-id[\{change-id\}]/edit:message
2836--
2837
David Ostrovsky25ad15e2014-12-15 21:18:59 +01002838Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002839
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02002840If the `base` parameter is set to true, the returned message is from the
2841revision that the edit is based on.
2842
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002843.Request
2844----
2845 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
2846----
2847
2848The commit message is returned as base64 encoded string.
2849
2850.Response
2851----
2852 HTTP/1.1 200 OK
2853
2854 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
2855M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
2856----
2857
David Ostrovskyd0078672015-02-06 21:51:04 +01002858Alternatively, if the only value of the Accept request header is
2859`application/json` the commit message is returned as JSON string:
2860
2861.Response
2862----
2863 HTTP/1.1 200 OK
2864
2865)]}'
2866"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
2867----
2868
2869
David Ostrovskye9988f92014-08-01 09:56:34 +02002870[[publish-edit]]
2871=== Publish Change Edit
2872--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002873'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02002874--
2875
2876Promotes change edit to a regular patch set.
2877
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002878Options can be provided in the request body as a
2879link:#publish-change-edit-input[PublishChangeEditInput] entity.
2880
David Ostrovskye9988f92014-08-01 09:56:34 +02002881.Request
2882----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002883 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002884 Content-Type: application/json; charset=UTF-8
2885
2886 {
2887 "notify": "NONE"
2888 }
David Ostrovskye9988f92014-08-01 09:56:34 +02002889----
2890
2891As response "`204 No Content`" is returned.
2892
2893.Response
2894----
2895 HTTP/1.1 204 No Content
2896----
2897
David Ostrovsky46999d22014-08-16 02:19:13 +02002898[[rebase-edit]]
2899=== Rebase Change Edit
2900--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002901'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02002902--
2903
2904Rebases change edit on top of latest patch set.
2905
2906.Request
2907----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002908 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02002909----
2910
2911When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09002912"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02002913based on top of the latest patch set, the response
2914"`409 Conflict`" is returned.
2915
2916.Response
2917----
2918 HTTP/1.1 204 No Content
2919----
2920
David Ostrovsky8e75f502014-08-10 00:36:31 +02002921[[delete-edit]]
2922=== Delete Change Edit
2923--
2924'DELETE /changes/link:#change-id[\{change-id\}]/edit'
2925--
2926
2927Deletes change edit.
2928
2929.Request
2930----
2931 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2932----
2933
2934As response "`204 No Content`" is returned.
2935
2936.Response
2937----
2938 HTTP/1.1 204 No Content
2939----
2940
Edwin Kempin9a9f1c02017-01-02 15:10:49 +01002941
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002942[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002943== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002944
2945[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002946=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002947--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002948'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002949--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002950
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002951Lists the reviewers of a change.
2952
2953As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
2954
2955.Request
2956----
2957 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
2958----
2959
2960.Response
2961----
2962 HTTP/1.1 200 OK
2963 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002964 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002965
2966 )]}'
2967 [
2968 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002969 "approvals": {
2970 "Verified": "+1",
2971 "Code-Review": "+2"
2972 },
2973 "_account_id": 1000096,
2974 "name": "John Doe",
2975 "email": "john.doe@example.com"
2976 },
2977 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002978 "approvals": {
2979 "Verified": " 0",
2980 "Code-Review": "-1"
2981 },
2982 "_account_id": 1000097,
2983 "name": "Jane Roe",
2984 "email": "jane.roe@example.com"
2985 }
2986 ]
2987----
2988
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002989[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002990=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002991--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002992'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002993--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002994
2995Suggest the reviewers for a given query `q` and result limit `n`. If result
2996limit is not passed, then the default 10 is used.
2997
Edwin Kempin2639eaa2019-08-27 09:47:27 +02002998This REST endpoint only suggests accounts that
2999
3000* are active
3001* can see the change
3002* are visible to the calling user
3003* are not already reviewer on the change
3004* don't own the change
3005
Edwin Kempinec02a552019-08-27 09:30:15 +02003006Groups can be excluded from the results by specifying the 'exclude-groups'
3007request parameter:
3008
3009--
3010'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5&exclude-groups'
3011--
Patrick Hieselc79ae0e2017-06-28 14:50:53 +02003012
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003013As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
3014
3015.Request
3016----
3017 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
3018----
3019
3020.Response
3021----
3022 HTTP/1.1 200 OK
3023 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003024 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003025
3026 )]}'
3027 [
3028 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003029 "account": {
3030 "_account_id": 1000097,
3031 "name": "Jane Roe",
3032 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003033 },
3034 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003035 },
3036 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003037 "group": {
3038 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
3039 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003040 },
3041 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003042 }
3043 ]
3044----
3045
Edwin Kempin0ca3f722019-08-27 09:43:31 +02003046To suggest CCs `reviewer-state=CC` can be specified as additional URL
3047parameter. This includes existing reviewers in the result, but excludes
3048existing CCs.
3049
3050--
3051'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&reviewer-state=CC'
3052--
3053
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003054[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003055=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003056--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003057'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 -08003058--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003059
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003060Retrieves a reviewer of a change.
3061
3062As response a link:#reviewer-info[ReviewerInfo] entity is returned that
3063describes the reviewer.
3064
3065.Request
3066----
3067 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
3068----
3069
3070.Response
3071----
3072 HTTP/1.1 200 OK
3073 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003074 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003075
3076 )]}'
3077 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003078 "approvals": {
3079 "Verified": "+1",
3080 "Code-Review": "+2"
3081 },
3082 "_account_id": 1000096,
3083 "name": "John Doe",
3084 "email": "john.doe@example.com"
3085 }
3086----
3087
Edwin Kempin392328e2013-02-25 12:50:03 +01003088[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003089=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003090--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003091'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003092--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003093
Edwin Kempin392328e2013-02-25 12:50:03 +01003094Adds one user or all members of one group as reviewer to the change.
3095
3096The reviewer to be added to the change must be provided in the request
3097body as a link:#reviewer-input[ReviewerInput] entity.
3098
Edwin Kempinf9f19412019-08-28 09:28:51 +02003099Users can be moved from reviewer to CC and vice versa. This means if a
3100user is added as CC that is already a reviewer on the change, the
3101reviewer state of that user is updated to CC. If a user that is already
3102a CC on the change is added as reviewer, the reviewer state of that
3103user is updated to reviewer.
3104
Edwin Kempin392328e2013-02-25 12:50:03 +01003105.Request
3106----
3107 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003108 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003109
3110 {
3111 "reviewer": "john.doe@example.com"
3112 }
3113----
3114
3115As response an link:#add-reviewer-result[AddReviewerResult] entity is
3116returned that describes the newly added reviewers.
3117
3118.Response
3119----
3120 HTTP/1.1 200 OK
3121 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003122 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003123
3124 )]}'
3125 {
Aaron Gable8c650212017-04-25 12:03:37 -07003126 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01003127 "reviewers": [
3128 {
Aaron Gable8c650212017-04-25 12:03:37 -07003129 "_account_id": 1000096,
3130 "name": "John Doe",
3131 "email": "john.doe@example.com"
Edwin Kempin392328e2013-02-25 12:50:03 +01003132 "approvals": {
3133 "Verified": " 0",
3134 "Code-Review": " 0"
3135 },
Edwin Kempin392328e2013-02-25 12:50:03 +01003136 }
3137 ]
3138 }
3139----
3140
3141If a group is specified, adding the group members as reviewers is an
3142atomic operation. This means if an error is returned, none of the
3143members are added as reviewer.
3144
3145If a group with many members is added as reviewer a confirmation may be
3146required.
3147
Edwin Kempinf9f19412019-08-28 09:28:51 +02003148If a group is added as CC and members of this group are already
3149reviewers on the change, these members stay reviewers on the change
3150(they are not downgraded to CC). However if a group is added as
3151reviewer, all group members become reviewer of the change, even if they
3152have been added as CC before.
3153
Edwin Kempin392328e2013-02-25 12:50:03 +01003154.Request
3155----
3156 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003157 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003158
3159 {
3160 "reviewer": "MyProjectVerifiers"
3161 }
3162----
3163
3164.Response
3165----
3166 HTTP/1.1 200 OK
3167 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003168 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003169
3170 )]}'
3171 {
Logan Hanks23e70282016-07-06 14:31:56 -07003172 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01003173 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3174 "confirm": true
3175 }
3176----
3177
3178To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01003179`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01003180
3181.Request
3182----
3183 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003184 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003185
3186 {
Logan Hanks23e70282016-07-06 14:31:56 -07003187 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01003188 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01003189 }
3190----
3191
Patrick Hiesel11873ef2017-03-17 17:36:05 +01003192If link:config-project-config.html#reviewer.enableByEmail[reviewer.enableByEmail] is set
3193for the project, reviewers and CCs are not required to have a Gerrit account. If you POST
3194an email address of a reviewer or CC then, they will be added to the change even if they
3195don't have a Gerrit account.
3196
3197If this option is disabled, the request would fail with `400 Bad Request` if the email
3198address can't be resolved to an active Gerrit account.
3199
3200Note that the name is optional so both "un.registered@reviewer.com" and
3201"John Doe <un.registered@reviewer.com>" are valid inputs.
3202
3203Reviewers without Gerrit accounts can only be added on changes visible to anonymous users.
3204
3205.Request
3206----
3207 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
3208 Content-Type: application/json; charset=UTF-8
3209
3210 {
3211 "reviewer": "John Doe <un.registered@reviewer.com>"
3212 }
3213----
3214
3215.Response
3216----
3217 HTTP/1.1 200 OK
3218 Content-Disposition: attachment
3219 Content-Type: application/json; charset=UTF-8
3220
3221 )]}'
3222 {
3223 "input": "John Doe <un.registered@reviewer.com>"
3224 }
3225----
3226
Logan Hanksf03040e2017-05-03 09:40:56 -07003227.Notifications
3228
3229An email will be sent using the "newchange" template.
3230
3231[options="header",cols="1,1,1"]
3232|=============================
3233|WIP State |Default|notify=ALL
3234|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
3235|Work in progress|not sent|owner, reviewers, CCs
3236|=============================
3237
Edwin Kempin53301072013-02-25 12:57:07 +01003238[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003239=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003240--
Edwin Kempin407fca32016-08-29 12:01:00 +02003241'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
3242'POST /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003243--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003244
Edwin Kempin53301072013-02-25 12:57:07 +01003245Deletes a reviewer from a change.
3246
3247.Request
3248----
3249 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02003250 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3251----
3252
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003253Options can be provided in the request body as a
3254link:#delete-reviewer-input[DeleteReviewerInput] entity.
3255Historically, this method allowed a body in the DELETE, but that behavior is
3256link:https://www.gerritcodereview.com/releases/2.16.md[deprecated].
3257In this case, use a POST request instead:
Edwin Kempin407fca32016-08-29 12:01:00 +02003258
3259.Request
3260----
3261 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3262 Content-Type: application/json; charset=UTF-8
3263
3264 {
3265 "notify": "NONE"
3266 }
Edwin Kempin53301072013-02-25 12:57:07 +01003267----
3268
3269.Response
3270----
3271 HTTP/1.1 204 No Content
3272----
3273
Logan Hanks87607412017-05-30 13:49:04 -07003274.Notifications
3275
3276An email will be sent using the "deleteReviewer" template. If deleting the
3277reviewer resulted in one or more approvals being removed, then the deleted
3278reviewer will also receive a notification (unless notify=NONE).
3279
3280[options="header",cols="1,5"]
3281|=============================
3282|WIP State |Default Recipients
3283|Ready for review|notify=ALL: deleted reviewer (if voted), owner, reviewers, CCs, stars, ALL_COMMENTS watchers
3284|Work in progress|notify=NONE: deleted reviewer (if voted)
3285|=============================
3286
David Ostrovskybeb0b842014-12-13 00:24:29 +01003287[[list-votes]]
3288=== List Votes
3289--
3290'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
3291--
3292
3293Lists the votes for a specific reviewer of the change.
3294
3295.Request
3296----
Edwin Kempin314f10a2016-07-11 11:39:05 +02003297 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01003298----
3299
3300As result a map is returned that maps the label name to the label value.
3301The entries in the map are sorted by label name.
3302
3303.Response
3304----
3305 HTTP/1.1 200 OK
3306 Content-Disposition: attachment
3307 Content-Type: application/json;charset=UTF-8
3308
3309 )]}'
3310 {
3311 "Code-Review": -1,
3312 "Verified": 1
3313 "Work-In-Progress": 1,
3314 }
3315----
3316
3317[[delete-vote]]
3318=== Delete Vote
3319--
Edwin Kempin5488dc12016-08-29 11:13:31 +02003320'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
Edwin Kempin32a7c532016-06-22 07:58:32 +02003321'POST /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
David Ostrovskybeb0b842014-12-13 00:24:29 +01003322--
3323
3324Deletes a single vote from a change. Note, that even when the last vote of
3325a reviewer is removed the reviewer itself is still listed on the change.
3326
3327.Request
3328----
3329 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003330 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3331----
3332
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003333Options can be provided in the request body as a
3334link:#delete-vote-input[DeleteVoteInput] entity.
3335Historically, this method allowed a body in the DELETE, but that behavior is
3336link:https://www.gerritcodereview.com/releases/2.16.md[deprecated].
3337In this case, use a POST request instead:
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003338
3339.Request
3340----
3341 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3342 Content-Type: application/json; charset=UTF-8
3343
3344 {
3345 "notify": "NONE"
3346 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01003347----
3348
3349.Response
3350----
3351 HTTP/1.1 204 No Content
3352----
3353
Logan Hanksa1e68dc2017-06-29 15:13:27 -07003354
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003355[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003356== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003357
Shawn Pearce728ba882013-07-08 23:13:08 -07003358[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003359=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003360--
Shawn Pearce728ba882013-07-08 23:13:08 -07003361'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003362--
Shawn Pearce728ba882013-07-08 23:13:08 -07003363
3364Retrieves a parsed commit of a revision.
3365
3366.Request
3367----
3368 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
3369----
3370
3371As response a link:#commit-info[CommitInfo] entity is returned that
3372describes the revision.
3373
3374.Response
3375----
3376 HTTP/1.1 200 OK
3377 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003378 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07003379
3380 )]}'
3381 {
Edwin Kempinc8237402015-07-15 18:27:55 +02003382 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07003383 "parents": [
3384 {
3385 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3386 "subject": "Migrate contributor agreements to All-Projects."
3387 }
3388 ],
3389 "author": {
3390 "name": "Shawn O. Pearce",
3391 "email": "sop@google.com",
3392 "date": "2012-04-24 18:08:08.000000000",
3393 "tz": -420
3394 },
3395 "committer": {
3396 "name": "Shawn O. Pearce",
3397 "email": "sop@google.com",
3398 "date": "2012-04-24 18:08:08.000000000",
3399 "tz": -420
3400 },
3401 "subject": "Use an EventBus to manage star icons",
3402 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3403 }
3404----
3405
Sven Selbergd26bd542014-11-21 16:28:10 +01003406Adding query parameter `links` (for example `/changes/.../commit?links`)
3407returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07003408
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08003409[[get-description]]
3410=== Get Description
3411--
3412'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3413--
3414
3415Retrieves the description of a patch set.
3416
3417.Request
3418----
3419 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3420----
3421
3422.Response
3423----
3424 HTTP/1.1 200 OK
3425 Content-Disposition: attachment
3426 Content-Type: application/json; charset=UTF-8
3427
3428 )]}'
3429 "Added Documentation"
3430----
3431
3432If the patch set does not have a description an empty string is returned.
3433
3434[[set-description]]
3435=== Set Description
3436--
3437'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3438--
3439
3440Sets the description of a patch set.
3441
3442The new description must be provided in the request body inside a
3443link:#description-input[DescriptionInput] entity.
3444
3445.Request
3446----
3447 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3448 Content-Type: application/json; charset=UTF-8
3449
3450 {
3451 "description": "Added Documentation"
3452 }
3453----
3454
3455As response the new description is returned.
3456
3457.Response
3458----
3459 HTTP/1.1 200 OK
3460 Content-Disposition: attachment
3461 Content-Type: application/json; charset=UTF-8
3462
3463 )]}'
3464 "Added Documentation"
3465----
3466
Edwin Kempin0f229442016-09-09 13:06:12 +02003467[[get-merge-list]]
3468=== Get Merge List
3469--
3470'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
3471--
3472
3473Returns the list of commits that are being integrated into a target
3474branch by a merge commit. By default the first parent is assumed to be
3475uninteresting. By using the `parent` option another parent can be set
3476as uninteresting (parents are 1-based).
3477
3478The list of commits is returned as a list of
3479link:#commit-info[CommitInfo] entities. Web links are only included if
3480the `links` option was set.
3481
3482.Request
3483----
3484 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
3485----
3486
3487.Response
3488----
3489HTTP/1.1 200 OK
3490 Content-Disposition: attachment
3491 Content-Type: application/json; charset=UTF-8
3492
3493 )]}'
3494 [
3495 {
3496 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
3497 "parents": [
3498 {
3499 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3500 "subject": "Migrate contributor agreements to All-Projects."
3501 }
3502 ],
3503 "author": {
3504 "name": "Shawn O. Pearce",
3505 "email": "sop@google.com",
3506 "date": "2012-04-24 18:08:08.000000000",
3507 "tz": -420
3508 },
3509 "committer": {
3510 "name": "Shawn O. Pearce",
3511 "email": "sop@google.com",
3512 "date": "2012-04-24 18:08:08.000000000",
3513 "tz": -420
3514 },
3515 "subject": "Use an EventBus to manage star icons",
3516 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3517 }
3518 ]
3519----
3520
Stefan Bellerc7259662015-02-12 17:23:05 -08003521[[get-revision-actions]]
3522=== Get Revision Actions
3523--
3524'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
3525--
3526
3527Retrieves revision link:#action-info[actions] of the revision of a change.
3528
3529.Request
3530----
3531 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
3532----
3533
3534.Response
3535----
3536 HTTP/1.1 200 OK
3537 Content-Disposition: attachment
3538 Content-Type: application/json; charset=UTF-8
3539
3540 )]}'
3541
3542{
3543 "submit": {
3544 "method": "POST",
3545 "label": "Submit",
3546 "title": "Submit patch set 1 into master",
3547 "enabled": true
3548 },
3549 "cherrypick": {
3550 "method": "POST",
3551 "label": "Cherry Pick",
3552 "title": "Cherry pick change to a different branch",
3553 "enabled": true
3554 }
3555}
3556----
3557
3558The response is a flat map of possible revision actions mapped to their
3559link:#action-info[ActionInfo].
3560
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003561[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003562=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003563--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003564'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003565--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003566
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003567Retrieves a review of a revision.
3568
3569.Request
3570----
3571 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3572----
3573
3574As response a link:#change-info[ChangeInfo] entity with
3575link:#detailed-labels[detailed labels] and link:#detailed-accounts[
3576detailed accounts] is returned that describes the review of the
3577revision. The revision for which the review is retrieved is contained
3578in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05003579set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003580revision of the change. Please note that the returned labels are always
3581for the current patch set.
3582
3583.Response
3584----
3585 HTTP/1.1 200 OK
3586 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003587 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003588
3589 )]}'
3590 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003591 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
3592 "project": "myProject",
3593 "branch": "master",
3594 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
3595 "subject": "Implementing Feature X",
3596 "status": "NEW",
3597 "created": "2013-02-01 09:59:32.126000000",
3598 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003599 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003600 "insertions": 34,
3601 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003602 "_number": 3965,
3603 "owner": {
3604 "_account_id": 1000096,
3605 "name": "John Doe",
3606 "email": "john.doe@example.com"
3607 },
3608 "labels": {
3609 "Verified": {
3610 "all": [
3611 {
3612 "value": 0,
3613 "_account_id": 1000096,
3614 "name": "John Doe",
3615 "email": "john.doe@example.com"
3616 },
3617 {
3618 "value": 0,
3619 "_account_id": 1000097,
3620 "name": "Jane Roe",
3621 "email": "jane.roe@example.com"
3622 }
3623 ],
3624 "values": {
3625 "-1": "Fails",
3626 " 0": "No score",
3627 "+1": "Verified"
3628 }
3629 },
3630 "Code-Review": {
3631 "all": [
3632 {
3633 "value": -1,
3634 "_account_id": 1000096,
3635 "name": "John Doe",
3636 "email": "john.doe@example.com"
3637 },
3638 {
3639 "value": 1,
3640 "_account_id": 1000097,
3641 "name": "Jane Roe",
3642 "email": "jane.roe@example.com"
3643 }
3644 ]
3645 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04003646 "-2": "This shall not be merged",
3647 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003648 " 0": "No score",
3649 "+1": "Looks good to me, but someone else must approve",
3650 "+2": "Looks good to me, approved"
3651 }
3652 }
3653 },
3654 "permitted_labels": {
3655 "Verified": [
3656 "-1",
3657 " 0",
3658 "+1"
3659 ],
3660 "Code-Review": [
3661 "-2",
3662 "-1",
3663 " 0",
3664 "+1",
3665 "+2"
3666 ]
3667 },
3668 "removable_reviewers": [
3669 {
3670 "_account_id": 1000096,
3671 "name": "John Doe",
3672 "email": "john.doe@example.com"
3673 },
3674 {
3675 "_account_id": 1000097,
3676 "name": "Jane Roe",
3677 "email": "jane.roe@example.com"
3678 }
3679 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08003680 "reviewers": {
3681 "REVIEWER": [
3682 {
3683 "_account_id": 1000096,
3684 "name": "John Doe",
3685 "email": "john.doe@example.com"
3686 },
3687 {
3688 "_account_id": 1000097,
3689 "name": "Jane Roe",
3690 "email": "jane.roe@example.com"
3691 }
3692 ]
3693 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003694 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
3695 "revisions": {
3696 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09003697 "kind": "REWORK",
3698 "_number": 2,
3699 "ref": "refs/changes/65/3965/2",
3700 "fetch": {
3701 "http": {
3702 "url": "http://gerrit/myProject",
3703 "ref": "refs/changes/65/3965/2"
3704 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003705 }
3706 }
3707 }
3708 }
3709----
3710
David Pursehouse669f2512014-07-18 11:41:42 +09003711[[get-related-changes]]
3712=== Get Related Changes
3713--
3714'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
3715--
3716
3717Retrieves related changes of a revision. Related changes are changes that either
3718depend on, or are dependencies of the revision.
3719
3720.Request
3721----
3722 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
3723----
3724
3725As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
3726describing the related changes.
3727
3728.Response
3729----
3730 HTTP/1.1 200 OK
3731 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003732 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09003733
3734 )]}'
3735 {
3736 "changes": [
3737 {
Patrick Hieselcab63512017-07-28 10:25:42 +02003738 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09003739 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
3740 "commit": {
3741 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
3742 "parents": [
3743 {
3744 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
3745 }
3746 ],
3747 "author": {
3748 "name": "David Ostrovsky",
3749 "email": "david@ostrovsky.org",
3750 "date": "2014-07-12 15:04:24.000000000",
3751 "tz": 120
3752 },
3753 "subject": "Remove Solr"
3754 },
3755 "_change_number": 58478,
3756 "_revision_number": 2,
3757 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003758 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003759 },
3760 {
Patrick Hieselcab63512017-07-28 10:25:42 +02003761 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09003762 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
3763 "commit": {
3764 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
3765 "parents": [
3766 {
3767 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
3768 }
3769 ],
3770 "author": {
3771 "name": "David Pursehouse",
3772 "email": "david.pursehouse@sonymobile.com",
3773 "date": "2014-06-24 02:01:28.000000000",
3774 "tz": 540
3775 },
3776 "subject": "Add support for secondary index with Elasticsearch"
3777 },
3778 "_change_number": 58081,
3779 "_revision_number": 10,
3780 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003781 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003782 }
3783 ]
3784 }
3785----
3786
3787
Edwin Kempin67498de2013-02-25 16:15:34 +01003788[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003789=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003790--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003791'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003792--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003793
Logan Hanksf03040e2017-05-03 09:40:56 -07003794Sets a review on a revision, optionally also publishing draft comments, setting
Logan Hanks53c36012017-06-30 13:47:54 -07003795labels, adding reviewers or CCs, and modifying the work in progress property.
Edwin Kempin67498de2013-02-25 16:15:34 +01003796
3797The review must be provided in the request body as a
3798link:#review-input[ReviewInput] entity.
3799
Aaron Gable8c650212017-04-25 12:03:37 -07003800A review cannot be set on a change edit. Trying to post a review for a
3801change edit fails with `409 Conflict`.
3802
Logan Hanksf03040e2017-05-03 09:40:56 -07003803Here is an example of using this method to set labels:
Aaron Gable8c650212017-04-25 12:03:37 -07003804
Edwin Kempin67498de2013-02-25 16:15:34 +01003805.Request
3806----
3807 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003808 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003809
3810 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01003811 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01003812 "message": "Some nits need to be fixed.",
3813 "labels": {
3814 "Code-Review": -1
3815 },
3816 "comments": {
3817 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3818 {
3819 "line": 23,
3820 "message": "[nit] trailing whitespace"
3821 },
3822 {
3823 "line": 49,
3824 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09003825 },
3826 {
3827 "range": {
3828 "start_line": 50,
3829 "start_character": 0,
3830 "end_line": 55,
3831 "end_character": 20
3832 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09003833 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01003834 }
3835 ]
3836 }
3837 }
3838----
3839
Aaron Gable843b0c12017-04-21 08:25:27 -07003840As response a link:#review-result[ReviewResult] entity is returned that
Aaron Gable8c650212017-04-25 12:03:37 -07003841describes the applied labels and any added reviewers (e.g. yourself,
3842if you set a label but weren't previously a reviewer on this CL).
Edwin Kempin67498de2013-02-25 16:15:34 +01003843
3844.Response
3845----
3846 HTTP/1.1 200 OK
3847 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003848 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003849
3850 )]}'
3851 {
3852 "labels": {
3853 "Code-Review": -1
3854 }
3855 }
3856----
3857
Aaron Gable8c650212017-04-25 12:03:37 -07003858It is also possible to add one or more reviewers or CCs
Logan Hanksf03040e2017-05-03 09:40:56 -07003859to a change simultaneously with a review:
Logan Hanks5f1c7592016-07-06 14:39:33 -07003860
3861.Request
3862----
3863 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3864 Content-Type: application/json; charset=UTF-8
3865
3866 {
Aaron Gable8c650212017-04-25 12:03:37 -07003867 "message": "I don't have context here. Jane and maybe John and the project leads should take a look.",
Logan Hanks5f1c7592016-07-06 14:39:33 -07003868 "reviewers": [
3869 {
3870 "reviewer": "jane.roe@example.com"
3871 },
3872 {
Aaron Gable8c650212017-04-25 12:03:37 -07003873 "reviewer": "john.doe@example.com",
3874 "state": "CC"
3875 }
3876 {
3877 "reviewer": "MyProjectVerifiers",
Logan Hanks5f1c7592016-07-06 14:39:33 -07003878 }
3879 ]
3880 }
3881----
3882
3883Each element of the `reviewers` list is an instance of
3884link:#reviewer-input[ReviewerInput]. The corresponding result of
Aaron Gable8c650212017-04-25 12:03:37 -07003885adding each reviewer will be returned in a map of inputs to
3886link:#add-reviewer-result[AddReviewerResult]s.
Logan Hanks5f1c7592016-07-06 14:39:33 -07003887
3888.Response
3889----
3890 HTTP/1.1 200 OK
3891 Content-Disposition: attachment
3892 Content-Type: application/json; charset=UTF-8
3893
3894 )]}'
3895 {
Aaron Gable8c650212017-04-25 12:03:37 -07003896 "reviewers": {
3897 "jane.roe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07003898 "input": "jane.roe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07003899 "reviewers": [
3900 {
3901 "_account_id": 1000097,
3902 "name": "Jane Roe",
3903 "email": "jane.roe@example.com"
3904 "approvals": {
3905 "Verified": " 0",
3906 "Code-Review": " 0"
3907 },
3908 },
3909 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07003910 },
Aaron Gable8c650212017-04-25 12:03:37 -07003911 "john.doe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07003912 "input": "john.doe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07003913 "ccs": [
3914 {
3915 "_account_id": 1000096,
3916 "name": "John Doe",
3917 "email": "john.doe@example.com"
3918 "approvals": {
3919 "Verified": " 0",
3920 "Code-Review": " 0"
3921 },
3922 }
3923 ]
3924 },
3925 "MyProjectVerifiers": {
3926 "input": "MyProjectVerifiers",
3927 "reviewers": [
3928 {
3929 "_account_id": 1000098,
3930 "name": "Alice Ansel",
3931 "email": "alice.ansel@example.com"
3932 "approvals": {
3933 "Verified": " 0",
3934 "Code-Review": " 0"
3935 },
3936 },
3937 {
3938 "_account_id": 1000099,
3939 "name": "Bob Bollard",
3940 "email": "bob.bollard@example.com"
3941 "approvals": {
3942 "Verified": " 0",
3943 "Code-Review": " 0"
3944 },
3945 },
3946 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07003947 }
Aaron Gable8c650212017-04-25 12:03:37 -07003948 }
Logan Hanks5f1c7592016-07-06 14:39:33 -07003949 }
3950----
3951
Logan Hankse2aacef2016-07-22 15:54:52 -07003952If there are any errors returned for reviewers, the entire review request will
Aaron Gable8c650212017-04-25 12:03:37 -07003953be rejected with `400 Bad Request`. None of the entries will have the
3954`reviewers` or `ccs` field set, and those which specifically failed will have
3955the `errors` field set containing details of why they failed.
Logan Hankse2aacef2016-07-22 15:54:52 -07003956
3957.Error Response
3958----
3959 HTTP/1.1 400 Bad Request
3960 Content-Disposition: attachment
3961 Content-Type: application/json; charset=UTF-8
3962
3963 )]}'
3964 {
3965 "reviewers": {
Aaron Gable8c650212017-04-25 12:03:37 -07003966 "jane.roe@example.com": {
3967 "input": "jane.roe@example.com",
3968 "error": "Account of jane.roe@example.com is inactive."
3969 },
3970 "john.doe@example.com": {
3971 "input": "john.doe@example.com"
3972 },
Logan Hankse2aacef2016-07-22 15:54:52 -07003973 "MyProjectVerifiers": {
3974 "input": "MyProjectVerifiers",
3975 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3976 "confirm": true
3977 }
3978 }
3979 }
3980----
3981
Dave Borowitzd2e41452017-10-26 08:06:23 -04003982[[set-review-notifications]]
Logan Hanksfc055962017-06-12 14:20:53 -07003983.Notifications
3984
3985An email will be sent using the "comment" template.
3986
3987If the top-level notify property is null or not set, then notification behavior
3988depends on whether the change is WIP, whether it has started review, and whether
3989the tag property is null.
3990
3991NOTE: If adding reviewers, the notify property of each ReviewerInput is *ignored*.
3992Use the notify property of the top-level link:#review-input[ReviewInput] instead.
3993
3994For the purposes of this table, *everyone* means *owner, reviewers, CCs, stars, and ALL_COMMENTS
3995watchers*.
3996
Logan Hanksea3e3b72017-06-12 14:21:47 -07003997[options="header",cols="2,1,1,2,2"]
Logan Hanksfc055962017-06-12 14:20:53 -07003998|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07003999|WIP State |Review Started|Tag Given|Default |notify=ALL
4000|Ready for review|N/A |N/A |everyone|everyone
4001|Work in progress|no |no |not sent|everyone
4002|Work in progress|no |yes |owner |everyone
4003|Work in progress|yes |no |everyone|everyone
4004|Work in progress|yes |yes |owner |everyone
4005
Logan Hanksfc055962017-06-12 14:20:53 -07004006|=============================
4007
4008If reviewers are added, then a second email will be sent using the "newchange"
4009template. The notification logic for this email is the same as for
4010link:#add-reviewer[Add Reviewer].
4011
Logan Hanksea3e3b72017-06-12 14:21:47 -07004012[options="header",cols="1,1,1"]
Logan Hanksfc055962017-06-12 14:20:53 -07004013|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004014|WIP State |Default |notify=ALL
4015|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
4016|Work in progress|not sent |owner, reviewers, CCs
Logan Hanksfc055962017-06-12 14:20:53 -07004017|=============================
4018
4019
Edwin Kempincdae63b2013-03-15 15:06:59 +01004020[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004021=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004022--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004023'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004024--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004025
4026Rebases a revision.
4027
Zalan Blenessy874aed72015-01-12 13:26:18 +01004028Optionally, the parent revision can be changed to another patch set through the
4029link:#rebase-input[RebaseInput] entity.
4030
Edwin Kempincdae63b2013-03-15 15:06:59 +01004031.Request
4032----
4033 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01004034 Content-Type: application/json;charset=UTF-8
4035
4036 {
4037 "base" : "1234",
4038 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01004039----
4040
4041As response a link:#change-info[ChangeInfo] entity is returned that
4042describes the rebased change. Information about the current patch set
4043is included.
4044
4045.Response
4046----
4047 HTTP/1.1 200 OK
4048 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004049 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004050
4051 )]}'
4052 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01004053 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4054 "project": "myProject",
4055 "branch": "master",
4056 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4057 "subject": "Implement Feature X",
4058 "status": "NEW",
4059 "created": "2013-02-01 09:59:32.126000000",
4060 "updated": "2013-02-21 11:16:36.775000000",
4061 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004062 "insertions": 21,
4063 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01004064 "_number": 4799,
4065 "owner": {
4066 "name": "John Doe"
4067 },
4068 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
4069 "revisions": {
4070 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09004071 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004072 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01004073 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004074 "fetch": {
4075 "http": {
4076 "url": "http://gerrit:8080/myProject",
4077 "ref": "refs/changes/99/4799/2"
4078 }
4079 },
4080 "commit": {
4081 "parents": [
4082 {
4083 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
4084 "subject": "Implement Feature A"
4085 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00004086 ],
4087 "author": {
4088 "name": "John Doe",
4089 "email": "john.doe@example.com",
4090 "date": "2013-05-07 15:21:27.000000000",
4091 "tz": 120
4092 },
4093 "committer": {
4094 "name": "Gerrit Code Review",
4095 "email": "gerrit-server@example.com",
4096 "date": "2013-05-07 15:35:43.000000000",
4097 "tz": 120
4098 },
4099 "subject": "Implement Feature X",
4100 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01004101 }
4102 }
4103 }
4104----
4105
4106If the revision cannot be rebased, e.g. due to conflicts, the response is
4107"`409 Conflict`" and the error message is contained in the response
4108body.
4109
4110.Response
4111----
4112 HTTP/1.1 409 Conflict
4113 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004114 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004115
4116 The change could not be rebased due to a path conflict during merge.
4117----
4118
Edwin Kempin14b58112013-02-26 16:30:19 +01004119[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004120=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004121--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004122'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004123--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004124
Edwin Kempin14b58112013-02-26 16:30:19 +01004125Submits a revision.
4126
Edwin Kempin14b58112013-02-26 16:30:19 +01004127.Request
4128----
4129 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
Edwin Kempin14b58112013-02-26 16:30:19 +01004130----
4131
4132As response a link:#submit-info[SubmitInfo] entity is returned that
4133describes the status of the submitted change.
4134
4135.Response
4136----
4137 HTTP/1.1 200 OK
4138 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004139 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004140
4141 )]}'
4142 {
4143 "status": "MERGED"
4144 }
4145----
4146
4147If the revision cannot be submitted, e.g. because the submit rule
4148doesn't allow submitting the revision or the revision is not the
4149current revision, the response is "`409 Conflict`" and the error
4150message is contained in the response body.
4151
4152.Response
4153----
4154 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004155 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004156
4157 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
4158----
4159
Edwin Kempin257d70f2013-03-28 14:31:14 +01004160[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004161=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004162--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004163'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004164--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004165
4166Gets the formatted patch for one revision.
4167
4168.Request
4169----
4170 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
4171----
4172
Shawn Pearce98361f72013-05-10 16:27:36 -07004173The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01004174
4175.Response
4176----
4177 HTTP/1.1 200 OK
4178 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004179 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07004180 X-FYI-Content-Encoding: base64
4181 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01004182
Shawn Pearce98361f72013-05-10 16:27:36 -07004183 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01004184----
4185
David Ostrovsky973f38b2013-08-22 00:24:51 -07004186Adding query parameter `zip` (for example `/changes/.../patch?zip`)
4187returns the patch as a single file inside of a ZIP archive. Clients
4188can expand the ZIP to obtain the plain text patch, avoiding the
4189need for a base64 decoding step. This option implies `download`.
4190
4191Query parameter `download` (e.g. `/changes/.../patch?download`)
4192will suggest the browser save the patch as `commitsha1.diff.base64`,
4193for later processing by command line tools.
4194
Kasper Nilsson81448072016-10-17 15:04:33 -07004195If the `path` parameter is set, the returned content is a diff of the single
4196file that the path refers to.
4197
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004198[[submit-preview]]
Edwin Kempin807eb4b2016-10-18 15:49:41 +02004199=== Submit Preview
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004200--
4201'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
4202--
4203Gets a file containing thin bundles of all modified projects if this
4204change was submitted. The bundles are named `${ProjectName}.git`.
4205Each thin bundle contains enough to construct the state in which a project would
4206be in if this change were submitted. The base of the thin bundles are the
4207current target branches, so to make use of this call in a non-racy way, first
4208get the bundles and then fetch all projects contained in the bundle.
4209(This assumes no non-fastforward pushes).
4210
4211You need to give a parameter '?format=zip' or '?format=tar' to specify the
Stefan Beller3e586742016-10-05 15:23:22 -07004212format for the outer container. It is always possible to use tgz, even if
4213tgz is not in the list of allowed archive formats.
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004214
4215To make good use of this call, you would roughly need code as found at:
4216----
4217 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
4218----
4219.Request
4220----
4221 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
4222----
4223
4224.Response
4225----
4226 HTTP/1.1 200 OK
4227 Date: Tue, 13 Sep 2016 19:13:46 GMT
4228 Content-Disposition: attachment; filename="submit-preview-147.zip"
4229 X-Content-Type-Options: nosniff
4230 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
4231 Pragma: no-cache
4232 Expires: Mon, 01 Jan 1990 00:00:00 GMT
4233 Content-Type: application/x-zip
4234 Transfer-Encoding: chunked
4235
4236 [binary stuff]
4237----
4238
4239In case of an error, the response is not a zip file but a regular json response,
4240containing only the error message:
4241
4242.Response
4243----
4244 HTTP/1.1 200 OK
4245 Content-Disposition: attachment
4246 Content-Type: application/json; charset=UTF-8
4247
4248 )]}'
4249 "Anonymous users cannot submit"
4250----
4251
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004252[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004253=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004254--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004255'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004256--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004257
4258Gets the method the server will use to submit (merge) the change and
4259an indicator if the change is currently mergeable.
4260
4261.Request
4262----
4263 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
4264----
4265
Saša Živkov499873f2014-05-05 13:34:18 +02004266As response a link:#mergeable-info[MergeableInfo] entity is returned.
4267
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004268.Response
4269----
4270 HTTP/1.1 200 OK
4271 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004272 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004273
4274 )]}'
4275 {
4276 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004277 strategy: "recursive",
4278 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004279 }
4280----
4281
Saša Živkov697cab22014-04-29 16:46:50 +02004282If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08004283checked for all other branches which are listed in the
4284link:config-project-config.html#branchOrder-section[branchOrder] section in the
4285project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02004286
4287.Request
4288----
4289 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
4290----
4291
4292The response will then contain a list of all other branches where this changes
4293could merge cleanly.
4294
4295.Response
4296----
4297 HTTP/1.1 200 OK
4298 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004299 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02004300
4301 )]}'
4302 {
4303 submit_type: "MERGE_IF_NECESSARY",
4304 mergeable: true,
4305 mergeable_into: [
4306 "refs/heads/stable-2.7",
4307 "refs/heads/stable-2.8",
4308 ]
4309 }
4310----
4311
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004312[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004313=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004314--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004315'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004316--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004317
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004318Gets the method the server will use to submit (merge) the change.
4319
4320.Request
4321----
4322 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
4323----
4324
4325.Response
4326----
4327 HTTP/1.1 200 OK
4328 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004329 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004330
4331 )]}'
4332 "MERGE_IF_NECESSARY"
4333----
4334
4335[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004336=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004337--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004338'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004339--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004340
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004341Tests the submit_type Prolog rule in the project, or the one given.
4342
4343Request body may be either the Prolog code as `text/plain` or a
4344link:#rule-input[RuleInput] object. The query parameter `filters`
4345may be set to `SKIP` to bypass parent project filters while testing
4346a project-specific rule.
4347
4348.Request
4349----
4350 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004351 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004352
4353 submit_type(cherry_pick).
4354----
4355
4356.Response
4357----
4358 HTTP/1.1 200 OK
4359 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004360 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004361
4362 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07004363 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004364----
4365
4366[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004367=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004368--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004369'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004370--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004371
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004372Tests the submit_rule Prolog rule in the project, or the one given.
4373
4374Request body may be either the Prolog code as `text/plain` or a
4375link:#rule-input[RuleInput] object. The query parameter `filters`
4376may be set to `SKIP` to bypass parent project filters while testing
4377a project-specific rule.
4378
4379.Request
4380----
Shawn Pearcea3cce712014-03-21 08:16:11 -07004381 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004382 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004383
4384 submit_rule(submit(R)) :-
4385 R = label('Any-Label-Name', reject(_)).
4386----
4387
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004388The response is a link:#submit-record[SubmitRecord] describing the
4389permutations that satisfy the tested submit rule.
4390
David Pursehouse87a3fb02019-10-29 16:01:27 +09004391If the submit rule was a no-op, the response is "`204 No Content`".
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004392
4393.Response
4394----
4395 HTTP/1.1 200 OK
4396 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004397 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004398
4399 )]}'
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004400 {
4401 "status": "NOT_READY",
4402 "reject": {
4403 "Any-Label-Name": {}
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004404 }
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004405 }
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004406----
4407
Shawn Pearceb42e3032015-04-02 10:28:10 -07004408When testing with the `curl` command line client the
4409`--data-binary @rules.pl` flag should be used to ensure
4410all LFs are included in the Prolog code:
4411
4412----
4413 curl -X POST \
4414 -H 'Content-Type: text/plain; charset=UTF-8' \
4415 --data-binary @rules.pl \
4416 http://.../test.submit_rule
4417----
4418
Edwin Kempincb6724a2013-02-26 16:58:51 +01004419[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004420=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004421--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004422'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004423--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004424
Edwin Kempin3ca57192013-02-27 07:44:01 +01004425Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01004426user.
4427
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004428Returns a map of file paths to lists of link:#comment-info[CommentInfo]
4429entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004430
4431.Request
4432----
4433 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
4434----
4435
4436.Response
4437----
4438 HTTP/1.1 200 OK
4439 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004440 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01004441
4442 )]}'
4443 {
4444 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4445 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004446 "id": "TvcXrmjM",
4447 "line": 23,
4448 "message": "[nit] trailing whitespace",
4449 "updated": "2013-02-26 15:40:43.986000000"
4450 },
4451 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004452 "id": "TveXwFiA",
4453 "line": 49,
4454 "in_reply_to": "TfYX-Iuo",
4455 "message": "Done",
4456 "updated": "2013-02-26 15:40:45.328000000"
4457 }
4458 ]
4459 }
4460----
4461
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004462[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004463=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004464--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004465'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004466--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004467
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004468Creates a draft comment on a revision.
4469
4470The new draft comment must be provided in the request body inside a
4471link:#comment-input[CommentInput] entity.
4472
4473.Request
4474----
4475 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004476 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004477
4478 {
4479 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4480 "line": 23,
4481 "message": "[nit] trailing whitespace"
4482 }
4483----
4484
4485As response a link:#comment-info[CommentInfo] entity is returned that
4486describes the draft comment.
4487
4488.Response
4489----
4490 HTTP/1.1 200 OK
4491 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004492 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004493
4494 )]}'
4495 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004496 "id": "TvcXrmjM",
4497 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4498 "line": 23,
4499 "message": "[nit] trailing whitespace",
4500 "updated": "2013-02-26 15:40:43.986000000"
4501 }
4502----
4503
Edwin Kempin3ca57192013-02-27 07:44:01 +01004504[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004505=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004506--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004507'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 -08004508--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004509
Edwin Kempin3ca57192013-02-27 07:44:01 +01004510Retrieves a draft comment of a revision that belongs to the calling
4511user.
4512
4513.Request
4514----
4515 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4516----
4517
4518As response a link:#comment-info[CommentInfo] entity is returned that
4519describes the draft comment.
4520
4521.Response
4522----
4523 HTTP/1.1 200 OK
4524 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004525 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01004526
4527 )]}'
4528 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01004529 "id": "TvcXrmjM",
4530 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4531 "line": 23,
4532 "message": "[nit] trailing whitespace",
4533 "updated": "2013-02-26 15:40:43.986000000"
4534 }
4535----
4536
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004537[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004538=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004539--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004540'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 -08004541--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004542
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004543Updates a draft comment on a revision.
4544
4545The new draft comment must be provided in the request body inside a
4546link:#comment-input[CommentInput] entity.
4547
4548.Request
4549----
4550 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004551 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004552
4553 {
4554 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4555 "line": 23,
4556 "message": "[nit] trailing whitespace"
4557 }
4558----
4559
4560As response a link:#comment-info[CommentInfo] entity is returned that
4561describes the draft comment.
4562
4563.Response
4564----
4565 HTTP/1.1 200 OK
4566 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004567 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004568
4569 )]}'
4570 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004571 "id": "TvcXrmjM",
4572 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4573 "line": 23,
4574 "message": "[nit] trailing whitespace",
4575 "updated": "2013-02-26 15:40:43.986000000"
4576 }
4577----
4578
4579[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004580=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004581--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004582'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 -08004583--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004584
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004585Deletes a draft comment from a revision.
4586
4587.Request
4588----
4589 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4590----
4591
4592.Response
4593----
4594 HTTP/1.1 204 No Content
4595----
4596
John Spurlock5e402f02013-03-24 11:35:04 -04004597[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004598=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004599--
John Spurlock5e402f02013-03-24 11:35:04 -04004600'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004601--
John Spurlock5e402f02013-03-24 11:35:04 -04004602
4603Lists the published comments of a revision.
4604
4605As result a map is returned that maps the file path to a list of
4606link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07004607sorted by file path and only include file (or inline) comments. Use
4608the link:#get-change-detail[Get Change Detail] endpoint to retrieve
4609the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04004610
4611.Request
4612----
4613 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
4614----
4615
4616.Response
4617----
4618 HTTP/1.1 200 OK
4619 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004620 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004621
4622 )]}'
4623 {
4624 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4625 {
John Spurlock5e402f02013-03-24 11:35:04 -04004626 "id": "TvcXrmjM",
4627 "line": 23,
4628 "message": "[nit] trailing whitespace",
4629 "updated": "2013-02-26 15:40:43.986000000",
4630 "author": {
4631 "_account_id": 1000096,
4632 "name": "John Doe",
4633 "email": "john.doe@example.com"
4634 }
4635 },
4636 {
John Spurlock5e402f02013-03-24 11:35:04 -04004637 "id": "TveXwFiA",
4638 "line": 49,
4639 "in_reply_to": "TfYX-Iuo",
4640 "message": "Done",
4641 "updated": "2013-02-26 15:40:45.328000000",
4642 "author": {
4643 "_account_id": 1000097,
4644 "name": "Jane Roe",
4645 "email": "jane.roe@example.com"
4646 }
4647 }
4648 ]
4649 }
4650----
4651
4652[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004653=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004654--
John Spurlock5e402f02013-03-24 11:35:04 -04004655'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 -08004656--
John Spurlock5e402f02013-03-24 11:35:04 -04004657
4658Retrieves a published comment of a revision.
4659
4660.Request
4661----
4662 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
4663----
4664
4665As response a link:#comment-info[CommentInfo] entity is returned that
4666describes the published comment.
4667
4668.Response
4669----
4670 HTTP/1.1 200 OK
4671 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004672 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004673
4674 )]}'
4675 {
John Spurlock5e402f02013-03-24 11:35:04 -04004676 "id": "TvcXrmjM",
4677 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4678 "line": 23,
4679 "message": "[nit] trailing whitespace",
4680 "updated": "2013-02-26 15:40:43.986000000",
4681 "author": {
4682 "_account_id": 1000096,
4683 "name": "John Doe",
4684 "email": "john.doe@example.com"
4685 }
4686 }
4687----
4688
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01004689[[delete-comment]]
4690=== Delete Comment
4691--
4692'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]' +
4693'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]/delete'
4694--
4695
4696Deletes a published comment of a revision. Instead of deleting the
4697whole comment, this endpoint just replaces the comment's message
4698with a new message, which contains the name of the user who deletes
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02004699the comment and the reason why it's deleted.
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01004700
4701Note that only users with the
4702link:access-control.html#capability_administrateServer[Administrate Server]
4703global capability are permitted to delete a comment.
4704
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02004705Deletion reason can be provided in the request body as a
4706link:#delete-comment-input[DeleteCommentInput] entity.
4707Historically, this method allowed a body in the DELETE, but that behavior is
4708link:https://www.gerritcodereview.com/releases/2.16.md[deprecated].
4709In this case, use a POST request instead:
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01004710
4711.Request
4712----
4713 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM/delete HTTP/1.0
4714 Content-Type: application/json; charset=UTF-8
4715
4716 {
4717 "reason": "contains confidential information"
4718 }
4719----
4720
4721As response a link:#comment-info[CommentInfo] entity is returned that
4722describes the updated comment.
4723
4724.Response
4725----
4726 HTTP/1.1 200 OK
4727 Content-Disposition: attachment
4728 Content-Type: application/json; charset=UTF-8
4729
4730 )]}'
4731 {
4732 "id": "TvcXrmjM",
4733 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4734 "line": 23,
4735 "message": "Comment removed by: Administrator; Reason: contains confidential information",
4736 "updated": "2013-02-26 15:40:43.986000000",
4737 "author": {
4738 "_account_id": 1000096,
4739 "name": "John Doe",
4740 "email": "john.doe@example.com"
4741 }
4742 }
4743----
4744
Edwin Kempinb050a482016-12-01 09:11:19 +01004745[[list-robot-comments]]
Edwin Kempin3fde7e42016-09-19 15:35:10 +02004746=== List Robot Comments
4747--
4748'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
4749--
4750
4751Lists the link:config-robot-comments.html[robot comments] of a
4752revision.
4753
4754As result a map is returned that maps the file path to a list of
4755link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
4756map are sorted by file path.
4757
4758.Request
4759----
4760 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
4761----
4762
4763.Response
4764----
4765 HTTP/1.1 200 OK
4766 Content-Disposition: attachment
4767 Content-Type: application/json; charset=UTF-8
4768
4769 )]}'
4770 {
4771 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4772 {
4773 "id": "TvcXrmjM",
4774 "line": 23,
4775 "message": "unused import",
4776 "updated": "2016-02-26 15:40:43.986000000",
4777 "author": {
4778 "_account_id": 1000110,
4779 "name": "Code Analyzer",
4780 "email": "code.analyzer@example.com"
4781 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09004782 "robot_id": "importChecker",
4783 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02004784 },
4785 {
4786 "id": "TveXwFiA",
4787 "line": 49,
4788 "message": "wrong indention",
4789 "updated": "2016-02-26 15:40:45.328000000",
4790 "author": {
4791 "_account_id": 1000110,
4792 "name": "Code Analyzer",
4793 "email": "code.analyzer@example.com"
4794 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09004795 "robot_id": "styleChecker",
4796 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02004797 }
4798 ]
4799 }
4800----
4801
4802[[get-robot-comment]]
4803=== Get Robot Comment
4804--
4805'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
4806--
4807
4808Retrieves a link:config-robot-comments.html[robot comment] of a
4809revision.
4810
4811.Request
4812----
4813 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
4814----
4815
4816As response a link:#robot-comment-info[RobotCommentInfo] entity is
4817returned that describes the robot comment.
4818
4819.Response
4820----
4821 HTTP/1.1 200 OK
4822 Content-Disposition: attachment
4823 Content-Type: application/json; charset=UTF-8
4824
4825 )]}'
4826 {
4827 "id": "TvcXrmjM",
4828 "line": 23,
4829 "message": "unused import",
4830 "updated": "2016-02-26 15:40:43.986000000",
4831 "author": {
4832 "_account_id": 1000110,
4833 "name": "Code Analyzer",
4834 "email": "code.analyzer@example.com"
4835 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09004836 "robot_id": "importChecker",
4837 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02004838 }
4839----
4840
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004841[[apply-fix]]
4842=== Apply Fix
4843--
4844'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/apply'
4845--
4846
4847Applies a suggested fix by creating a change edit which includes the
4848modifications indicated by the fix suggestion. If a change edit already exists,
4849it will be updated accordingly. A fix can only be applied if no change edit
4850exists and the fix refers to the current patch set, or the fix refers to the
4851patch set on which the change edit is based.
4852
4853.Request
4854----
4855 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fixes/8f605a55_f6aa4ecc/apply HTTP/1.0
4856----
4857
4858If the fix was successfully applied, an <<edit-info,EditInfo>> describing the
4859resulting change edit is returned.
4860
4861.Response
4862----
4863 HTTP/1.1 200 OK
4864 Content-Disposition: attachment
4865 Content-Type: application/json; charset=UTF-8
4866
4867 )]}'
4868 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01004869 "commit": {
4870 "parents": [
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004871 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01004872 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004873 }
4874 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01004875 "author": {
4876 "name": "John Doe",
4877 "email": "john.doe@example.com",
4878 "date": "2013-05-07 15:21:27.000000000",
4879 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004880 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01004881 "committer": {
4882 "name": "Jane Doe",
4883 "email": "jane.doe@example.com",
4884 "date": "2013-05-07 15:35:43.000000000",
4885 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004886 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01004887 "subject": "Implement feature X",
4888 "message": "Implement feature X\n\nWith this feature ..."
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004889 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01004890 "base_patch_set_number": 1,
4891 "base_revision": "674ac754f91e64a0efb8087e59a176484bd534d1"
4892 "ref": "refs/users/01/1000001/edit-42622/1"
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01004893 }
4894----
4895
4896If the application failed e.g. due to conflicts with an existing change edit,
4897the response "`409 Conflict`" including an error message in the response body
4898is returned.
4899
4900.Response
4901----
4902 HTTP/1.1 409 Conflict
4903 Content-Disposition: attachment
4904 Content-Type: text/plain; charset=UTF-8
4905
4906 The existing change edit could not be merged with another tree.
4907----
4908
Edwin Kempin682ac712013-05-14 13:40:46 +02004909[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004910=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004911--
Edwin Kempin682ac712013-05-14 13:40:46 +02004912'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004913--
Edwin Kempin682ac712013-05-14 13:40:46 +02004914
4915Lists the files that were modified, added or deleted in a revision.
4916
4917.Request
4918----
4919 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
4920----
4921
Makson Leefaf05c22018-07-26 22:42:59 +00004922As result a map is returned that maps the link:#file-id[file path] to a
4923link:#file-info[FileInfo] entry. The entries in the map are
Edwin Kempin682ac712013-05-14 13:40:46 +02004924sorted by file path.
4925
4926.Response
4927----
4928 HTTP/1.1 200 OK
4929 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004930 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02004931
4932 )]}'
4933 {
4934 "/COMMIT_MSG": {
4935 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02004936 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01004937 "size_delta": 551,
4938 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02004939 },
4940 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
4941 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02004942 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01004943 "size_delta": 98,
4944 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02004945 }
4946 }
4947----
4948
Shawn Pearce984747d2013-07-18 00:42:16 -07004949The request parameter `reviewed` changes the response to return a list
4950of the paths the caller has marked as reviewed. Clients that also
4951need the FileInfo should make two requests.
4952
Shawn Pearce8ca03a62015-01-02 22:03:20 -08004953The request parameter `q` changes the response to return a list
4954of all files (modified or unmodified) that contain that substring
4955in the path name. This is useful to implement suggestion services
David Pursehousefcfb29d2019-08-01 12:55:16 +09004956finding a file by partial name. Clients that also need the FileInfo
4957should make two requests.
Shawn Pearce8ca03a62015-01-02 22:03:20 -08004958
David Pursehouse89c00ca2019-08-03 13:47:29 +09004959For merge commits only, the integer-valued request parameter `parent`
4960changes the response to return a map of the files which are different
4961in this commit compared to the given parent commit. The value is the
Andrii Shyshkalov350a4512019-09-23 02:26:33 -070049621-based index of the parent's position in the commit object,
4963with the first parent always belonging to the target branch. If not
David Pursehouse89c00ca2019-08-03 13:47:29 +09004964specified, the response contains a map of the files different in the
4965auto merge result.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004966
David Pursehousefcfb29d2019-08-01 12:55:16 +09004967The request parameter `base` changes the response to return a map of the
4968files which are different in this commit compared to the given revision. The
4969revision must correspond to a patch set in the change.
4970
4971The `reviewed`, `q`, `parent`, and `base` options are mutually exclusive.
4972That is, only one of them may be used at a time.
Shawn Pearce984747d2013-07-18 00:42:16 -07004973
4974.Request
4975----
4976 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
4977----
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004978
Shawn Pearce984747d2013-07-18 00:42:16 -07004979.Response
4980----
4981 HTTP/1.1 200 OK
4982 Content-Disposition: attachment
4983 Content-Type: application/json; charset=UTF-8
4984
4985 )]}'
4986 [
Edwin Kempinaef44b02013-05-07 16:15:55 +02004987 "/COMMIT_MSG",
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004988 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004989 ]
Edwin Kempinbea55a52013-05-14 13:53:39 +02004990----
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004991
Edwin Kempinaef44b02013-05-07 16:15:55 +02004992[[get-content]]
4993=== Get Content
4994--
4995'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
4996--
4997
4998Gets the content of a file from a certain revision.
4999
Patrick Hiesel38667d42017-05-02 13:12:48 +02005000The optional, integer-valued `parent` parameter can be specified to request
5001the named file from a parent commit of the specified revision. The value is
5002the 1-based index of the parent's position in the commit object. If the
5003parameter is omitted or the value is non-positive, the patch set is referenced.
5004
Edwin Kempinaef44b02013-05-07 16:15:55 +02005005.Request
5006----
5007 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
5008----
5009
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005010The content is returned as base64 encoded string. The HTTP response
5011Content-Type is always `text/plain`, reflecting the base64 wrapping.
5012A Gerrit-specific `X-FYI-Content-Type` header is returned describing
5013the server detected content type of the file.
5014
5015If only the content type is required, callers should use HEAD to
5016avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02005017
5018.Response
5019----
5020 HTTP/1.1 200 OK
5021 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005022 Content-Type: text/plain; charset=ISO-8859-1
5023 X-FYI-Content-Encoding: base64
5024 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02005025
5026 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
5027----
5028
David Ostrovskyd0078672015-02-06 21:51:04 +01005029Alternatively, if the only value of the Accept request header is
5030`application/json` the content is returned as JSON string and
5031`X-FYI-Content-Encoding` is set to `json`.
5032
David Pletcherd1efb452015-09-01 17:45:55 -07005033[[get-safe-content]]
5034=== Download Content
5035--
5036'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
5037--
5038
5039Downloads the content of a file from a certain revision, in a safe format
5040that poses no risk for inadvertent execution of untrusted code.
5041
5042If the content type is defined as safe, the binary file content is returned
5043verbatim. If the content type is not safe, the file is stored inside a ZIP
5044file, containing a single entry with a random, unpredictable name having the
5045same base and suffix as the true filename. The ZIP file is returned in
5046verbatim binary form.
5047
5048See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
5049for information about safe file type configuration.
5050
5051The HTTP resource Content-Type is dependent on the file type: the
5052applicable type for safe files, or "application/zip" for unsafe files.
5053
David Pletcherec622bf2015-09-18 14:30:05 -07005054The optional, integer-valued `parent` parameter can be specified to request
5055the named file from a parent commit of the specified revision. The value is
5056the 1-based index of the parent's position in the commit object. If the
5057parameter is omitted or the value non-positive, the patch set is referenced.
5058
5059Filenames are decorated with a suffix of `_new` for the current patch,
5060`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07005061
5062.Request
5063----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005064 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005065----
5066
5067.Response
5068----
5069 HTTP/1.1 200 OK
5070 Content-Disposition: attachment; filename="logo.png"
5071 Content-Type: image/png
5072
5073 `[binary data for logo.png]`
5074----
5075
5076.Request
5077----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005078 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/download?suffix=new HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005079----
5080
5081.Response
5082----
5083 HTTP/1.1 200 OK
5084 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
5085 Content-Type:application/zip
5086
5087 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
5088----
5089
David Pursehouse882aef22013-06-05 10:56:37 +09005090[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005091=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005092--
David Pursehouse882aef22013-06-05 10:56:37 +09005093'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 -08005094--
David Pursehouse882aef22013-06-05 10:56:37 +09005095
5096Gets the diff of a file from a certain revision.
5097
5098.Request
5099----
5100 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
5101----
5102
5103As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
5104
5105.Response
5106----
5107 HTTP/1.1 200 OK
5108 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005109 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005110
5111 )]
5112 {
5113 "meta_a": {
5114 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005115 "content_type": "text/x-java-source",
5116 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005117 },
5118 "meta_b": {
5119 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005120 "content_type": "text/x-java-source",
5121 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005122 },
5123 "change_type": "MODIFIED",
5124 "diff_header": [
5125 "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",
5126 "index 59b7670..9faf81c 100644",
5127 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5128 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5129 ],
5130 "content": [
5131 {
5132 "ab": [
5133 "// Copyright (C) 2010 The Android Open Source Project",
5134 "//",
5135 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
5136 "// you may not use this file except in compliance with the License.",
5137 "// You may obtain a copy of the License at",
5138 "//",
5139 "// http://www.apache.org/licenses/LICENSE-2.0",
5140 "//",
5141 "// Unless required by applicable law or agreed to in writing, software",
5142 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
5143 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
5144 "// See the License for the specific language governing permissions and",
5145 "// limitations under the License."
5146 ]
5147 },
5148 {
5149 "b": [
5150 "//",
5151 "// Add some more lines in the header."
5152 ]
5153 },
5154 {
5155 "ab": [
5156 "",
5157 "package com.google.gerrit.server.project;",
5158 "",
5159 "import com.google.common.collect.Maps;",
5160 ...
5161 ]
5162 }
5163 ...
5164 ]
5165 }
5166----
5167
5168If the `intraline` parameter is specified, intraline differences are included in the diff.
5169
5170.Request
5171----
5172 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
5173----
5174
5175.Response
5176----
5177 HTTP/1.1 200 OK
5178 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005179 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005180
5181 )]
5182 {
5183 "meta_a": {
5184 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005185 "content_type": "text/x-java-source",
5186 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005187 },
5188 "meta_b": {
5189 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005190 "content_type": "text/x-java-source",
5191 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005192 },
5193 "change_type": "MODIFIED",
5194 "diff_header": [
5195 "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",
5196 "index 59b7670..9faf81c 100644",
5197 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5198 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5199 ],
5200 "content": [
5201 ...
5202 {
5203 "a": [
5204 "/** Manages access control for Git references (aka branches, tags). */"
5205 ],
5206 "b": [
5207 "/** Manages access control for the Git references (aka branches, tags). */"
5208 ],
5209 "edit_a": [],
5210 "edit_b": [
5211 [
5212 31,
5213 4
5214 ]
5215 ]
5216 }
5217 ]
5218 }
5219----
5220
5221The `base` parameter can be specified to control the base patch set from which the diff should
5222be generated.
5223
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005224The integer-valued request parameter `parent` can be specified to control the
5225parent commit number against which the diff should be generated. This is useful
5226for supporting review of merge commits. The value is the 1-based index of the
5227parent's position in the commit object.
5228
David Pursehouse882aef22013-06-05 10:56:37 +09005229.Request
5230----
5231 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
5232----
5233
5234.Response
5235----
5236 HTTP/1.1 200 OK
5237 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005238 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005239
5240 )]
5241 {
5242 "meta_a": {
5243 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005244 "content_type": "text/x-java-source",
5245 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005246 },
5247 "meta_b": {
5248 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005249 "content_type": "text/x-java-source",
5250 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005251 },
5252 "change_type": "MODIFIED",
5253 "content": [
5254 {
5255 "skip": 578
5256 }
5257 ]
5258 }
5259----
5260
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01005261The `whitespace` parameter can be specified to control how whitespace
5262differences are reported in the result. Valid values are `IGNORE_NONE`,
5263`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09005264
5265The `context` parameter can be specified to control the number of lines of surrounding context
5266in the diff. Valid values are `ALL` or number of lines.
5267
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005268[[get-blame]]
5269=== Get Blame
5270--
5271'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
5272--
5273
5274Gets the blame of a file from a certain revision.
5275
5276.Request
5277----
5278 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
5279----
5280
5281As response a link:#blame-info[BlameInfo] entity is returned that describes the
5282blame.
5283
5284.Response
5285----
5286 HTTP/1.1 200 OK
5287 Content-Disposition: attachment
5288 Content-Type: application/json; charset=UTF-8
5289
5290 )]
5291 {
5292 [
5293 {
5294 "author": "Joe Daw",
5295 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
5296 "time": 1421441349,
5297 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
5298 "ranges": [
5299 {
5300 "start": 1,
5301 "end": 10
5302 },
5303 {
5304 "start": 16,
5305 "end": 296
5306 }
5307 ]
5308 },
5309 {
5310 "author": "Jane Daw",
5311 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
5312 "time": 1421825421,
5313 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
5314 "ranges": [
5315 {
5316 "start": 13,
5317 "end": 13
5318 }
5319 ]
5320 }
5321 ]
5322 }
5323----
5324
5325The `base` parameter can be specified to control the base patch set from which
5326the blame should be generated.
5327
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005328[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005329=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005330--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005331'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 -08005332--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005333
Edwin Kempinbea55a52013-05-14 13:53:39 +02005334Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005335
5336.Request
5337----
5338 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5339----
5340
5341.Response
5342----
5343 HTTP/1.1 201 Created
5344----
5345
Edwin Kempinbea55a52013-05-14 13:53:39 +02005346If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005347response is "`200 OK`".
5348
5349[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005350=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005351--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005352'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 -08005353--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005354
Edwin Kempinbea55a52013-05-14 13:53:39 +02005355Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005356
5357.Request
5358----
5359 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5360----
5361
5362.Response
5363----
5364 HTTP/1.1 204 No Content
5365----
5366
Gustaf Lundh019fb262012-11-28 14:20:22 +01005367[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005368=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005369--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005370'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005371--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005372
5373Cherry picks a revision to a destination branch.
5374
Changcheng Xiao54b6c0c2017-10-23 14:57:42 +02005375To cherry pick a commit with no change-id associated with it, see
5376link:rest-api-projects.html#cherry-pick-commit[CherryPickCommit].
5377
Gustaf Lundh019fb262012-11-28 14:20:22 +01005378The commit message and destination branch must be provided in the request body inside a
Han-Wen Nienhuys02272e02017-03-28 14:47:09 +02005379link:#cherrypick-input[CherryPickInput] entity. If the commit message
5380does not specify a Change-Id, a new one is picked for the destination change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005381
5382.Request
5383----
5384 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005385 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005386
5387 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01005388 "message" : "Implementing Feature X",
5389 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01005390 }
5391----
5392
Edwin Kempin5ac370d2018-10-05 13:39:34 +02005393As response a link:#cherry-pick-change-info[CherryPickChangeInfo]
5394entity is returned that describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005395
5396.Response
5397----
5398 HTTP/1.1 200 OK
5399 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005400 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005401
5402 )]}'
5403 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01005404 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
5405 "project": "myProject",
5406 "branch": "release-branch",
5407 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
5408 "subject": "Implementing Feature X",
5409 "status": "NEW",
5410 "created": "2013-02-01 09:59:32.126000000",
5411 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01005412 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005413 "insertions": 12,
5414 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01005415 "_number": 3965,
5416 "owner": {
5417 "name": "John Doe"
5418 }
5419 }
5420----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005421
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005422[[revision-reviewer-endpoints]]
5423== Revision Reviewer Endpoints
5424
5425[[list-revision-reviewers]]
5426=== List Revision Reviewers
5427--
5428'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
5429--
5430
5431Lists the reviewers of a revision.
5432
5433Please note that only the current revision is supported.
5434
5435As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
5436
5437.Request
5438----
5439 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
5440----
5441
5442.Response
5443----
5444 HTTP/1.1 200 OK
5445 Content-Disposition: attachment
5446 Content-Type: application/json; charset=UTF-8
5447
5448 )]}'
5449 [
5450 {
5451 "approvals": {
5452 "Verified": "+1",
5453 "Code-Review": "+2"
5454 },
5455 "_account_id": 1000096,
5456 "name": "John Doe",
5457 "email": "john.doe@example.com"
5458 },
5459 {
5460 "approvals": {
5461 "Verified": " 0",
5462 "Code-Review": "-1"
5463 },
5464 "_account_id": 1000097,
5465 "name": "Jane Roe",
5466 "email": "jane.roe@example.com"
5467 }
5468 ]
5469----
5470
5471[[list-revision-votes]]
5472=== List Revision Votes
5473--
5474'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
5475--
5476
5477Lists the votes for a specific reviewer of the revision.
5478
5479Please note that only the current revision is supported.
5480
5481.Request
5482----
5483 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
5484----
5485
5486As result a map is returned that maps the label name to the label value.
5487The entries in the map are sorted by label name.
5488
5489.Response
5490----
5491 HTTP/1.1 200 OK
5492 Content-Disposition: attachment
5493 Content-Type: application/json;charset=UTF-8
5494
5495 )]}'
5496 {
5497 "Code-Review": -1,
5498 "Verified": 1,
5499 "Work-In-Progress": 1
5500 }
5501----
5502
5503[[delete-revision-vote]]
5504=== Delete Revision Vote
5505--
5506'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5507/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
5508'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5509/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
5510--
5511
5512Deletes a single vote from a revision. The deletion will be possible only
5513if the revision is the current revision. By using this endpoint you can prevent
5514deleting the vote (with same label) from a newer patch set by mistake.
5515
5516Note, that even when the last vote of a reviewer is removed the reviewer itself
5517is still listed on the change.
5518
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005519.Request
5520----
5521 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
5522 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
5523----
5524
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005525Options can be provided in the request body as a
5526link:#delete-vote-input[DeleteVoteInput] entity.
5527Historically, this method allowed a body in the DELETE, but that behavior is
5528link:https://www.gerritcodereview.com/releases/2.16.md[deprecated].
5529In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005530
5531.Request
5532----
5533 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
5534 Content-Type: application/json; charset=UTF-8
5535
5536 {
5537 "notify": "NONE"
5538 }
5539----
5540
5541.Response
5542----
5543 HTTP/1.1 204 No Content
5544----
5545
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005546[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005547== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005548
Edwin Kempina3d02ef2013-02-22 16:31:53 +01005549[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005550=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01005551--
5552--
5553
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005554[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005555=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01005556Identifier that uniquely identifies one change. It contains the URL-encoded
5557project name as well as the change number: "'$$<project>~<numericId>$$'"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005558
David Pursehousea5923972020-02-26 09:39:38 +09005559Gerrit also supports the following identifiers:
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005560
5561* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
5562 where for the branch the `refs/heads/` prefix can be omitted
5563 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
5564* a Change-Id if it uniquely identifies one change
5565 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Patrick Hiesel4d2dd182017-05-09 17:35:18 +02005566* a numeric change ID ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005567
Changcheng Xiaod61590f2018-04-30 10:59:14 +02005568[[change-message-id]]
5569=== \{change-message-id\}
5570ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
5571
John Spurlock5e402f02013-03-24 11:35:04 -04005572[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005573=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04005574UUID of a published comment.
5575
Edwin Kempin3ca57192013-02-27 07:44:01 +01005576[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005577=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01005578UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005579
David Ostrovskybeb0b842014-12-13 00:24:29 +01005580[[label-id]]
5581=== \{label-id\}
5582The name of the label.
5583
Edwin Kempinbea55a52013-05-14 13:53:39 +02005584[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09005585=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02005586The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005587
David Pursehouse11badbb2017-03-27 10:58:05 +09005588The following magic paths are supported:
5589
5590* `/COMMIT_MSG`:
5591+
5592The commit message and headers with the parent commit(s), the author
5593information and the committer information.
5594
5595* `/MERGE_LIST` (for merge commits only):
5596+
5597The list of commits that are being integrated into the destination
5598branch by submitting the merge commit.
5599
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01005600[[fix-id]]
5601=== \{fix-id\}
5602UUID of a suggested fix.
5603
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01005604[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005605=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01005606Identifier that uniquely identifies one revision of a change.
5607
5608This can be:
5609
Shawn Pearce9c0722a2013-03-02 15:30:31 -08005610* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01005611* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
5612* an abbreviated commit ID that uniquely identifies one revision of the
5613 change ("674ac754"), at least 4 digits are required
5614* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02005615* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01005616
Edwin Kempine3446292013-02-19 16:40:14 +01005617[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005618== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01005619
Edwin Kempined5364b2013-02-22 10:39:33 +01005620[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005621=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01005622The `AbandonInput` entity contains information for abandoning a change.
5623
David Pursehouseae367192014-11-25 17:24:47 +09005624[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01005625|=============================
5626|Field Name ||Description
5627|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01005628Message to be added as review comment to the change when abandoning the
5629change.
Edwin Kempincd07df42016-12-01 09:10:09 +01005630|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07005631Notify handling that defines to whom email notifications should be sent after
5632the change is abandoned. +
5633Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5634If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01005635|`notify_details`|optional|
5636Additional information about whom to notify about the update as a map
5637of recipient type to link:#notify-info[NotifyInfo] entity.
5638|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01005639
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005640[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005641=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005642The `ActionInfo` entity describes a REST API call the client can
5643make to manipulate a resource. These are frequently implemented by
5644plugins and may be discovered at runtime.
5645
David Pursehouseae367192014-11-25 17:24:47 +09005646[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005647|====================================
5648|Field Name ||Description
5649|`method` |optional|
5650HTTP method to use with the action. Most actions use `POST`, `PUT`
5651or `DELETE` to cause state changes.
5652|`label` |optional|
5653Short title to display to a user describing the action. In the
5654Gerrit web interface the label is used as the text on the button
5655presented in the UI.
5656|`title` |optional|
5657Longer text to display describing the action. In a web UI this
5658should be the title attribute of the element, displaying when
5659the user hovers the mouse.
5660|`enabled` |optional|
5661If true the action is permitted at this time and the caller is
5662likely allowed to execute it. This may change if state is updated
5663at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005664|====================================
5665
Edwin Kempin392328e2013-02-25 12:50:03 +01005666[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005667=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01005668The `AddReviewerResult` entity describes the result of adding a
5669reviewer to a change.
5670
David Pursehouseae367192014-11-25 17:24:47 +09005671[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01005672|===========================
5673|Field Name ||Description
Logan Hanks23e70282016-07-06 14:31:56 -07005674|`input` ||
5675Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
5676set while adding the reviewer.
Edwin Kempin392328e2013-02-25 12:50:03 +01005677|`reviewers` |optional|
5678The newly added reviewers as a list of link:#reviewer-info[
5679ReviewerInfo] entities.
Logan Hanksee0a4182016-07-06 14:39:26 -07005680|`ccs` |optional|
5681The newly CCed accounts as a list of link:#reviewer-info[
5682ReviewerInfo] entities. This field will only appear if the requested
5683`state` for the reviewer was `CC` *and* NoteDb is enabled on the
5684server.
Edwin Kempin392328e2013-02-25 12:50:03 +01005685|`error` |optional|
5686Error message explaining why the reviewer could not be added. +
5687If a group was specified in the input and an error is returned, it
5688means that none of the members were added as reviewer.
5689|`confirm` |`false` if not set|
5690Whether adding the reviewer requires confirmation.
5691|===========================
5692
Edwin Kempine3446292013-02-19 16:40:14 +01005693[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005694=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005695The `ApprovalInfo` entity contains information about an approval from a
5696user for a label on a change.
5697
Edwin Kempin963dfd02013-02-27 12:39:32 +01005698`ApprovalInfo` has the same fields as
5699link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01005700In addition `ApprovalInfo` has the following fields:
5701
David Pursehouseae367192014-11-25 17:24:47 +09005702[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005703|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005704|Field Name ||Description
5705|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07005706The vote that the user has given for the label. If present and zero, the
5707user is permitted to vote on the label. If absent, the user is not
5708permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005709|`permitted_voting_range` |optional|
5710The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
5711on that label. If present, the user is permitted to vote on the label
5712regarding the range values. If absent, the user is not permitted to vote
5713on that label.
5714|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01005715The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005716|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005717Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00005718while posting the review. Votes/comments that contain `tag` with
5719'autogenerated:' prefix can be filtered out in the web UI.
5720NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005721invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04005722|`post_submit` |not set if `false`|
5723If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01005724|===========================
5725
Sven Selberg273a4aa2016-09-21 16:28:10 +02005726[[assignee-input]]
5727=== AssigneeInput
5728The `AssigneeInput` entity contains the identity of the user to be set as assignee.
5729
5730[options="header",cols="1,^1,5"]
5731|===========================
5732|Field Name ||Description
5733|`assignee` ||
5734The link:rest-api-accounts.html#account-id[ID] of one account that
5735should be added as assignee.
5736|===========================
5737
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005738[[blame-info]]
5739=== BlameInfo
5740The `BlameInfo` entity stores the commit metadata with the row coordinates where
5741it applies.
5742
5743[options="header",cols="1,6"]
5744|===========================
5745|Field Name | Description
5746|`author` | The author of the commit.
5747|`id` | The id of the commit.
5748|`time` | Commit time.
5749|`commit_msg` | The commit message.
5750|`ranges` |
5751The blame row coordinates as link:#range-info[RangeInfo] entities.
5752|===========================
5753
Edwin Kempin521c1242015-01-23 12:44:44 +01005754[[change-edit-input]]
5755=== ChangeEditInput
5756The `ChangeEditInput` entity contains information for restoring a
5757path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02005758
Edwin Kempin521c1242015-01-23 12:44:44 +01005759[options="header",cols="1,^1,5"]
5760|===========================
5761|Field Name ||Description
5762|`restore_path`|optional|Path to file to restore.
5763|`old_path` |optional|Old path to file to rename.
5764|`new_path` |optional|New path to file to rename.
5765|===========================
5766
5767[[change-edit-message-input]]
5768=== ChangeEditMessageInput
5769The `ChangeEditMessageInput` entity contains information for changing
5770the commit message within a change edit.
5771
5772[options="header",cols="1,^1,5"]
5773|===========================
5774|Field Name ||Description
5775|`message` ||New commit message.
5776|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02005777
Edwin Kempine3446292013-02-19 16:40:14 +01005778[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005779=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005780The `ChangeInfo` entity contains information about a change.
5781
David Pursehouseae367192014-11-25 17:24:47 +09005782[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005783|==================================
5784|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005785|`id` ||
5786The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05005787where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01005788`refs/heads/` prefix is omitted.
5789|`project` ||The name of the project.
5790|`branch` ||
5791The name of the target branch. +
5792The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01005793|`topic` |optional|The topic to which this change belongs.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02005794|`assignee` |optional|
5795The assignee of the change as an link:rest-api-accounts.html#account-info[
5796AccountInfo] entity.
5797|`hashtags` |optional|
5798List of hashtags that are set on the change (only populated when NoteDb
5799is enabled).
Edwin Kempine3446292013-02-19 16:40:14 +01005800|`change_id` ||The Change-Id of the change.
5801|`subject` ||
5802The subject of the change (header line of the commit message).
5803|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01005804The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01005805|`created` ||
5806The link:rest-api.html#timestamp[timestamp] of when the change was
5807created.
5808|`updated` ||
5809The link:rest-api.html#timestamp[timestamp] of when the change was last
5810updated.
Khai Do96a7caf2016-01-07 14:07:54 -08005811|`submitted` |only set for merged changes|
5812The link:rest-api.html#timestamp[timestamp] of when the change was
5813submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04005814|`submitter` |only set for merged changes|
5815The user who submitted the change, as an
5816link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01005817|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02005818Whether the calling user has starred this change with the default label.
5819|`stars` |optional|
5820A list of star labels that are applied by the calling user to this
5821change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01005822|`reviewed` |not set if `false`|
5823Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07005824Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05005825|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01005826The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05005827Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01005828|`mergeable` |optional|
5829Whether the change is mergeable. +
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +01005830Not set for merged changes, if the change has not yet been tested, or
Patrick Hieseldb8df482019-01-24 10:11:23 +01005831if the link:#skip_mergeable[skip_mergeable] option is set or when
5832link:config-gerrit.html#change.api.excludeMergeableInChangeInfo[change.api.excludeMergeableInChangeInfo]
5833is set.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07005834|`submittable` |optional|
5835Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07005836Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005837|`insertions` ||
5838Number of inserted lines.
5839|`deletions` ||
5840Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07005841|`total_comment_count` |optional|
5842Total number of inline comments across all patch sets. Not set if the current
5843change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01005844|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07005845Number of unresolved inline comment threads across all patch sets. Not set if
5846the current change index doesn't have the data.
Edwin Kempine3446292013-02-19 16:40:14 +01005847|`_number` ||The legacy numeric ID of the change.
5848|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01005849The owner of the change as an link:rest-api-accounts.html#account-info[
5850AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07005851|`actions` |optional|
5852Actions the caller might be able to perform on this revision. The
5853information is a map of view name to link:#action-info[ActionInfo]
5854entities.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01005855|`requirements` |optional|
5856List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
5857can be submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01005858|`labels` |optional|
5859The labels of the change as a map that maps the label names to
5860link:#label-info[LabelInfo] entries. +
5861Only set if link:#labels[labels] or link:#detailed-labels[detailed
5862labels] are requested.
5863|`permitted_labels` |optional|
5864A map of the permitted labels that maps a label name to the list of
5865values that are allowed for that label. +
5866Only set if link:#detailed-labels[detailed labels] are requested.
5867|`removable_reviewers`|optional|
5868The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01005869link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01005870Only set if link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07005871|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08005872The reviewers as a map that maps a reviewer state to a list of
5873link:rest-api-accounts.html#account-info[AccountInfo] entities.
5874Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
5875`REVIEWER`: Users with at least one non-zero vote on the change. +
5876`CC`: Users that were added to the change, but have not voted. +
5877`REMOVED`: Users that were previously reviewers on the change, but have
5878been removed. +
5879Only set if link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07005880|`pending_reviewers` |optional|
5881Updates to `reviewers` that have been made while the change was in the
5882WIP state. Only present on WIP changes and only if there are pending
5883reviewer updates to report. These are reviewers who have not yet been
5884notified about being added to or removed from the change. +
5885Only set if link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07005886|`reviewer_updates`|optional|
5887Updates to reviewers set for the change as
5888link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02005889Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04005890|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07005891Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04005892link:#change-message-info[ChangeMessageInfo] entities. +
5893Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005894|`current_revision` |optional|
5895The commit ID of the current patch set of this change. +
5896Only set if link:#current-revision[the current revision] is requested
5897or if link:#all-revisions[all revisions] are requested.
5898|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05005899All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01005900patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08005901Only set if link:#current-revision[the current revision] is requested
5902(in which case it will only contain a key for the current revision) or
5903if link:#all-revisions[all revisions] are requested.
Makson Lee3568a932017-08-28 17:12:03 +08005904|`tracking_ids` |optional|
5905A list of link:#tracking-id-info[TrackingIdInfo] entities describing
5906references to external tracking systems. Only set if
5907link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005908|`_more_changes` |optional, not set if `false`|
5909Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08005910Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05005911|`problems` |optional|
5912A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08005913problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02005914|`is_private` |optional, not set if `false`|
5915When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01005916|`work_in_progress` |optional, not set if `false`|
5917When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07005918|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07005919When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02005920|`revert_of` |optional|
5921The numeric Change-Id of the change that this change reverts.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005922|==================================
5923
5924[[change-input]]
5925=== ChangeInput
5926The `ChangeInput` entity contains information about creating a new change.
5927
5928[options="header",cols="1,^1,5"]
5929|==================================
5930|Field Name ||Description
5931|`project` ||The name of the project.
5932|`branch` ||
5933The name of the target branch. +
5934The `refs/heads/` prefix is omitted.
5935|`subject` ||
David Pursehouse38cb32d2018-06-07 14:44:33 +09005936The commit message of the change. Comment lines (beginning with `#`) will
5937be removed.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005938|`topic` |optional|The topic to which this change belongs.
5939|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02005940The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02005941|`is_private` |optional, default to `false`|
5942Whether the new change should be marked as private.
5943|`work_in_progress` |optional, default to `false`|
5944Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01005945|`base_change` |optional|
5946A link:#change-id[\{change-id\}] that identifies the base change for a create
Aaron Gablee8e73282018-04-26 11:09:30 -07005947change operation. Mutually exclusive with `base_commit`.
5948|`base_commit` |optional|
5949A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
5950created change. If set, it must be a merged commit on the destination branch.
5951Mutually exclusive with `base_change`.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005952|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02005953Allow creating a new branch when set to `true`. Using this option is
5954only possible for non-merge commits (if the `merge` field is not set).
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005955|`merge` |optional|
5956The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02005957If set, the target branch (see `branch` field) must exist (it is not
5958possible to create it automatically by setting the `new_branch` field
5959to `true`.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01005960|`notify` |optional|
5961Notify handling that defines to whom email notifications should be sent
5962after the change is created. +
5963Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5964If not set, the default is `ALL`.
5965|`notify_details` |optional|
5966Additional information about whom to notify about the change creation
5967as a map of recipient type to link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01005968|==================================
5969
John Spurlock74a70cc2013-03-23 16:41:50 -04005970[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005971=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04005972The `ChangeMessageInfo` entity contains information about a message
5973attached to a change.
5974
David Pursehouseae367192014-11-25 17:24:47 +09005975[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04005976|==================================
5977|Field Name ||Description
5978|`id` ||The ID of the message.
5979|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07005980Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04005981link:rest-api-accounts.html#account-info[AccountInfo] entity. +
5982Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01005983|`real_author` |optional|
5984Real author of the message as an
5985link:rest-api-accounts.html#account-info[AccountInfo] entity. +
5986Set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04005987|`date` ||
5988The link:rest-api.html#timestamp[timestamp] this message was posted.
5989|`message` ||The text left by the user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005990|`tag` |optional|
5991Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00005992while posting the review. Votes/comments that contain `tag` with
5993'autogenerated:' prefix can be filtered out in the web UI.
5994NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005995invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04005996|`_revision_number` |optional|
5997Which patchset (if any) generated this message.
5998|==================================
5999
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006000[[cherry-pick-change-info]]
6001=== CherryPickChangeInfo
6002The `CherryPickChangeInfo` entity contains information about a
6003cherry-pick change.
6004
6005`CherryPickChangeInfo` has the same fields as link:#change-info[
6006ChangeInfo]. In addition `CherryPickChangeInfo` has the following
6007fields:
6008
6009[options="header",cols="1,^1,5"]
6010|======================================
6011|Field Name ||Description
6012|`contains_git_conflicts` |optional, not set if `false`|
6013Whether any file in the change contains Git conflict markers.
6014|======================================
6015
6016
Gustaf Lundh019fb262012-11-28 14:20:22 +01006017[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006018=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01006019The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
6020
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006021[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01006022|===========================
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006023|Field Name ||Description
Edwin Kempin159804b2019-09-23 11:09:39 +02006024|`message` |optional|
6025Commit message for the cherry-pick change. If not set, the commit message of
6026the cherry-picked commit is used.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006027|`destination` ||Destination branch
Changcheng Xiaoe3332582017-05-26 15:29:41 +02006028|`base` |optional|
602940-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
6030If set, it must be a merged commit or a change revision on the destination branch.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006031|`parent` |optional, defaults to 1|
6032Number of the parent relative to which the cherry-pick should be considered.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006033|`notify` |optional|
6034Notify handling that defines to whom email notifications should be sent
6035after the cherry-pick. +
6036Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02006037If not set, the default is `ALL`.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006038|`notify_details` |optional|
6039Additional information about whom to notify about the update as a map
6040of recipient type to link:#notify-info[NotifyInfo] entity.
Aaron Gable54bc9832017-07-05 14:44:36 -07006041|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006042If `true`, carries reviewers and ccs over from original change to newly created one.
6043|`allow_conflicts` |optional, defaults to false|
6044If `true`, the cherry-pick uses content merge and succeeds also if
6045there are conflicts. If there are conflicts the file contents of the
6046created change contain git conflict markers to indicate the conflicts.
6047Callers can find out if there were conflicts by checking the
6048`contains_git_conflicts` field in the link:#cherry-pick-change-info[
6049CherryPickChangeInfo] that is returned by the cherry-pick REST
Edwin Kempin3c4113a2018-10-12 10:49:33 +02006050endpoints. If there are conflicts the cherry-pick change is marked as
6051work-in-progress.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006052|===========================
6053
Edwin Kempincb6724a2013-02-26 16:58:51 +01006054[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006055=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05006056The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006057
David Pursehouseae367192014-11-25 17:24:47 +09006058[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01006059|===========================
6060|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07006061|`patch_set` |optional|
6062The patch set number for the comment; only set in contexts where +
6063comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04006064|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006065|`path` |optional|
6066The path of the file for which the inline comment was done. +
6067Not set if returned in a map where the key is the file path.
6068|`side` |optional|
6069The side on which the comment was added. +
6070Allowed values are `REVISION` and `PARENT`. +
6071If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01006072|`parent` |optional|
6073The 1-based parent number. Used only for merge commits when `side == PARENT`.
6074When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006075|`line` |optional|
6076The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04006077If range is set, this equals the end line of the range. +
6078If neither line nor range is set, it's a file comment.
6079|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006080The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006081entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006082|`in_reply_to` |optional|
6083The URL encoded UUID of the comment to which this comment is a reply.
6084|`message` |optional|The comment message.
6085|`updated` ||
6086The link:rest-api.html#timestamp[timestamp] of when this comment was
6087written.
John Spurlock5e402f02013-03-24 11:35:04 -04006088|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09006089The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04006090link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6091Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006092|`tag` |optional|
6093Value of the `tag` field from link:#review-input[ReviewInput] set
6094while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02006095NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006096invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006097|`unresolved` |optional|
6098Whether or not the comment must be addressed by the user. The state of
6099resolution of a comment thread is stored in the last comment in that thread
6100chronologically.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006101|===========================
6102
Edwin Kempin67498de2013-02-25 16:15:34 +01006103[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006104=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03006105The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01006106comment.
6107
David Pursehouseae367192014-11-25 17:24:47 +09006108[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006109|===========================
6110|Field Name ||Description
6111|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01006112The URL encoded UUID of the comment if an existing draft comment should
6113be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006114|`path` |optional|
6115The path of the file for which the inline comment should be added. +
6116Doesn't need to be set if contained in a map where the key is the file
6117path.
Edwin Kempin67498de2013-02-25 16:15:34 +01006118|`side` |optional|
6119The side on which the comment should be added. +
6120Allowed values are `REVISION` and `PARENT`. +
6121If not set, the default is `REVISION`.
6122|`line` |optional|
6123The number of the line for which the comment should be added. +
6124`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04006125If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09006126If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04006127|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006128The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006129entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01006130|`in_reply_to` |optional|
6131The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006132|`updated` |optional|
6133The link:rest-api.html#timestamp[timestamp] of this comment. +
6134Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01006135|`message` |optional|
6136The comment message. +
6137If not set and an existing draft comment is updated, the existing draft
6138comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04006139|`tag` |optional, drafts only|
6140Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
6141inputs; for published comments, use the `tag` field in +
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006142link#review-input[ReviewInput]. Votes/comments that contain `tag` with
6143'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006144|`unresolved` |optional|
6145Whether or not the comment must be addressed by the user. This value will
6146default to false if the comment is an orphan, or the value of the `in_reply_to`
6147comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01006148|===========================
6149
Michael Zhou596c7682013-08-25 05:43:34 -04006150[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006151=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04006152The `CommentRange` entity describes the range of an inline comment.
6153
Quinten Yearsley31786712018-07-16 13:44:33 -07006154The comment range is a range from the start position, specified by `start_line`
6155and `start_character`, to the end position, specified by `end_line` and
6156`end_character`. The start position is *inclusive* and the end position is
6157*exclusive*.
6158
6159So, a range over part of a line will have `start_line` equal to
6160`end_line`; however a range with `end_line` set to 5 and `end_character` equal
6161to 0 will not include any characters on line 5,
6162
David Pursehouseae367192014-11-25 17:24:47 +09006163[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04006164|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07006165|Field Name ||Description
6166|`start_line` ||The start line number of the range. (1-based)
6167|`start_character` ||The character position in the start line. (0-based)
6168|`end_line` ||The end line number of the range. (1-based)
6169|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04006170|===========================
6171
Edwin Kempine3446292013-02-19 16:40:14 +01006172[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006173=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006174The `CommitInfo` entity contains information about a commit.
6175
Edwin Kempinf0c57152015-07-15 18:18:24 +02006176[options="header",cols="1,^1,5"]
6177|===========================
6178|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02006179|`commit` |Optional|
6180The commit ID. Not set if included in a link:#revision-info[
6181RevisionInfo] entity that is contained in a map which has the commit ID
6182as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006183|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006184The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02006185link:#commit-info[CommitInfo] entities. In each parent
6186only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006187|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006188link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006189|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006190link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006191|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006192The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02006193|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01006194|`web_links` |optional|
6195Links to the commit in external sites as a list of
6196link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006197|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01006198
Patrick Hieselfda96452017-06-14 16:44:54 +02006199[[commit-message-input]]
6200=== CommitMessageInput
6201The `CommitMessageInput` entity contains information for changing
6202the commit message of a change.
6203
6204[options="header",cols="1,^1,5"]
6205|=============================
6206|Field Name ||Description
6207|`message` ||New commit message.
6208|`notify` |optional|
6209Notify handling that defines to whom email notifications should be sent
6210after the commit message was updated. +
6211Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07006212If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02006213|`notify_details`|optional|
6214Additional information about whom to notify about the update as a map
6215of recipient type to link:#notify-info[NotifyInfo] entity.
6216|=============================
6217
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02006218[[delete-change-message-input]]
6219=== DeleteChangeMessageInput
6220The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
6221
6222[options="header",cols="1,^1,5"]
6223|=============================
6224|Field Name ||Description
6225|`reason` |optional|
6226The reason why the change message should be deleted. +
6227If set, the change message will be replaced with
6228"Change message removed by: `name`\nReason: `reason`",
6229or just "Change message removed by: `name`." if not set.
6230|=============================
6231
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01006232[[delete-comment-input]]
6233=== DeleteCommentInput
6234The `DeleteCommentInput` entity contains the option for deleting a comment.
6235
6236[options="header",cols="1,^1,5"]
6237|=============================
6238|Field Name ||Description
6239|`reason` |optional|
6240The reason why the comment should be deleted. +
6241If set, the comment's message will be replaced with
6242"Comment removed by: `name`; Reason: `reason`",
6243or just "Comment removed by: `name`." if not set.
6244|=============================
6245
Edwin Kempin407fca32016-08-29 12:01:00 +02006246[[delete-reviewer-input]]
6247=== DeleteReviewerInput
6248The `DeleteReviewerInput` entity contains options for the deletion of a
6249reviewer.
6250
6251[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006252|=============================
6253|Field Name ||Description
6254|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02006255Notify handling that defines to whom email notifications should be sent
6256after the reviewer is deleted. +
6257Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6258If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006259|`notify_details`|optional|
6260Additional information about whom to notify about the update as a map
6261of recipient type to link:#notify-info[NotifyInfo] entity.
6262|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02006263
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006264[[delete-vote-input]]
6265=== DeleteVoteInput
6266The `DeleteVoteInput` entity contains options for the deletion of a
6267vote.
6268
6269[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006270|=============================
6271|Field Name ||Description
6272|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006273The label for which the vote should be deleted. +
6274If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01006275|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006276Notify handling that defines to whom email notifications should be sent
6277after the vote is deleted. +
6278Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6279If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006280|`notify_details`|optional|
6281Additional information about whom to notify about the update as a map
6282of recipient type to link:#notify-info[NotifyInfo] entity.
6283|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006284
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08006285[[description-input]]
6286=== DescriptionInput
6287The `DescriptionInput` entity contains information for setting a description.
6288
6289[options="header",cols="1,6"]
6290|===========================
6291|Field Name |Description
6292|`description` |The description text.
6293|===========================
6294
David Pursehouse882aef22013-06-05 10:56:37 +09006295[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006296=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09006297The `DiffContent` entity contains information about the content differences
6298in a file.
6299
David Pursehouseae367192014-11-25 17:24:47 +09006300[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09006301|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02006302|Field Name ||Description
6303|`a` |optional|Content only in the file on side A (deleted in B).
6304|`b` |optional|Content only in the file on side B (added in B).
6305|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02006306|`edit_a` |only present when the `intraline` parameter is set and the
6307DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09006308Text sections deleted from side A as a
6309link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02006310|`edit_b` |only present when the `intraline` parameter is set and the
6311DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09006312Text sections inserted in side B as a
6313link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02006314|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
6315rebase.
6316|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09006317too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02006318|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08006319to the requested ignore-whitespace parameter, but a and b contain
6320differing amounts of whitespace. When present and true a and b are
6321used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09006322|==========================
6323
6324[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006325=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09006326The `DiffFileMetaInfo` entity contains meta information about a file diff.
6327
David Pursehouseae367192014-11-25 17:24:47 +09006328[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09006329|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02006330|Field Name ||Description
6331|`name` ||The name of the file.
6332|`content_type`||The content type of the file.
6333|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01006334|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02006335Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07006336link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09006337|==========================
6338
6339[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006340=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09006341The `DiffInfo` entity contains information about the diff of a file
6342in a revision.
6343
Edwin Kempin8cdce502014-12-06 10:55:38 +01006344If the link:#weblinks-only[weblinks-only] parameter is specified, only
6345the `web_links` field is set.
6346
David Pursehouseae367192014-11-25 17:24:47 +09006347[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09006348|==========================
6349|Field Name ||Description
6350|`meta_a` |not present when the file is added|
6351Meta information about the file on side A as a
6352link:#diff-file-meta-info[DiffFileMetaInfo] entity.
6353|`meta_b` |not present when the file is deleted|
6354Meta information about the file on side B as a
6355link:#diff-file-meta-info[DiffFileMetaInfo] entity.
6356|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
6357`COPIED`, `REWRITE`).
6358|`intraline_status`|only set when the `intraline` parameter was specified in the request|
6359Intraline status (`OK`, `ERROR`, `TIMEOUT`).
6360|`diff_header` ||A list of strings representing the patch set diff header.
6361|`content` ||The content differences in the file as a list of
6362link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01006363|`web_links` |optional|
6364Links to the file diff in external sites as a list of
6365link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01006366|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09006367|==========================
6368
6369[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006370=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09006371The `DiffIntralineInfo` entity contains information about intraline edits in a
6372file.
6373
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02006374The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09006375the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02006376and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09006377following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02006378diff content lines. If the list is empty, the entire DiffContent should be considered
6379as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09006380
David Pursehouse31203f52013-06-08 17:05:45 +09006381Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07006382the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09006383
Edwin Kempin8cdce502014-12-06 10:55:38 +01006384[[diff-web-link-info]]
6385=== DiffWebLinkInfo
6386The `DiffWebLinkInfo` entity describes a link on a diff screen to an
6387external site.
6388
6389[options="header",cols="1,6"]
6390|=======================
6391|Field Name|Description
6392|`name` |The link name.
6393|`url` |The link URL.
6394|`image_url`|URL to the icon of the link.
6395|show_on_side_by_side_diff_view|
6396Whether the web link should be shown on the side-by-side diff screen.
6397|show_on_unified_diff_view|
6398Whether the web link should be shown on the unified diff screen.
6399|=======================
6400
David Ostrovsky9ea9c112015-01-25 00:12:38 +01006401[[edit-file-info]]
6402=== EditFileInfo
6403The `EditFileInfo` entity contains additional information
6404of a file within a change edit.
6405
6406[options="header",cols="1,^1,5"]
6407|===========================
6408|Field Name ||Description
6409|`web_links` |optional|
6410Links to the diff info in external sites as a list of
6411link:#web-link-info[WebLinkInfo] entities.
6412|===========================
6413
Edwin Kempin521c1242015-01-23 12:44:44 +01006414[[edit-info]]
6415=== EditInfo
6416The `EditInfo` entity contains information about a change edit.
6417
6418[options="header",cols="1,^1,5"]
6419|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09006420|Field Name ||Description
6421|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01006422link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09006423|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
6424|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09006425|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09006426|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01006427Information about how to fetch this patch set. The fetch information is
6428provided as a map that maps the protocol name ("`git`", "`http`",
6429"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09006430|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01006431The files of the change edit as a map that maps the file names to
6432link:#file-info[FileInfo] entities.
6433|===========================
6434
Edwin Kempine3446292013-02-19 16:40:14 +01006435[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006436=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006437The `FetchInfo` entity contains information about how to fetch a patch
6438set via a certain protocol.
6439
David Pursehouseae367192014-11-25 17:24:47 +09006440[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006441|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02006442|Field Name ||Description
6443|`url` ||The URL of the project.
6444|`ref` ||The ref of the patch set.
6445|`commands` |optional|
6446The download commands for this patch set as a map that maps the command
6447names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09006448Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006449|==========================
6450
6451[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006452=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006453The `FileInfo` entity contains information about a file in a patch set.
6454
David Pursehouseae367192014-11-25 17:24:47 +09006455[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006456|=============================
6457|Field Name ||Description
6458|`status` |optional|
6459The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
6460"`C`"=Copied, "`W`"=Rewritten). +
6461Not set if the file was Modified ("`M`").
6462|`binary` |not set if `false`|Whether the file is binary.
6463|`old_path` |optional|
6464The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05006465Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01006466|`lines_inserted`|optional|
6467Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02006468Not set for binary files or if no lines were inserted. +
6469An empty last line is not included in the count and hence this number can
6470differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01006471|`lines_deleted` |optional|
6472Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02006473Not set for binary files or if no lines were deleted. +
6474An empty last line is not included in the count and hence this number can
6475differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02006476|`size_delta` ||
6477Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01006478|`size` ||
6479File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01006480|=============================
6481
Dave Borowitzbad53ee2015-06-11 10:10:18 -04006482[[fix-input]]
6483=== FixInput
6484The `FixInput` entity contains options for fixing commits using the
6485link:#fix-change[fix change] endpoint.
6486
6487[options="header",cols="1,6"]
6488|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07006489|Field Name |Description
6490|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04006491database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07006492|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07006493merged into the destination branch as this exact SHA-1. If not, insert
6494a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04006495|==========================
6496
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006497[[fix-suggestion-info]]
6498=== FixSuggestionInfo
6499The `FixSuggestionInfo` entity represents a suggested fix.
6500
6501[options="header",cols="1,^1,5"]
6502|==========================
6503|Field Name ||Description
6504|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
6505fix. It will be generated automatically and hence will be ignored if it's set
6506for input objects.
6507|`description` ||A description of the suggested fix.
6508|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01006509entities indicating how the content of one or several files should be modified.
6510Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006511|==========================
6512
6513[[fix-replacement-info]]
6514=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01006515The `FixReplacementInfo` entity describes how the content of a file should be
6516replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006517
6518[options="header",cols="1,6"]
6519|==========================
6520|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01006521|`path` |The path of the file which should be modified. Any file in
6522the repository may be modified.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006523|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01006524of the file should be replaced. Lines in the file are assumed to be separated
6525by the line feed character, the carriage return character, the carriage return
6526followed by the line feed character, or one of the other Unicode linebreak
6527sequences supported by Java.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006528|`replacement` |The content which should be used instead of the current one.
6529|==========================
6530
Edwin Kempine3446292013-02-19 16:40:14 +01006531[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006532=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006533The `GitPersonInfo` entity contains information about the
6534author/committer of a commit.
6535
David Pursehouseae367192014-11-25 17:24:47 +09006536[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01006537|==========================
6538|Field Name |Description
6539|`name` |The name of the author/committer.
6540|`email` |The email address of the author/committer.
6541|`date` |The link:rest-api.html#timestamp[timestamp] of when
6542this identity was constructed.
6543|`tz` |The timezone offset from UTC of when this identity was
6544constructed.
6545|==========================
6546
Edwin Kempin521c1242015-01-23 12:44:44 +01006547[[group-base-info]]
6548=== GroupBaseInfo
6549The `GroupBaseInfo` entity contains base information about the group.
6550
6551[options="header",cols="1,6"]
6552|==========================
6553|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01006554|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01006555|`name` |The name of the group.
6556|==========================
6557
David Pursehoused9dac372016-11-24 19:41:10 +09006558[[hashtags-input]]
6559=== HashtagsInput
6560
6561The `HashtagsInput` entity contains information about hashtags to add to,
6562and/or remove from, a change.
6563
6564[options="header",cols="1,^1,5"]
6565|=======================
6566|Field Name||Description
6567|`add` |optional|The list of hashtags to be added to the change.
Mike Frysingere7428bb2021-02-09 14:26:02 -05006568|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09006569|=======================
6570
Edwin Kempin521c1242015-01-23 12:44:44 +01006571[[included-in-info]]
6572=== IncludedInInfo
6573The `IncludedInInfo` entity contains information about the branches a
6574change was merged into and tags it was tagged with.
6575
Edwin Kempin78279ba2015-05-22 15:22:41 +02006576[options="header",cols="1,^1,5"]
6577|=======================
6578|Field Name||Description
6579|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01006580Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02006581|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01006582Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02006583|`external`|optional|A map that maps a name to a list of external
6584systems that include this change, e.g. a list of servers on which this
6585change is deployed.
6586|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01006587
Edwin Kempine3446292013-02-19 16:40:14 +01006588[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006589=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07006590The `LabelInfo` entity contains information about a label on a change, always
6591corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01006592
Dave Borowitz88159512013-06-14 14:21:50 -07006593There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07006594link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07006595
6596* For a quick summary of the state of labels, use `LABELS`.
6597* For detailed information about labels, including exact numeric votes for all
6598 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
6599
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006600==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09006601[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006602|===========================
6603|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006604|`optional` |not set if `false`|
6605Whether the label is optional. Optional means the label may be set, but
6606it's neither necessary for submission nor does it block submission if
6607set.
Dave Borowitz88159512013-06-14 14:21:50 -07006608|===========================
6609
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006610==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09006611[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07006612|===========================
6613|Field Name ||Description
6614|`approved` |optional|One user who approved this label on the change
6615(voted the maximum value) as an
6616link:rest-api-accounts.html#account-info[AccountInfo] entity.
6617|`rejected` |optional|One user who rejected this label on the change
6618(voted the minimum value) as an
6619link:rest-api-accounts.html#account-info[AccountInfo] entity.
6620|`recommended` |optional|One user who recommended this label on the
6621change (voted positively, but not the maximum value) as an
6622link:rest-api-accounts.html#account-info[AccountInfo] entity.
6623|`disliked` |optional|One user who disliked this label on the change
6624(voted negatively, but not the minimum value) as an
6625link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01006626|`blocking` |optional|If `true`, the label blocks submit operation.
6627If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07006628|`value` |optional|The voting value of the user who
6629recommended/disliked this label on the change if it is not
6630"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07006631|`default_value`|optional|The default voting value for the label.
6632This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07006633|===========================
6634
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006635==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09006636[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07006637|===========================
6638|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006639|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07006640of link:#approval-info[ApprovalInfo] entities. Items in this list may
6641not represent actual votes cast by users; if a user votes on any label,
6642a corresponding ApprovalInfo will appear in this list for all labels.
Edwin Kempine3446292013-02-19 16:40:14 +01006643|`values` |optional|A map of all values that are allowed for this
6644label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07006645to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01006646|===========================
6647
Saša Živkov499873f2014-05-05 13:34:18 +02006648[[mergeable-info]]
6649=== MergeableInfo
6650The `MergeableInfo` entity contains information about the mergeability of a
6651change.
6652
David Pursehouseae367192014-11-25 17:24:47 +09006653[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02006654|============================
Saša Živkov697cab22014-04-29 16:46:50 +02006655|Field Name ||Description
6656|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02006657Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02006658`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02006659`CHERRY_PICK`.
Zhen Chenec13e452016-08-03 23:29:43 -07006660|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006661The strategy of the merge, can be `recursive`, `resolve`,
6662`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02006663|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02006664`true` if this change is cleanly mergeable, `false` otherwise
Zhen Chen8f00d552016-07-26 16:54:59 -07006665|`commit_merged` |optional|
6666`true` if this change is already merged, `false` otherwise
6667|`content_merged` |optional|
6668`true` if the content of this change is already merged, `false` otherwise
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006669|`conflicts`|optional|
6670A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02006671|`mergeable_into`|optional|
6672A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02006673|============================
Dave Borowitz88159512013-06-14 14:21:50 -07006674
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006675[[merge-input]]
6676=== MergeInput
6677The `MergeInput` entity contains information about the merge
6678
6679[options="header",cols="1,^1,5"]
6680|============================
6681|Field Name ||Description
6682|`source` ||
6683The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09006684a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
6685or `refs/remotes` namespace, etc.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006686|`strategy` |optional|
6687The strategy of the merge, can be `recursive`, `resolve`,
6688`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
6689|============================
6690
Zhen Chenb1e07e52016-09-23 12:59:48 -07006691[[merge-patch-set-input]]
6692=== MergePatchSetInput
6693The `MergePatchSetInput` entity contains information about updating a new
6694change by creating a new merge commit.
6695
6696[options="header",cols="1,^1,5"]
6697|==================================
6698|Field Name ||Description
6699|`subject` |optional|
6700The new subject for the change, if not specified, will reuse the current patch
6701set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01006702|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07006703Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02006704|`base_change` |optional|
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01006705A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02006706is `false`, the merge tip will be the current patch set of the `base_change` if
6707it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07006708|`merge` ||
6709The detail of the source commit for merge as a link:#merge-input[MergeInput]
6710entity.
6711|==================================
6712
Raviteja Sunkara791f3392015-11-03 13:24:50 +05306713[[move-input]]
6714=== MoveInput
6715The `MoveInput` entity contains information for moving a change to a new branch.
6716
6717[options="header",cols="1,^1,5"]
6718|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04006719|Field Name ||Description
6720|`destination_branch`||Destination branch
6721|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05306722A message to be posted in this change's comments
6723|===========================
6724
Edwin Kempincd07df42016-12-01 09:10:09 +01006725[[notify-info]]
6726=== NotifyInfo
6727The `NotifyInfo` entity contains detailed information about who should
6728be notified about an update. These notifications are sent out even if a
6729`notify` option in the request input disables normal notifications.
6730`NotifyInfo` entities are normally contained in a `notify_details` map
6731in the request input where the key is the recipient type. The recipient
6732type can be `TO`, `CC` and `BCC`.
6733
6734[options="header",cols="1,^1,5"]
6735|=======================
6736|Field Name||Description
6737|`accounts`|optional|
6738A list of link:rest-api-accounts.html#account-id[account IDs] that
6739identify the accounts that should be should be notified.
6740|=======================
6741
Edwin Kempin364a86b2017-04-27 12:34:00 +02006742[[private-input]]
6743=== PrivateInput
6744The `PrivateInput` entity contains information for changing the private
6745flag on a change.
6746
6747[options="header",cols="1,^1,5"]
6748|=======================
6749|Field Name||Description
6750|`message` |optional|Message describing why the private flag was changed.
6751|=======================
6752
Edwin Kempin521c1242015-01-23 12:44:44 +01006753[[problem-info]]
6754=== ProblemInfo
6755The `ProblemInfo` entity contains a description of a potential consistency problem
6756with a change. These are not related to the code review process, but rather
6757indicate some inconsistency in Gerrit's database or repository metadata related
6758to the enclosing change.
6759
6760[options="header",cols="1,^1,5"]
6761|===========================
6762|Field Name||Description
6763|`message` ||Plaintext message describing the problem with the change.
6764|`status` |optional|
6765The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
6766fix was attempted.
6767|`outcome` |optional|
6768If `status` is set, an additional plaintext message describing the
6769outcome of the fix.
6770|===========================
6771
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02006772[[publish-change-edit-input]]
6773=== PublishChangeEditInput
6774The `PublishChangeEditInput` entity contains options for the publishing of
6775change edit.
6776
6777[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006778|=============================
6779|Field Name ||Description
6780|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02006781Notify handling that defines to whom email notifications should be sent
6782after the change edit is published. +
6783Allowed values are `NONE` and `ALL`. +
6784If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006785|`notify_details`|optional|
6786Additional information about whom to notify about the update as a map
6787of recipient type to link:#notify-info[NotifyInfo] entity.
6788|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02006789
Patrick Hieselbb84fd72017-08-23 11:11:22 +02006790[[pure-revert-info]]
6791=== PureRevertInfo
6792The `PureRevertInfo` entity describes the result of a pure revert check.
6793
6794[options="header",cols="1,6"]
6795|======================
6796|Field Name |Description
6797|`is_pure_revert` |Outcome of the check as boolean.
6798|======================
6799
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04006800[[push-certificate-info]]
6801=== PushCertificateInfo
6802The `PushCertificateInfo` entity contains information about a push
6803certificate provided when the user pushed for review with `git push
6804--signed HEAD:refs/for/<branch>`. Only used when signed push is
6805link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
6806
6807[options="header",cols="1,6"]
6808|===========================
6809|Field Name|Description
6810|`certificate`|Signed certificate payload and GPG signature block.
6811|`key` |
6812Information about the key that signed the push, along with any problems
6813found while checking the signature or the key itself, as a
6814link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
6815|===========================
6816
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006817[[range-info]]
6818=== RangeInfo
6819The `RangeInfo` entity stores the coordinates of a range.
6820
6821[options="header",cols="1,6"]
6822|===========================
6823|Field Name | Description
6824|`start` | First index.
6825|`end` | Last index.
6826|===========================
6827
Zalan Blenessy874aed72015-01-12 13:26:18 +01006828[[rebase-input]]
6829=== RebaseInput
6830The `RebaseInput` entity contains information for changing parent when rebasing.
6831
6832[options="header",width="50%",cols="1,^1,5"]
6833|===========================
6834|Field Name ||Description
6835|`base` |optional|
6836The new parent revision. This can be a ref or a SHA1 to a concrete patchset. +
6837Alternatively, a change number can be specified, in which case the current
6838patch set is inferred. +
6839Empty string is used for rebasing directly on top of the target branch,
6840which effectively breaks dependency towards a parent change.
6841|===========================
6842
Edwin Kempin521c1242015-01-23 12:44:44 +01006843[[related-change-and-commit-info]]
6844=== RelatedChangeAndCommitInfo
6845
6846The `RelatedChangeAndCommitInfo` entity contains information about
6847a related change and commit.
6848
6849[options="header",cols="1,^1,5"]
6850|===========================
6851|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02006852|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01006853|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01006854|`commit` ||The commit as a
6855link:#commit-info[CommitInfo] entity.
6856|`_change_number` |optional|The change number.
6857|`_revision_number` |optional|The revision number.
6858|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07006859|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01006860the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempin521c1242015-01-23 12:44:44 +01006861|===========================
6862
6863[[related-changes-info]]
6864=== RelatedChangesInfo
6865The `RelatedChangesInfo` entity contains information about related
6866changes.
6867
6868[options="header",cols="1,6"]
6869|===========================
6870|Field Name |Description
6871|`changes` |A list of
6872link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
6873describing the related changes. Sorted by git commit order, newest to
6874oldest. Empty if there are no related changes.
6875|===========================
6876
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006877
6878[[requirement]]
6879=== Requirement
6880The `Requirement` entity contains information about a requirement relative to a change.
6881
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006882[options="header",cols="1,^1,5"]
6883|===========================
6884|Field Name | |Description
6885|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02006886|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006887|`type` | |
6888Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
6889was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
6890reason, and the data structure will follow one set of rules.
6891|`data` |optional|
6892Holds custom key-value strings, used in templates to render richer status messages
6893|===========================
6894
6895
Edwin Kempined5364b2013-02-22 10:39:33 +01006896[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006897=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006898The `RestoreInput` entity contains information for restoring a change.
6899
David Pursehouseae367192014-11-25 17:24:47 +09006900[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01006901|===========================
6902|Field Name ||Description
6903|`message` |optional|
6904Message to be added as review comment to the change when restoring the
6905change.
6906|===========================
6907
Edwin Kempind2ec4152013-02-22 12:17:19 +01006908[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006909=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01006910The `RevertInput` entity contains information for reverting a change.
6911
David Pursehouseae367192014-11-25 17:24:47 +09006912[options="header",cols="1,^1,5"]
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01006913|=============================
6914|Field Name ||Description
6915|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01006916Message to be added as review comment to the change when reverting the
6917change.
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01006918|`notify` |optional|
6919Notify handling that defines to whom email notifications should be sent
6920for reverting the change. +
6921Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6922If not set, the default is `ALL`.
6923|`notify_details`|optional|
6924Additional information about whom to notify about the revert as a map
6925of recipient type to link:#notify-info[NotifyInfo] entity.
Gal Paikincc93c562019-10-09 13:24:12 +02006926|`topic` |optional|
6927Name of the topic for the revert change. If not set, the default is the topic
6928of the change being reverted.
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01006929|=============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01006930
Edwin Kempin67498de2013-02-25 16:15:34 +01006931[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006932=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01006933The `ReviewInfo` entity contains information about a review.
6934
David Pursehouseae367192014-11-25 17:24:47 +09006935[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006936|===========================
6937|Field Name |Description
6938|`labels` |
6939The labels of the review as a map that maps the label names to the
6940voting values.
6941|===========================
6942
Viktar Donich316bf7a2016-07-06 11:29:01 -07006943[[review-update-info]]
6944=== ReviewerUpdateInfo
6945The `ReviewerUpdateInfo` entity contains information about updates to
6946change's reviewers set.
6947
6948[options="header",cols="1,6"]
6949|===========================
6950|Field Name |Description
6951|`updated`|
6952Timestamp of the update.
6953|`updated_by`|
6954The account which modified state of the reviewer in question as
6955link:rest-api-accounts.html#account-info[AccountInfo] entity.
6956|`reviewer`|
6957The reviewer account added or removed from the change as an
6958link:rest-api-accounts.html#account-info[AccountInfo] entity.
6959|`state`|
6960The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
6961|===========================
6962
Edwin Kempin67498de2013-02-25 16:15:34 +01006963[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006964=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01006965The `ReviewInput` entity contains information for adding a review to a
6966revision.
6967
David Pursehouseae367192014-11-25 17:24:47 +09006968[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006969|============================
Bill Wendling692b4ec2015-10-19 15:40:57 -07006970|Field Name ||Description
6971|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006972The message to be added as review comment.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006973|`tag` |optional|
6974Apply this tag to the review comment message, votes, and inline
6975comments. Tags may be used by CI or other automated systems to
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006976distinguish them from human reviews. Votes/comments that contain `tag` with
6977'autogenerated:' prefix can be filtered out in the web UI.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006978|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006979The votes that should be added to the revision as a map that maps the
6980label names to the voting values.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006981|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006982The comments that should be added as a map that maps a file path to a
6983list of link:#comment-input[CommentInput] entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006984|`robot_comments` |optional|
6985The robot comments that should be added as a map that maps a file path
6986to a list of link:#robot-comment-input[RobotCommentInput] entities.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006987|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006988Draft handling that defines how draft comments are handled that are
6989already in the database but that were not also described in this
6990input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05006991Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
6992except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04006993Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05006994If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
6995besides `KEEP` is allowed.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006996|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006997Notify handling that defines to whom email notifications should be sent
6998after the review is stored. +
6999Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7000If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007001|`notify_details` |optional|
7002Additional information about whom to notify about the update as a map
7003of recipient type to link:#notify-info[NotifyInfo] entity.
Bill Wendling692b4ec2015-10-19 15:40:57 -07007004|`omit_duplicate_comments`|optional|
7005If `true`, comments with the same content at the same place will be omitted.
7006|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07007007link:rest-api-accounts.html#account-id[\{account-id\}] the review
7008should be posted on behalf of. To use this option the caller must
7009have been granted `labelAs-NAME` permission for all keys of labels.
Patrick Hieselcf6d9352017-04-13 10:15:42 +02007010|`reviewers` |optional|
7011A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
7012representing reviewers that should be added to the change.
Logan Hanks53c36012017-06-30 13:47:54 -07007013|`ready` |optional|
7014If true, and if the change is work in progress, then start review.
7015It is an error for both `ready` and `work_in_progress` to be true.
7016|`work_in_progress` |optional|
7017If true, mark the change as work in progress. It is an error for both
7018`ready` and `work_in_progress` to be true.
Edwin Kempin67498de2013-02-25 16:15:34 +01007019|============================
7020
Aaron Gable843b0c12017-04-21 08:25:27 -07007021[[review-result]]
7022=== ReviewResult
7023The `ReviewResult` entity contains information regarding the updates
7024that were made to a review.
7025
7026[options="header",cols="1,^1,5"]
7027|============================
7028|Field Name ||Description
7029|`labels` |optional|
7030Map of labels to values after the review was posted. Null if any reviewer
7031additions were rejected.
7032|`reviewers` |optional|
7033Map of account or group identifier to
7034link:rest-api-changes.html#add-reviewer-result[AddReviewerResult]
7035representing the outcome of adding as a reviewer.
7036Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07007037|`ready` |optional|
7038If true, the change was moved from WIP to ready for review as a result of this
7039action. Not set if false.
Aaron Gable843b0c12017-04-21 08:25:27 -07007040|============================
7041
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007042[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007043=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007044The `ReviewerInfo` entity contains information about a reviewer and its
7045votes on a change.
7046
Edwin Kempin963dfd02013-02-27 12:39:32 +01007047`ReviewerInfo` has the same fields as
7048link:rest-api-accounts.html#account-info[AccountInfo] and includes
7049link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007050In addition `ReviewerInfo` has the following fields:
7051
David Pursehouseae367192014-11-25 17:24:47 +09007052[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007053|==========================
7054|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007055|`approvals` |
7056The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09007057approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01007058|`_account_id` |
7059This field is inherited from `AccountInfo` but is optional here if an
7060unregistered reviewer was added by email. See
7061link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007062|==========================
7063
Edwin Kempin392328e2013-02-25 12:50:03 +01007064[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007065=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01007066The `ReviewerInput` entity contains information for adding a reviewer
7067to a change.
7068
David Pursehouseae367192014-11-25 17:24:47 +09007069[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007070|=============================
7071|Field Name ||Description
7072|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01007073The link:rest-api-accounts.html#account-id[ID] of one account that
7074should be added as reviewer or the link:rest-api-groups.html#group-id[
7075ID] of one group for which all members should be added as reviewers. +
7076If an ID identifies both an account and a group, only the account is
7077added as reviewer to the change.
Edwin Kempincd07df42016-12-01 09:10:09 +01007078|`state` |optional|
Logan Hanksee0a4182016-07-06 14:39:26 -07007079Add reviewer in this state. Possible reviewer states are `REVIEWER`
7080and `CC`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007081|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01007082Whether adding the reviewer is confirmed. +
7083The Gerrit server may be configured to
7084link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
7085confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01007086|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02007087Notify handling that defines to whom email notifications should be sent
7088after the reviewer is added. +
7089Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7090If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007091|`notify_details`|optional|
7092Additional information about whom to notify about the update as a map
7093of recipient type to link:#notify-info[NotifyInfo] entity.
7094|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01007095
Edwin Kempine3446292013-02-19 16:40:14 +01007096[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007097=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007098The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07007099Not all fields are returned by default. Additional fields can
7100be obtained by adding `o` parameters as described in
7101link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01007102
David Pursehouseae367192014-11-25 17:24:47 +09007103[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007104|===========================
7105|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09007106|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
7107`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08007108|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01007109|`created` ||
7110The link:rest-api.html#timestamp[timestamp] of when the patch set was
7111created.
7112|`uploader` ||
7113The uploader of the patch set as an
7114link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01007115|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007116|`fetch` ||
7117Information about how to fetch this patch set. The fetch information is
7118provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07007119"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
7120only included if a plugin implementing the
7121link:intro-project-owner.html#download-commands[download commands]
7122interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07007123|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01007124link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07007125|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01007126The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07007127link:#file-info[FileInfo] entities. Only set if
7128link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
7129option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07007130|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07007131Actions the caller might be able to perform on this revision. The
7132information is a map of view name to link:#action-info[ActionInfo]
7133entities.
Khai Dob3139b7532014-09-19 15:13:04 -07007134|`reviewed` |optional|
7135Indicates whether the caller is authenticated and has commented on the
7136current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07007137|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07007138If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
7139this is the current patch set, contains the full commit message with
7140Gerrit-specific commit footers, as if this revision were submitted
7141using the link:project-configuration.html#cherry_pick[Cherry Pick]
7142submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007143|`push_certificate` |optional|
7144If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
7145contains the push certificate provided by the user when uploading this
7146patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
7147This field is always set if the option is requested; if no push
7148certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07007149|`description` |optional|
7150The description of this patchset, as displayed in the patchset
7151selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01007152|===========================
7153
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007154[[robot-comment-info]]
7155=== RobotCommentInfo
7156The `RobotCommentInfo` entity contains information about a robot inline
7157comment.
7158
Alice Kober-Sotzek265805d2016-12-07 15:24:21 +01007159`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007160In addition `RobotCommentInfo` has the following fields:
7161
7162[options="header",cols="1,^1,5"]
7163|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007164|Field Name ||Description
7165|`robot_id` ||The ID of the robot that generated this comment.
7166|`robot_run_id` ||An ID of the run of the robot.
7167|`url` |optional|URL to more information.
7168|`properties` |optional|Robot specific properties as map that maps arbitrary
7169keys to values.
7170|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
7171<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007172|===========================
7173
7174[[robot-comment-input]]
7175=== RobotCommentInput
7176The `RobotCommentInput` entity contains information for creating an inline
7177robot comment.
7178
Alice Kober-Sotzek265805d2016-12-07 15:24:21 +01007179`RobotCommentInput` has the same fields as
7180<<robot-comment-info,RobotCommentInfo>>.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007181
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007182[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007183=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007184The `RuleInput` entity contains information to test a Prolog rule.
7185
David Pursehouseae367192014-11-25 17:24:47 +09007186[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007187|===========================
7188|Field Name ||Description
7189|`rule`||
7190Prolog code to execute instead of the code in `refs/meta/config`.
7191|`filters`|`RUN` if not set|
7192When `RUN` filter rules in the parent projects are called to
7193post-process the results of the project specific rule. This
7194behavior matches how the rule will execute if installed. +
7195If `SKIP` the parent filters are not called, allowing the test
7196to return results from the input rule.
7197|===========================
7198
Edwin Kempin14b58112013-02-26 16:30:19 +01007199[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007200=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01007201The `SubmitInfo` entity contains information about the change status
7202after submitting.
7203
Stefan Bellere4785b42015-06-18 12:31:03 -07007204[options="header",cols="1,^1,5"]
Edwin Kempin14b58112013-02-26 16:30:19 +01007205|==========================
Stefan Bellere4785b42015-06-18 12:31:03 -07007206|Field Name ||Description
7207|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07007208The status of the change after submitting is `MERGED`.
David Ostrovsky868e3412014-01-30 19:50:57 +01007209|`on_behalf_of`|optional|
7210The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
7211whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09007212have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
7213The user named by `on_behalf_of` does not need to be granted the `Submit`
7214permission. This feature is aimed for CI solutions: the CI account can be
David Pursehousea61ee502016-09-06 16:27:09 +09007215granted both permissions, so individual users don't need `Submit` permission
7216themselves. Still the changes can be submitted on behalf of real users and
David Pursehouse22bd6f92014-02-20 21:11:01 +09007217not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01007218|==========================
7219
Edwin Kempin0eddba02013-02-22 15:30:12 +01007220[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007221=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01007222The `SubmitInput` entity contains information for submitting a change.
7223
David Pursehouseae367192014-11-25 17:24:47 +09007224[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007225|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01007226|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01007227|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05007228If set, submit the change on behalf of the given user. The value may take any
7229format link:rest-api-accounts.html#account-id[accepted by the accounts REST
7230API]. Using this option requires
7231link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
7232permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01007233|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07007234Notify handling that defines to whom email notifications should be sent after
7235the change is submitted. +
7236Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7237If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007238|`notify_details`|optional|
7239Additional information about whom to notify about the update as a map
7240of recipient type to link:#notify-info[NotifyInfo] entity.
7241|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01007242
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007243[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007244=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007245The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02007246Fields in this entity roughly correspond to the fields set by `LABELS`
7247in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007248
David Pursehouseae367192014-11-25 17:24:47 +09007249[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007250|===========================
7251|Field Name ||Description
7252|`status`||
7253`OK`, the change can be submitted. +
7254`NOT_READY`, additional labels are required before submit. +
7255`CLOSED`, closed changes cannot be submitted. +
7256`RULE_ERROR`, rule code failed with an error.
7257|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01007258Map of labels that are approved; an
7259link:rest-api-accounts.html#account-info[AccountInfo] identifies the
7260voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007261|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01007262Map of labels that are preventing submit;
7263link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007264|`need`|optional|
7265Map of labels that need to be given to submit. The value is
7266currently an empty object.
7267|`may`|optional|
7268Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01007269link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
7270if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08007271|`impossible`|optional|
7272Map of labels that should have been in `need` but cannot be
7273used by any user because of access restrictions. The value
7274is currently an empty object.
7275|`error_message`|optional|
7276When status is RULE_ERROR this message provides some text describing
7277the failure of the rule predicate.
7278|===========================
7279
Jonathan Nieder2a629b02016-06-16 15:15:25 -07007280[[submitted-together-info]]
7281=== SubmittedTogetherInfo
7282The `SubmittedTogetherInfo` entity contains information about a
7283collection of changes that would be submitted together.
7284
7285[options="header",cols="1,6"]
7286|===========================
7287|Field Name |Description
7288|`changes` |
7289A list of ChangeInfo entities representing the changes to be submitted together.
7290|`non_visible_changes`|
7291The number of changes to be submitted together that the current user
7292cannot see. (This count includes changes that are visible to the
7293current user when their reason for being submitted together involves
7294changes the user cannot see.)
7295|===========================
7296
Edwin Kempin521c1242015-01-23 12:44:44 +01007297[[suggested-reviewer-info]]
7298=== SuggestedReviewerInfo
7299The `SuggestedReviewerInfo` entity contains information about a reviewer
7300that can be added to a change (an account or a group).
7301
7302`SuggestedReviewerInfo` has either the `account` field that contains
7303the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
7304the `group` field that contains the
7305link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
7306
Logan Hanksab3c81e2016-07-20 15:42:52 -07007307[options="header",cols="1,^1,5"]
7308|===========================
7309|Field Name ||Description
7310|`account` |optional|
7311An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
7312suggestion is an account.
7313|`group` |optional|
7314A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
7315suggestion is a group.
7316|`count` ||
7317The total number of accounts in the suggestion. This is `1` if `account` is
7318present. If `group` is present, the total number of accounts that are
7319members of the group is returned (this count includes members of nested
7320groups).
7321|`confirm` |optional|
7322True if `group` is present and `count` is above the threshold where the
7323`confirmed` flag must be passed to add the group as a reviewer.
7324|===========================
7325
Edwin Kempin64006bb2013-02-22 08:17:04 +01007326[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007327=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01007328The `TopicInput` entity contains information for setting a topic.
7329
David Pursehouseae367192014-11-25 17:24:47 +09007330[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01007331|===========================
7332|Field Name ||Description
7333|`topic` |optional|The topic. +
7334The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01007335|===========================
7336
Makson Lee3568a932017-08-28 17:12:03 +08007337[[tracking-id-info]]
7338=== TrackingIdInfo
7339The `TrackingIdInfo` entity describes a reference to an external tracking system.
7340
7341[options="header",cols="1,6"]
7342|======================
7343|Field Name|Description
7344|`system` |The name of the external tracking system.
7345|`id` |The tracking id.
7346|======================
7347
Oleg Aravinbf313bb2016-10-24 12:28:56 -07007348[[voting-range-info]]
7349=== VotingRangeInfo
7350The `VotingRangeInfo` entity describes the continuous voting range from min
7351to max values.
7352
7353[options="header",cols="1,6"]
7354|======================
7355|Field Name|Description
7356|`min` |The minimum voting value.
7357|`max` |The maximum voting value.
7358|======================
7359
Edwin Kempinbd885ff2014-04-11 16:11:56 +02007360[[web-link-info]]
7361=== WebLinkInfo
7362The `WebLinkInfo` entity describes a link to an external site.
7363
David Pursehouseae367192014-11-25 17:24:47 +09007364[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02007365|======================
7366|Field Name|Description
7367|`name` |The link name.
7368|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02007369|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02007370|======================
7371
Alan Tokaev392cfca2017-04-28 11:11:31 +02007372[[work-in-progress-input]]
7373=== WorkInProgressInput
7374The `WorkInProgressInput` entity contains additional information for a change
7375set to WorkInProgress/ReadyForReview.
7376
7377[options="header",cols="1,^1,5"]
7378|=============================
7379|Field Name ||Description
7380|`message` |optional|
7381Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
7382|=============================
7383
Edwin Kempind0a63922013-01-23 16:32:59 +01007384GERRIT
7385------
7386Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07007387
7388SEARCHBOX
7389---------