blob: 06ac846b4a639b84feef51f6418cf33e15335bc9 [file] [log] [blame]
Edwin Kempin2eebd142013-03-06 15:28:34 +01001Gerrit Code Review - /changes/ REST API
2=======================================
Edwin Kempind0a63922013-01-23 16:32:59 +01003
4This page describes the change related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008[[change-endpoints]]
9Change Endpoints
10----------------
Edwin Kempind0a63922013-01-23 16:32:59 +010011
Edwin Kempin76202742013-02-15 13:51:50 +010012[[list-changes]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010013Query Changes
14~~~~~~~~~~~~~
15[verse]
16'GET /changes/'
17
Edwin Kempind0a63922013-01-23 16:32:59 +010018Queries changes visible to the caller. The query string must be
19provided by the `q` parameter. The `n` parameter can be used to limit
20the returned results.
21
Edwin Kempine3446292013-02-19 16:40:14 +010022As result a list of link:#change-info[ChangeInfo] entries is returned.
23The change output is sorted by the last update time, most recently
24updated to oldest updated.
25
Edwin Kempind0a63922013-01-23 16:32:59 +010026Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010027
28.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010029----
Edwin Kempin2091edb2013-01-23 19:07:38 +010030 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010031----
Edwin Kempind0a63922013-01-23 16:32:59 +010032
Edwin Kempin37440832013-02-06 11:36:00 +010033.Response
34----
Edwin Kempind0a63922013-01-23 16:32:59 +010035 HTTP/1.1 200 OK
36 Content-Disposition: attachment
37 Content-Type: application/json;charset=UTF-8
38
39 )]}'
40 {
41 "kind": "gerritcodereview#change",
42 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
43 "project": "demo",
44 "branch": "master",
45 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
46 "subject": "One change",
47 "status": "NEW",
48 "created": "2012-07-17 07:18:30.854000000",
49 "updated": "2012-07-17 07:19:27.766000000",
50 "reviewed": true,
Edwin Kempindb1f0b82013-02-21 15:07:00 +010051 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +010052 "_sortkey": "001e7057000006dc",
53 "_number": 1756,
54 "owner": {
55 "name": "John Doe"
56 },
57 },
58 {
59 "kind": "gerritcodereview#change",
60 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
61 "project": "demo",
62 "branch": "master",
63 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
64 "subject": "Another change",
65 "status": "NEW",
66 "created": "2012-07-17 07:18:30.884000000",
67 "updated": "2012-07-17 07:18:30.885000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +010068 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +010069 "_sortkey": "001e7056000006dd",
70 "_number": 1757,
71 "owner": {
72 "name": "John Doe"
73 },
74 "_more_changes": true
75 }
76----
77
Edwin Kempind0a63922013-01-23 16:32:59 +010078If the `n` query parameter is supplied and additional changes exist
79that match the query beyond the end, the last change object has a
80`_more_changes: true` JSON field set. Callers can resume a query with
Christian Aistleitner55364012013-02-17 12:18:22 +010081the `N` query parameter, supplying the last change's `_sortkey` field
82as the value. When going in the reverse direction with the `P` query
Edwin Kempind0a63922013-01-23 16:32:59 +010083parameter a `_more_changes: true` is put in the first change object if
84there are results *before* the first change returned.
85
86Clients are allowed to specify more than one query by setting the `q`
87parameter multiple times. In this case the result is an array of
88arrays, one per query in the same order the queries were given in.
89
Edwin Kempina64c4b92013-01-23 11:30:40 +010090.Query for the 25 most recent open changes of the projects that you watch
91****
92get::/changes/?q=status:open+is:watched&n=25
93****
94
Edwin Kempind0a63922013-01-23 16:32:59 +010095Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +010096
97.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010098----
99 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 +0100100----
Edwin Kempind0a63922013-01-23 16:32:59 +0100101
Edwin Kempin37440832013-02-06 11:36:00 +0100102.Response
103----
Edwin Kempind0a63922013-01-23 16:32:59 +0100104 HTTP/1.1 200 OK
105 Content-Disposition: attachment
106 Content-Type: application/json;charset=UTF-8
107
108 )]}'
109 [
110 [
111 {
112 "kind": "gerritcodereview#change",
113 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
114 "project": "demo",
115 "branch": "master",
116 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
117 "subject": "One change",
118 "status": "NEW",
119 "created": "2012-07-17 07:18:30.854000000",
120 "updated": "2012-07-17 07:19:27.766000000",
121 "reviewed": true,
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100122 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100123 "_sortkey": "001e7057000006dc",
124 "_number": 1756,
125 "owner": {
126 "name": "John Doe"
127 },
128 "labels": {
129 "Verified": {},
130 "Code-Review": {}
131 }
132 }
133 ],
134 [],
135 []
136 ]
137----
138
Edwin Kempina64c4b92013-01-23 11:30:40 +0100139.Query the changes for your user dashboard
140****
141get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
142****
143
Edwin Kempind0a63922013-01-23 16:32:59 +0100144Additional fields can be obtained by adding `o` parameters, each
145option requires more database lookups and slows down the query
146response time to the client so they are generally disabled by
147default. Optional fields are:
148
Edwin Kempine3446292013-02-19 16:40:14 +0100149[[labels]]
150--
Edwin Kempind0a63922013-01-23 16:32:59 +0100151* `LABELS`: a summary of each label required for submit, and
152 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100153--
Edwin Kempind0a63922013-01-23 16:32:59 +0100154
Edwin Kempine3446292013-02-19 16:40:14 +0100155[[detailed-labels]]
156--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800157* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800158 values of all existing approvals, recognized label values, values
159 permitted to be set by the current user, and reviewers that may be
160 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100161--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800162
Edwin Kempine3446292013-02-19 16:40:14 +0100163[[current-revision]]
164--
Edwin Kempind0a63922013-01-23 16:32:59 +0100165* `CURRENT_REVISION`: describe the current revision (patch set)
166 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100167--
Edwin Kempind0a63922013-01-23 16:32:59 +0100168
Edwin Kempine3446292013-02-19 16:40:14 +0100169[[all-revisions]]
170--
Edwin Kempind0a63922013-01-23 16:32:59 +0100171* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100172--
Edwin Kempind0a63922013-01-23 16:32:59 +0100173
Edwin Kempine3446292013-02-19 16:40:14 +0100174[[current-commit]]
175--
Edwin Kempind0a63922013-01-23 16:32:59 +0100176* `CURRENT_COMMIT`: parse and output all header fields from the
177 commit object, including message. Only valid when the current
178 revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100179--
Edwin Kempind0a63922013-01-23 16:32:59 +0100180
Edwin Kempine3446292013-02-19 16:40:14 +0100181[[all-commits]]
182--
Edwin Kempind0a63922013-01-23 16:32:59 +0100183* `ALL_COMMITS`: parse and output all header fields from the
184 output revisions. If only `CURRENT_REVISION` was requested
185 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100186--
Edwin Kempind0a63922013-01-23 16:32:59 +0100187
Edwin Kempine3446292013-02-19 16:40:14 +0100188[[current-files]]
189--
Edwin Kempind0a63922013-01-23 16:32:59 +0100190* `CURRENT_FILES`: list files modified by the commit, including
191 basic line counts inserted/deleted per file. Only valid when
192 the current revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100193--
Edwin Kempind0a63922013-01-23 16:32:59 +0100194
Edwin Kempine3446292013-02-19 16:40:14 +0100195[[all-files]]
196--
Edwin Kempind0a63922013-01-23 16:32:59 +0100197* `ALL_FILES`: list files modified by the commit, including
198 basic line counts inserted/deleted per file. If only the
199 `CURRENT_REVISION` was requested the only that commit's
200 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100201--
Edwin Kempind0a63922013-01-23 16:32:59 +0100202
Edwin Kempine3446292013-02-19 16:40:14 +0100203[[detailed-accounts]]
204--
Dave Borowitz8926a882013-02-01 14:32:48 -0800205* `DETAILED_ACCOUNTS`: include `_account_id` and `email` fields when
206 referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100207--
Dave Borowitz8926a882013-02-01 14:32:48 -0800208
Edwin Kempin37440832013-02-06 11:36:00 +0100209.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100210----
211 GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100212----
Edwin Kempind0a63922013-01-23 16:32:59 +0100213
Edwin Kempin37440832013-02-06 11:36:00 +0100214.Response
215----
Edwin Kempind0a63922013-01-23 16:32:59 +0100216 HTTP/1.1 200 OK
217 Content-Disposition: attachment
218 Content-Type: application/json;charset=UTF-8
219
220 )]}'
221 [
222 {
223 "kind": "gerritcodereview#change",
224 "id": "demo~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
225 "project": "gerrit",
226 "branch": "master",
227 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
228 "subject": "Use an EventBus to manage star icons",
229 "status": "NEW",
230 "created": "2012-04-25 00:52:25.580000000",
231 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100232 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100233 "_sortkey": "001c9bf400000061",
234 "_number": 97,
235 "owner": {
236 "name": "Shawn Pearce"
237 },
238 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
239 "revisions": {
240 "184ebe53805e102605d11f6b143486d15c23a09c": {
241 "_number": 1,
242 "fetch": {
243 "git": {
244 "url": "git://localhost/gerrit",
245 "ref": "refs/changes/97/97/1"
246 },
247 "http": {
248 "url": "http://127.0.0.1:8080/gerrit",
249 "ref": "refs/changes/97/97/1"
250 }
251 },
252 "commit": {
253 "parents": [
254 {
255 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
256 "subject": "Migrate contributor agreements to All-Projects."
257 }
258 ],
259 "author": {
260 "name": "Shawn O. Pearce",
261 "email": "sop@google.com",
262 "date": "2012-04-24 18:08:08.000000000",
263 "tz": -420
264 },
265 "committer": {
266 "name": "Shawn O. Pearce",
267 "email": "sop@google.com",
268 "date": "2012-04-24 18:08:08.000000000",
269 "tz": -420
270 },
271 "subject": "Use an EventBus to manage star icons",
272 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
273 },
274 "files": {
275 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
276 "lines_deleted": 8
277 },
278 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
279 "lines_inserted": 1
280 },
281 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
282 "lines_inserted": 11,
283 "lines_deleted": 19
284 },
285 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
286 "lines_inserted": 23,
287 "lines_deleted": 20
288 },
289 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
290 "status": "D",
291 "lines_deleted": 139
292 },
293 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
294 "status": "A",
295 "lines_inserted": 204
296 },
297 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
298 "lines_deleted": 9
299 }
300 }
301 }
302 }
303 }
304 ]
305----
306
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100307[[get-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100308Get Change
309~~~~~~~~~~
310[verse]
311'GET /changes/link:#change-id[\{change-id\}]'
312
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100313Retrieves a change.
314
315.Request
316----
317 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
318----
319
320As response a link:#change-info[ChangeInfo] entity is returned that
321describes the change.
322
323.Response
324----
325 HTTP/1.1 200 OK
326 Content-Disposition: attachment
327 Content-Type: application/json;charset=UTF-8
328
329 )]}'
330 {
331 "kind": "gerritcodereview#change",
332 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
333 "project": "myProject",
334 "branch": "master",
335 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
336 "subject": "Implementing Feature X",
337 "status": "NEW",
338 "created": "2013-02-01 09:59:32.126000000",
339 "updated": "2013-02-21 11:16:36.775000000",
340 "reviewed": true,
341 "mergeable": true,
342 "_sortkey": "0023412400000f7d",
343 "_number": 3965,
344 "owner": {
345 "name": "John Doe"
346 }
347 }
348----
349
Edwin Kempin8e492202013-02-21 15:38:25 +0100350[[get-change-detail]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100351Get Change Detail
352~~~~~~~~~~~~~~~~~
353[verse]
354'GET /changes/link:#change-id[\{change-id\}]/detail'
355
Edwin Kempin8e492202013-02-21 15:38:25 +0100356Retrieves a change with link:#labels[labels], link:#detailed-labels[
357detailed labels] and link:#detailed-accounts[detailed accounts].
358
359.Request
360----
361 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
362----
363
364As response a link:#change-info[ChangeInfo] entity is returned that
365describes the change.
366
367.Response
368----
369 HTTP/1.1 200 OK
370 Content-Disposition: attachment
371 Content-Type: application/json;charset=UTF-8
372
373 )]}'
374 {
375 "kind": "gerritcodereview#change",
376 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
377 "project": "myProject",
378 "branch": "master",
379 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
380 "subject": "Implementing Feature X",
381 "status": "NEW",
382 "created": "2013-02-01 09:59:32.126000000",
383 "updated": "2013-02-21 11:16:36.775000000",
384 "reviewed": true,
385 "mergeable": true,
386 "_sortkey": "0023412400000f7d",
387 "_number": 3965,
388 "owner": {
389 "_account_id": 1000096,
390 "name": "John Doe",
391 "email": "john.doe@example.com"
392 },
393 "labels": {
394 "Verified": {
395 "all": [
396 {
397 "value": 0,
398 "_account_id": 1000096,
399 "name": "John Doe",
400 "email": "john.doe@example.com"
401 },
402 {
403 "value": 0,
404 "_account_id": 1000097,
405 "name": "Jane Roe",
406 "email": "jane.roe@example.com"
407 }
408 ],
409 "values": {
410 "-1": "Fails",
411 " 0": "No score",
412 "+1": "Verified"
413 }
414 },
415 "Code-Review": {
416 "recommended": {
417 "_account_id": 1000097,
418 "name": "Jane Roe",
419 "email": "jane.roe@example.com"
420 },
421 "disliked": {
422 "_account_id": 1000096,
423 "name": "John Doe",
424 "email": "john.doe@example.com"
425 },
426 "all": [
427 {
428 "value": -1,
429 "_account_id": 1000096,
430 "name": "John Doe",
431 "email": "john.doe@example.com"
432 },
433 {
434 "value": 1,
435 "_account_id": 1000097,
436 "name": "Jane Roe",
437 "email": "jane.roe@example.com"
438 }
439 ]
440 "values": {
441 "-2": "Do not submit",
442 "-1": "I would prefer that you didn\u0027t submit this",
443 " 0": "No score",
444 "+1": "Looks good to me, but someone else must approve",
445 "+2": "Looks good to me, approved"
446 }
447 }
448 },
449 "permitted_labels": {
450 "Verified": [
451 "-1",
452 " 0",
453 "+1"
454 ],
455 "Code-Review": [
456 "-2",
457 "-1",
458 " 0",
459 "+1",
460 "+2"
461 ]
462 },
463 "removable_reviewers": [
464 {
465 "_account_id": 1000096,
466 "name": "John Doe",
467 "email": "john.doe@example.com"
468 },
469 {
470 "_account_id": 1000097,
471 "name": "Jane Roe",
472 "email": "jane.roe@example.com"
473 }
474 ]
475 }
476----
477
Edwin Kempin64006bb2013-02-22 08:17:04 +0100478[[get-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100479Get Topic
480~~~~~~~~~
481[verse]
482'GET /changes/link:#change-id[\{change-id\}]/topic'
483
Edwin Kempin64006bb2013-02-22 08:17:04 +0100484Retrieves the topic of a change.
485
486.Request
487----
488 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
489----
490
491.Response
492----
493 HTTP/1.1 200 OK
494 Content-Disposition: attachment
495 Content-Type: application/json;charset=UTF-8
496
497 )]}'
498 "Documentation"
499----
500
501If the change does not have a topic an empty string is returned.
502
503[[set-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100504Set Topic
505~~~~~~~~~
506[verse]
507'PUT /changes/link:#change-id[\{change-id\}]/topic'
508
Edwin Kempin64006bb2013-02-22 08:17:04 +0100509Sets the topic of a change.
510
511The new topic must be provided in the request body inside a
512link:#topic-input[TopicInput] entity.
513
514.Request
515----
516 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
517 Content-Type: application/json;charset=UTF-8
518
519 {
520 "topic": "Documentation"
521 }
522----
523
524As response the new topic is returned.
525
526.Response
527----
528 HTTP/1.1 200 OK
529 Content-Disposition: attachment
530 Content-Type: application/json;charset=UTF-8
531
532 )]}'
533 "Documentation"
534----
535
536If the topic was deleted the response is "`204 No Content`".
537
538[[delete-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100539Delete Topic
540~~~~~~~~~~~~
541[verse]
542'DELETE /changes/link:#change-id[\{change-id\}]/topic'
543
Edwin Kempin64006bb2013-02-22 08:17:04 +0100544Deletes the topic of a change.
545
546The request body does not need to include a link:#topic-input[
547TopicInput] entity if no review comment is added.
548
549Please note that some proxies prohibit request bodies for DELETE
550requests. In this case, if you want to specify a commit message, use
551link:#set-topic[PUT] to delete the topic.
552
553.Request
554----
555 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
556----
557
558.Response
559----
560 HTTP/1.1 204 No Content
561----
562
Edwin Kempined5364b2013-02-22 10:39:33 +0100563[[abandon-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100564Abandon Change
565~~~~~~~~~~~~~~
566[verse]
567'POST /changes/link:#change-id[\{change-id\}]/abandon'
568
Edwin Kempined5364b2013-02-22 10:39:33 +0100569Abandons a change.
570
571The request body does not need to include a link:#abandon-input[
572AbandonInput] entity if no review comment is added.
573
574.Request
575----
576 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
577----
578
579As response a link:#change-info[ChangeInfo] entity is returned that
580describes the abandoned change.
581
582.Response
583----
584 HTTP/1.1 200 OK
585 Content-Disposition: attachment
586 Content-Type: application/json;charset=UTF-8
587
588 )]}'
589 {
590 "kind": "gerritcodereview#change",
591 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
592 "project": "myProject",
593 "branch": "master",
594 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
595 "subject": "Implementing Feature X",
596 "status": "ABANDONED",
597 "created": "2013-02-01 09:59:32.126000000",
598 "updated": "2013-02-21 11:16:36.775000000",
599 "reviewed": true,
600 "mergeable": true,
601 "_sortkey": "0023412400000f7d",
602 "_number": 3965,
603 "owner": {
604 "name": "John Doe"
605 }
606 }
607----
608
609If the change cannot be abandoned because the change state doesn't
610allow abandoning of the change, the response is "`409 Conflict`" and
611the error message is contained in the response body.
612
613.Response
614----
615 HTTP/1.1 409 Conflict
616 Content-Disposition: attachment
617 Content-Type: text/plain;charset=UTF-8
618
619 change is merged
620----
621
622[[restore-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100623Restore Change
624~~~~~~~~~~~~~~
625[verse]
626'POST /changes/link:#change-id[\{change-id\}]/restore'
627
Edwin Kempined5364b2013-02-22 10:39:33 +0100628Restores a change.
629
630The request body does not need to include a link:#restore-input[
631RestoreInput] entity if no review comment is added.
632
633.Request
634----
635 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
636----
637
638As response a link:#change-info[ChangeInfo] entity is returned that
639describes the restored change.
640
641.Response
642----
643 HTTP/1.1 200 OK
644 Content-Disposition: attachment
645 Content-Type: application/json;charset=UTF-8
646
647 )]}'
648 {
649 "kind": "gerritcodereview#change",
650 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
651 "project": "myProject",
652 "branch": "master",
653 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
654 "subject": "Implementing Feature X",
655 "status": "NEW",
656 "created": "2013-02-01 09:59:32.126000000",
657 "updated": "2013-02-21 11:16:36.775000000",
658 "reviewed": true,
659 "mergeable": true,
660 "_sortkey": "0023412400000f7d",
661 "_number": 3965,
662 "owner": {
663 "name": "John Doe"
664 }
665 }
666----
667
668If the change cannot be restored because the change state doesn't
669allow restoring the change, the response is "`409 Conflict`" and
670the error message is contained in the response body.
671
672.Response
673----
674 HTTP/1.1 409 Conflict
675 Content-Disposition: attachment
676 Content-Type: text/plain;charset=UTF-8
677
678 change is new
679----
680
Edwin Kempind2ec4152013-02-22 12:17:19 +0100681[[revert-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100682Revert Change
683~~~~~~~~~~~~~
684[verse]
685'POST /changes/link:#change-id[\{change-id\}]/revert'
686
Edwin Kempind2ec4152013-02-22 12:17:19 +0100687Reverts a change.
688
689The request body does not need to include a link:#revert-input[
690RevertInput] entity if no review comment is added.
691
692.Request
693----
694 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
695----
696
697As response a link:#change-info[ChangeInfo] entity is returned that
698describes the reverting change.
699
700.Response
701----
702 HTTP/1.1 200 OK
703 Content-Disposition: attachment
704 Content-Type: application/json;charset=UTF-8
705
706 )]}'
707 {
708 "kind": "gerritcodereview#change",
709 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
710 "project": "myProject",
711 "branch": "master",
712 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
713 "subject": "Revert \"Implementing Feature X\"",
714 "status": "NEW",
715 "created": "2013-02-01 09:59:32.126000000",
716 "updated": "2013-02-21 11:16:36.775000000",
717 "reviewed": true,
718 "mergeable": true,
719 "_sortkey": "0023412400000f7d",
720 "_number": 3965,
721 "owner": {
722 "name": "John Doe"
723 }
724 }
725----
726
727If the change cannot be reverted because the change state doesn't
728allow reverting the change, the response is "`409 Conflict`" and
729the error message is contained in the response body.
730
731.Response
732----
733 HTTP/1.1 409 Conflict
734 Content-Disposition: attachment
735 Content-Type: text/plain;charset=UTF-8
736
737 change is new
738----
739
Edwin Kempin0eddba02013-02-22 15:30:12 +0100740[[submit-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100741Submit Change
742~~~~~~~~~~~~~
743[verse]
744'POST /changes/link:#change-id[\{change-id\}]/submit'
745
Edwin Kempin0eddba02013-02-22 15:30:12 +0100746Submits a change.
747
748The request body only needs to include a link:#submit-input[
749SubmitInput] entity if the request should wait for the merge to
750complete.
751
752.Request
753----
754 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
755 Content-Type: application/json;charset=UTF-8
756
757 {
758 "wait_for_merge": true
759 }
760----
761
762As response a link:#change-info[ChangeInfo] entity is returned that
763describes the submitted/merged change.
764
765.Response
766----
767 HTTP/1.1 200 OK
768 Content-Disposition: attachment
769 Content-Type: application/json;charset=UTF-8
770
771 )]}'
772 {
773 "kind": "gerritcodereview#change",
774 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
775 "project": "myProject",
776 "branch": "master",
777 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
778 "subject": "Implementing Feature X",
779 "status": "MERGED",
780 "created": "2013-02-01 09:59:32.126000000",
781 "updated": "2013-02-21 11:16:36.775000000",
782 "reviewed": true,
Edwin Kempin0eddba02013-02-22 15:30:12 +0100783 "_sortkey": "0023412400000f7d",
784 "_number": 3965,
785 "owner": {
786 "name": "John Doe"
787 }
788 }
789----
790
791If the change cannot be submitted because the submit rule doesn't allow
792submitting the change, the response is "`409 Conflict`" and the error
793message is contained in the response body.
794
795.Response
796----
797 HTTP/1.1 409 Conflict
798 Content-Disposition: attachment
799 Content-Type: text/plain;charset=UTF-8
800
801 blocked by Verified
802----
803
Edwin Kempin1dbe19e2013-02-22 16:18:58 +0100804[[reviewer-endpoints]]
805Reviewer Endpoints
806------------------
807
808[[list-reviewers]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100809List Reviewers
810~~~~~~~~~~~~~~
811[verse]
812'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
813
Edwin Kempin1dbe19e2013-02-22 16:18:58 +0100814Lists the reviewers of a change.
815
816As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
817
818.Request
819----
820 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
821----
822
823.Response
824----
825 HTTP/1.1 200 OK
826 Content-Disposition: attachment
827 Content-Type: application/json;charset=UTF-8
828
829 )]}'
830 [
831 {
832 "kind": "gerritcodereview#reviewer",
833 "approvals": {
834 "Verified": "+1",
835 "Code-Review": "+2"
836 },
837 "_account_id": 1000096,
838 "name": "John Doe",
839 "email": "john.doe@example.com"
840 },
841 {
842 "kind": "gerritcodereview#reviewer",
843 "approvals": {
844 "Verified": " 0",
845 "Code-Review": "-1"
846 },
847 "_account_id": 1000097,
848 "name": "Jane Roe",
849 "email": "jane.roe@example.com"
850 }
851 ]
852----
853
Edwin Kempina3d02ef2013-02-22 16:31:53 +0100854[[get-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100855Get Reviewer
856~~~~~~~~~~~~
857[verse]
858'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
859
Edwin Kempina3d02ef2013-02-22 16:31:53 +0100860Retrieves a reviewer of a change.
861
862As response a link:#reviewer-info[ReviewerInfo] entity is returned that
863describes the reviewer.
864
865.Request
866----
867 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
868----
869
870.Response
871----
872 HTTP/1.1 200 OK
873 Content-Disposition: attachment
874 Content-Type: application/json;charset=UTF-8
875
876 )]}'
877 {
878 "kind": "gerritcodereview#reviewer",
879 "approvals": {
880 "Verified": "+1",
881 "Code-Review": "+2"
882 },
883 "_account_id": 1000096,
884 "name": "John Doe",
885 "email": "john.doe@example.com"
886 }
887----
888
Edwin Kempin392328e2013-02-25 12:50:03 +0100889[[add-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100890Add Reviewer
891~~~~~~~~~~~~
892[verse]
893'POST /changes/link:#change-id[\{change-id\}]/reviewers'
894
Edwin Kempin392328e2013-02-25 12:50:03 +0100895Adds one user or all members of one group as reviewer to the change.
896
897The reviewer to be added to the change must be provided in the request
898body as a link:#reviewer-input[ReviewerInput] entity.
899
900.Request
901----
902 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
903 Content-Type: application/json;charset=UTF-8
904
905 {
906 "reviewer": "john.doe@example.com"
907 }
908----
909
910As response an link:#add-reviewer-result[AddReviewerResult] entity is
911returned that describes the newly added reviewers.
912
913.Response
914----
915 HTTP/1.1 200 OK
916 Content-Disposition: attachment
917 Content-Type: application/json;charset=UTF-8
918
919 )]}'
920 {
921 "reviewers": [
922 {
923 "kind": "gerritcodereview#reviewer",
924 "approvals": {
925 "Verified": " 0",
926 "Code-Review": " 0"
927 },
928 "_account_id": 1000096,
929 "name": "John Doe",
930 "email": "john.doe@example.com"
931 }
932 ]
933 }
934----
935
936If a group is specified, adding the group members as reviewers is an
937atomic operation. This means if an error is returned, none of the
938members are added as reviewer.
939
940If a group with many members is added as reviewer a confirmation may be
941required.
942
943.Request
944----
945 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
946 Content-Type: application/json;charset=UTF-8
947
948 {
949 "reviewer": "MyProjectVerifiers"
950 }
951----
952
953.Response
954----
955 HTTP/1.1 200 OK
956 Content-Disposition: attachment
957 Content-Type: application/json;charset=UTF-8
958
959 )]}'
960 {
961 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
962 "confirm": true
963 }
964----
965
966To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +0100967`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +0100968
969.Request
970----
971 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
972 Content-Type: application/json;charset=UTF-8
973
974 {
975 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +0100976 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +0100977 }
978----
979
Edwin Kempin53301072013-02-25 12:57:07 +0100980[[delete-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100981Delete Reviewer
982~~~~~~~~~~~~~~~
983[verse]
984'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
985
Edwin Kempin53301072013-02-25 12:57:07 +0100986Deletes a reviewer from a change.
987
988.Request
989----
990 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
991----
992
993.Response
994----
995 HTTP/1.1 204 No Content
996----
997
Edwin Kempinda6e5fa2013-02-25 14:48:12 +0100998[[revision-endpoints]]
999Revision Endpoints
1000------------------
1001
1002[[get-review]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001003Get Review
1004~~~~~~~~~~
1005[verse]
1006'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
1007
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001008Retrieves a review of a revision.
1009
1010.Request
1011----
1012 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1013----
1014
1015As response a link:#change-info[ChangeInfo] entity with
1016link:#detailed-labels[detailed labels] and link:#detailed-accounts[
1017detailed accounts] is returned that describes the review of the
1018revision. The revision for which the review is retrieved is contained
1019in the `revisions` field. In addition the `current_revision` field is
1020set, if the revision for which the review is retrieved, is the current
1021revision of the change. Please note that the returned labels are always
1022for the current patch set.
1023
1024.Response
1025----
1026 HTTP/1.1 200 OK
1027 Content-Disposition: attachment
1028 Content-Type: application/json;charset=UTF-8
1029
1030 )]}'
1031 {
1032 "kind": "gerritcodereview#change",
1033 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1034 "project": "myProject",
1035 "branch": "master",
1036 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1037 "subject": "Implementing Feature X",
1038 "status": "NEW",
1039 "created": "2013-02-01 09:59:32.126000000",
1040 "updated": "2013-02-21 11:16:36.775000000",
1041 "reviewed": true,
1042 "mergeable": true,
1043 "_sortkey": "0023412400000f7d",
1044 "_number": 3965,
1045 "owner": {
1046 "_account_id": 1000096,
1047 "name": "John Doe",
1048 "email": "john.doe@example.com"
1049 },
1050 "labels": {
1051 "Verified": {
1052 "all": [
1053 {
1054 "value": 0,
1055 "_account_id": 1000096,
1056 "name": "John Doe",
1057 "email": "john.doe@example.com"
1058 },
1059 {
1060 "value": 0,
1061 "_account_id": 1000097,
1062 "name": "Jane Roe",
1063 "email": "jane.roe@example.com"
1064 }
1065 ],
1066 "values": {
1067 "-1": "Fails",
1068 " 0": "No score",
1069 "+1": "Verified"
1070 }
1071 },
1072 "Code-Review": {
1073 "all": [
1074 {
1075 "value": -1,
1076 "_account_id": 1000096,
1077 "name": "John Doe",
1078 "email": "john.doe@example.com"
1079 },
1080 {
1081 "value": 1,
1082 "_account_id": 1000097,
1083 "name": "Jane Roe",
1084 "email": "jane.roe@example.com"
1085 }
1086 ]
1087 "values": {
1088 "-2": "Do not submit",
1089 "-1": "I would prefer that you didn\u0027t submit this",
1090 " 0": "No score",
1091 "+1": "Looks good to me, but someone else must approve",
1092 "+2": "Looks good to me, approved"
1093 }
1094 }
1095 },
1096 "permitted_labels": {
1097 "Verified": [
1098 "-1",
1099 " 0",
1100 "+1"
1101 ],
1102 "Code-Review": [
1103 "-2",
1104 "-1",
1105 " 0",
1106 "+1",
1107 "+2"
1108 ]
1109 },
1110 "removable_reviewers": [
1111 {
1112 "_account_id": 1000096,
1113 "name": "John Doe",
1114 "email": "john.doe@example.com"
1115 },
1116 {
1117 "_account_id": 1000097,
1118 "name": "Jane Roe",
1119 "email": "jane.roe@example.com"
1120 }
1121 ],
1122 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1123 "revisions": {
1124 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1125 "_number": 2,
1126 "fetch": {
1127 "http": {
1128 "url": "http://gerrit/myProject",
1129 "ref": "refs/changes/65/3965/2"
1130 }
1131 }
1132 }
1133 }
1134----
1135
Edwin Kempin67498de2013-02-25 16:15:34 +01001136[[set-review]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001137Set Review
1138~~~~~~~~~~
1139[verse]
1140'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
1141
Edwin Kempin67498de2013-02-25 16:15:34 +01001142Sets a review on a revision.
1143
1144The review must be provided in the request body as a
1145link:#review-input[ReviewInput] entity.
1146
1147.Request
1148----
1149 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1150 Content-Type: application/json;charset=UTF-8
1151
1152 {
1153 "message": "Some nits need to be fixed.",
1154 "labels": {
1155 "Code-Review": -1
1156 },
1157 "comments": {
1158 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1159 {
1160 "line": 23,
1161 "message": "[nit] trailing whitespace"
1162 },
1163 {
1164 "line": 49,
1165 "message": "[nit] s/conrtol/control"
1166 }
1167 ]
1168 }
1169 }
1170----
1171
1172As response a link:#review-info[ReviewInfo] entity is returned that
1173describes the applied labels.
1174
1175.Response
1176----
1177 HTTP/1.1 200 OK
1178 Content-Disposition: attachment
1179 Content-Type: application/json;charset=UTF-8
1180
1181 )]}'
1182 {
1183 "labels": {
1184 "Code-Review": -1
1185 }
1186 }
1187----
1188
Edwin Kempin14b58112013-02-26 16:30:19 +01001189[[submit-revision]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001190Submit Revision
1191~~~~~~~~~~~~~~~
1192[verse]
1193'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
1194
Edwin Kempin14b58112013-02-26 16:30:19 +01001195Submits a revision.
1196
1197The request body only needs to include a link:#submit-input[
1198SubmitInput] entity if the request should wait for the merge to
1199complete.
1200
1201.Request
1202----
1203 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
1204 Content-Type: application/json;charset=UTF-8
1205
1206 {
1207 "wait_for_merge": true
1208 }
1209----
1210
1211As response a link:#submit-info[SubmitInfo] entity is returned that
1212describes the status of the submitted change.
1213
1214.Response
1215----
1216 HTTP/1.1 200 OK
1217 Content-Disposition: attachment
1218 Content-Type: application/json;charset=UTF-8
1219
1220 )]}'
1221 {
1222 "status": "MERGED"
1223 }
1224----
1225
1226If the revision cannot be submitted, e.g. because the submit rule
1227doesn't allow submitting the revision or the revision is not the
1228current revision, the response is "`409 Conflict`" and the error
1229message is contained in the response body.
1230
1231.Response
1232----
1233 HTTP/1.1 409 Conflict
1234 Content-Type: text/plain;charset=UTF-8
1235
1236 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
1237----
1238
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001239[[get-submit-type]]
1240Get Submit Type
1241~~~~~~~~~~~~~~~
1242[verse]
1243'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
1244
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001245Gets the method the server will use to submit (merge) the change.
1246
1247.Request
1248----
1249 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
1250----
1251
1252.Response
1253----
1254 HTTP/1.1 200 OK
1255 Content-Disposition: attachment
1256 Content-Type: application/json;charset=UTF-8
1257
1258 )]}'
1259 "MERGE_IF_NECESSARY"
1260----
1261
1262[[test-submit-type]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001263Test Submit Type
1264~~~~~~~~~~~~~~~~
1265[verse]
1266'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
1267
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001268Tests the submit_type Prolog rule in the project, or the one given.
1269
1270Request body may be either the Prolog code as `text/plain` or a
1271link:#rule-input[RuleInput] object. The query parameter `filters`
1272may be set to `SKIP` to bypass parent project filters while testing
1273a project-specific rule.
1274
1275.Request
1276----
1277 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
1278 Content-Type: text/plain;charset-UTF-8
1279
1280 submit_type(cherry_pick).
1281----
1282
1283.Response
1284----
1285 HTTP/1.1 200 OK
1286 Content-Disposition: attachment
1287 Content-Type: application/json;charset=UTF-8
1288
1289 )]}'
1290 "cherry_pick"
1291----
1292
1293[[test-submit-rule]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001294Test Submit Rule
1295~~~~~~~~~~~~~~~~
1296[verse]
1297'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
1298
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001299Tests the submit_rule Prolog rule in the project, or the one given.
1300
1301Request body may be either the Prolog code as `text/plain` or a
1302link:#rule-input[RuleInput] object. The query parameter `filters`
1303may be set to `SKIP` to bypass parent project filters while testing
1304a project-specific rule.
1305
1306.Request
1307----
1308 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type?filters=SKIP HTTP/1.0
1309 Content-Type: text/plain;charset-UTF-8
1310
1311 submit_rule(submit(R)) :-
1312 R = label('Any-Label-Name', reject(_)).
1313----
1314
1315The response is a list of link:#submit-record[SubmitRecord] entries
1316describing the permutations that satisfy the tested submit rule.
1317
1318.Response
1319----
1320 HTTP/1.1 200 OK
1321 Content-Disposition: attachment
1322 Content-Type: application/json;charset=UTF-8
1323
1324 )]}'
1325 [
1326 {
1327 "status": "NOT_READY",
1328 "reject": {
1329 "Any-Label-Name": {}
1330 }
1331 }
1332 ]
1333----
1334
Edwin Kempincb6724a2013-02-26 16:58:51 +01001335[[list-drafts]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001336List Drafts
1337~~~~~~~~~~~
1338[verse]
1339'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
1340
Edwin Kempin3ca57192013-02-27 07:44:01 +01001341Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01001342user.
1343
1344As result a map is returned that maps the file path to a list of
1345link:#comment-info[CommentInfo] entries. The entries in the map are
1346sorted by file path.
1347
1348.Request
1349----
1350 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
1351----
1352
1353.Response
1354----
1355 HTTP/1.1 200 OK
1356 Content-Disposition: attachment
1357 Content-Type: application/json;charset=UTF-8
1358
1359 )]}'
1360 {
1361 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1362 {
1363 "kind": "gerritcodereview#comment",
1364 "id": "TvcXrmjM",
1365 "line": 23,
1366 "message": "[nit] trailing whitespace",
1367 "updated": "2013-02-26 15:40:43.986000000"
1368 },
1369 {
1370 "kind": "gerritcodereview#comment",
1371 "id": "TveXwFiA",
1372 "line": 49,
1373 "in_reply_to": "TfYX-Iuo",
1374 "message": "Done",
1375 "updated": "2013-02-26 15:40:45.328000000"
1376 }
1377 ]
1378 }
1379----
1380
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001381[[create-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001382Create Draft
1383~~~~~~~~~~~~
1384[verse]
1385'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
1386
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001387Creates a draft comment on a revision.
1388
1389The new draft comment must be provided in the request body inside a
1390link:#comment-input[CommentInput] entity.
1391
1392.Request
1393----
1394 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
1395 Content-Type: application/json;charset=UTF-8
1396
1397 {
1398 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1399 "line": 23,
1400 "message": "[nit] trailing whitespace"
1401 }
1402----
1403
1404As response a link:#comment-info[CommentInfo] entity is returned that
1405describes the draft comment.
1406
1407.Response
1408----
1409 HTTP/1.1 200 OK
1410 Content-Disposition: attachment
1411 Content-Type: application/json;charset=UTF-8
1412
1413 )]}'
1414 {
1415 "kind": "gerritcodereview#comment",
1416 "id": "TvcXrmjM",
1417 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1418 "line": 23,
1419 "message": "[nit] trailing whitespace",
1420 "updated": "2013-02-26 15:40:43.986000000"
1421 }
1422----
1423
Edwin Kempin3ca57192013-02-27 07:44:01 +01001424[[get-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001425Get Draft
1426~~~~~~~~~
1427[verse]
1428'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1429
Edwin Kempin3ca57192013-02-27 07:44:01 +01001430Retrieves a draft comment of a revision that belongs to the calling
1431user.
1432
1433.Request
1434----
1435 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1436----
1437
1438As response a link:#comment-info[CommentInfo] entity is returned that
1439describes the draft comment.
1440
1441.Response
1442----
1443 HTTP/1.1 200 OK
1444 Content-Disposition: attachment
1445 Content-Type: application/json;charset=UTF-8
1446
1447 )]}'
1448 {
1449 "kind": "gerritcodereview#comment",
1450 "id": "TvcXrmjM",
1451 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1452 "line": 23,
1453 "message": "[nit] trailing whitespace",
1454 "updated": "2013-02-26 15:40:43.986000000"
1455 }
1456----
1457
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001458[[update-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001459Update Draft
1460~~~~~~~~~~~~
1461[verse]
1462'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1463
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001464Updates a draft comment on a revision.
1465
1466The new draft comment must be provided in the request body inside a
1467link:#comment-input[CommentInput] entity.
1468
1469.Request
1470----
1471 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1472 Content-Type: application/json;charset=UTF-8
1473
1474 {
1475 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1476 "line": 23,
1477 "message": "[nit] trailing whitespace"
1478 }
1479----
1480
1481As response a link:#comment-info[CommentInfo] entity is returned that
1482describes the draft comment.
1483
1484.Response
1485----
1486 HTTP/1.1 200 OK
1487 Content-Disposition: attachment
1488 Content-Type: application/json;charset=UTF-8
1489
1490 )]}'
1491 {
1492 "kind": "gerritcodereview#comment",
1493 "id": "TvcXrmjM",
1494 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1495 "line": 23,
1496 "message": "[nit] trailing whitespace",
1497 "updated": "2013-02-26 15:40:43.986000000"
1498 }
1499----
1500
1501[[delete-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001502Delete Draft
1503~~~~~~~~~~~~
1504[verse]
1505'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1506
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001507Deletes a draft comment from a revision.
1508
1509.Request
1510----
1511 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1512----
1513
1514.Response
1515----
1516 HTTP/1.1 204 No Content
1517----
1518
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001519[[set-reviewed]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001520Set Reviewed
1521~~~~~~~~~~~~
1522[verse]
1523'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#patch-id[\{patch-id\}]/reviewed'
1524
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001525Marks a patch of a revision as reviewed by the calling user.
1526
1527.Request
1528----
1529 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
1530----
1531
1532.Response
1533----
1534 HTTP/1.1 201 Created
1535----
1536
1537If the patch was already marked as reviewed by the calling user the
1538response is "`200 OK`".
1539
1540[[delete-reviewed]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001541Delete Reviewed
1542~~~~~~~~~~~~~~~
1543[verse]
1544'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#patch-id[\{patch-id\}]/reviewed'
1545
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001546Deletes the reviewed flag of the calling user from a patch of a revision.
1547
1548.Request
1549----
1550 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
1551----
1552
1553.Response
1554----
1555 HTTP/1.1 204 No Content
1556----
1557
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001558
1559[[ids]]
1560IDs
1561---
1562
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001563[[account-id]]
1564link:rest-api-accounts.html#account-id[\{account-id\}]
1565~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1566--
1567--
1568
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001569[[change-id]]
1570\{change-id\}
1571~~~~~~~~~~~~~
1572Identifier that uniquely identifies one change.
1573
1574This can be:
1575
1576* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
1577 where for the branch the `refs/heads/` prefix can be omitted
1578 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
1579* a Change-Id if it uniquely identifies one change
1580 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
1581* a legacy numeric change ID ("4247")
1582
Edwin Kempin3ca57192013-02-27 07:44:01 +01001583[[draft-id]]
1584\{draft-id\}
1585~~~~~~~~~~~~
1586UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001587
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001588[[patch-id]]
1589\{patch-id\}
1590~~~~~~~~~~~~
1591The file path of the patch.
1592
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001593[[revision-id]]
1594\{revision-id\}
1595~~~~~~~~~~~~~~~
1596Identifier that uniquely identifies one revision of a change.
1597
1598This can be:
1599
Shawn Pearce9c0722a2013-03-02 15:30:31 -08001600* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001601* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
1602* an abbreviated commit ID that uniquely identifies one revision of the
1603 change ("674ac754"), at least 4 digits are required
1604* a legacy numeric patch number ("1" for first patch set of the change)
1605
1606
Edwin Kempine3446292013-02-19 16:40:14 +01001607[[json-entities]]
1608JSON Entities
1609-------------
1610
Edwin Kempined5364b2013-02-22 10:39:33 +01001611[[abandon-input]]
1612AbandonInput
1613~~~~~~~~~~~~
1614The `AbandonInput` entity contains information for abandoning a change.
1615
1616[options="header",width="50%",cols="1,^1,5"]
1617|===========================
1618|Field Name ||Description
1619|`message` |optional|
1620Message to be added as review comment to the change when abandoning the
1621change.
1622|===========================
1623
Edwin Kempin392328e2013-02-25 12:50:03 +01001624[[add-reviewer-result]]
1625AddReviewerResult
1626~~~~~~~~~~~~~~~~~
1627The `AddReviewerResult` entity describes the result of adding a
1628reviewer to a change.
1629
1630[options="header",width="50%",cols="1,^1,5"]
1631|===========================
1632|Field Name ||Description
1633|`reviewers` |optional|
1634The newly added reviewers as a list of link:#reviewer-info[
1635ReviewerInfo] entities.
1636|`error` |optional|
1637Error message explaining why the reviewer could not be added. +
1638If a group was specified in the input and an error is returned, it
1639means that none of the members were added as reviewer.
1640|`confirm` |`false` if not set|
1641Whether adding the reviewer requires confirmation.
1642|===========================
1643
Edwin Kempine3446292013-02-19 16:40:14 +01001644[[approval-info]]
1645ApprovalInfo
1646~~~~~~~~~~~~
1647The `ApprovalInfo` entity contains information about an approval from a
1648user for a label on a change.
1649
Edwin Kempin963dfd02013-02-27 12:39:32 +01001650`ApprovalInfo` has the same fields as
1651link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01001652In addition `ApprovalInfo` has the following fields:
1653
1654[options="header",width="50%",cols="1,^1,5"]
1655|===========================
1656|Field Name ||Description
1657|`value` ||The vote that the user has given for the label.
1658|===========================
1659
1660[[change-info]]
1661ChangeInfo
1662~~~~~~~~~~
1663The `ChangeInfo` entity contains information about a change.
1664
1665[options="header",width="50%",cols="1,^1,5"]
1666|==================================
1667|Field Name ||Description
1668|`kind` ||`gerritcodereview#change`
1669|`id` ||
1670The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
1671where project, branch and Change-Id are URL encoded. For branch the
1672`refs/heads/` prefix is omitted.
1673|`project` ||The name of the project.
1674|`branch` ||
1675The name of the target branch. +
1676The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01001677|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01001678|`change_id` ||The Change-Id of the change.
1679|`subject` ||
1680The subject of the change (header line of the commit message).
1681|`status` ||
1682The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
1683`DRAFT`).
1684|`created` ||
1685The link:rest-api.html#timestamp[timestamp] of when the change was
1686created.
1687|`updated` ||
1688The link:rest-api.html#timestamp[timestamp] of when the change was last
1689updated.
1690|`starred` |not set if `false`|
1691Whether the calling user has starred this change.
1692|`reviewed` |not set if `false`|
1693Whether the change was reviewed by the calling user.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01001694|`mergeable` |optional|
1695Whether the change is mergeable. +
1696Not set for merged changed.
Edwin Kempine3446292013-02-19 16:40:14 +01001697|`_sortkey` ||The sortkey of the change.
1698|`_number` ||The legacy numeric ID of the change.
1699|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01001700The owner of the change as an link:rest-api-accounts.html#account-info[
1701AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01001702|`labels` |optional|
1703The labels of the change as a map that maps the label names to
1704link:#label-info[LabelInfo] entries. +
1705Only set if link:#labels[labels] or link:#detailed-labels[detailed
1706labels] are requested.
1707|`permitted_labels` |optional|
1708A map of the permitted labels that maps a label name to the list of
1709values that are allowed for that label. +
1710Only set if link:#detailed-labels[detailed labels] are requested.
1711|`removable_reviewers`|optional|
1712The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01001713link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01001714Only set if link:#detailed-labels[detailed labels] are requested.
1715|`current_revision` |optional|
1716The commit ID of the current patch set of this change. +
1717Only set if link:#current-revision[the current revision] is requested
1718or if link:#all-revisions[all revisions] are requested.
1719|`revisions` |optional|
1720All patch sets of this changes as a map that maps the commit ID of the
1721patch set to a link:#revision-info[RevisionInfo] entity. +
1722Only set if link:#all-revisions[all revisions] are requested.
1723|`_more_changes` |optional, not set if `false`|
1724Whether the query would deliver more results if not limited. +
1725Only set on either the last or the first change that is returned.
1726|==================================
1727
Edwin Kempincb6724a2013-02-26 16:58:51 +01001728[[comment-info]]
1729CommentInfo
1730~~~~~~~~~~~
1731The `CommitInfo` entity contains information about an inline comment.
1732
1733[options="header",width="50%",cols="1,^1,5"]
1734|===========================
1735|Field Name ||Description
1736|`kind` ||`gerritcodereview#comment`
1737|`id` ||The URL encoded UUID of the draft comment.
1738|`path` |optional|
1739The path of the file for which the inline comment was done. +
1740Not set if returned in a map where the key is the file path.
1741|`side` |optional|
1742The side on which the comment was added. +
1743Allowed values are `REVISION` and `PARENT`. +
1744If not set, the default is `REVISION`.
1745|`line` |optional|
1746The number of the line for which the comment was done. +
1747If not set, it's a file comment.
1748|`in_reply_to` |optional|
1749The URL encoded UUID of the comment to which this comment is a reply.
1750|`message` |optional|The comment message.
1751|`updated` ||
1752The link:rest-api.html#timestamp[timestamp] of when this comment was
1753written.
1754|===========================
1755
Edwin Kempin67498de2013-02-25 16:15:34 +01001756[[comment-input]]
1757CommentInput
1758~~~~~~~~~~~~
1759The `CommitInput` entity contains information for creating an inline
1760comment.
1761
1762[options="header",width="50%",cols="1,^1,5"]
1763|===========================
1764|Field Name ||Description
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001765|`kind` |optional|
1766Must be `gerritcodereview#comment` if provided.
Edwin Kempin67498de2013-02-25 16:15:34 +01001767|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01001768The URL encoded UUID of the comment if an existing draft comment should
1769be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001770|`path` |optional|
1771The path of the file for which the inline comment should be added. +
1772Doesn't need to be set if contained in a map where the key is the file
1773path.
Edwin Kempin67498de2013-02-25 16:15:34 +01001774|`side` |optional|
1775The side on which the comment should be added. +
1776Allowed values are `REVISION` and `PARENT`. +
1777If not set, the default is `REVISION`.
1778|`line` |optional|
1779The number of the line for which the comment should be added. +
1780`0` if it is a file comment. +
1781If not set, a file comment is added.
1782|`in_reply_to` |optional|
1783The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001784|`updated` |optional|
1785The link:rest-api.html#timestamp[timestamp] of this comment. +
1786Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01001787|`message` |optional|
1788The comment message. +
1789If not set and an existing draft comment is updated, the existing draft
1790comment is deleted.
1791|===========================
1792
Edwin Kempine3446292013-02-19 16:40:14 +01001793[[commit-info]]
1794CommitInfo
1795~~~~~~~~~~
1796The `CommitInfo` entity contains information about a commit.
1797
1798[options="header",width="50%",cols="1,6"]
1799|==========================
1800|Field Name |Description
1801|`commit` |The commit ID.
1802|`parent` |
1803The parent commits of this commit as a list of
1804link:#commit-info[CommitInfo] entities.
1805|`author` |The author of the commit as a
1806link:#git-person-info[GitPersonInfo] entity.
1807|`committer` |The committer of the commit as a
1808link:#git-person-info[GitPersonInfo] entity.
1809|`subject` |
1810The subject of the commit (header line of the commit message).
1811|`message` |The commit message.
1812|==========================
1813
1814[[fetch-info]]
1815FetchInfo
1816~~~~~~~~~
1817The `FetchInfo` entity contains information about how to fetch a patch
1818set via a certain protocol.
1819
1820[options="header",width="50%",cols="1,6"]
1821|==========================
1822|Field Name |Description
1823|`url` |The URL of the project.
1824|`ref` |The ref of the patch set.
1825|==========================
1826
1827[[file-info]]
1828FileInfo
1829~~~~~~~~
1830The `FileInfo` entity contains information about a file in a patch set.
1831
1832[options="header",width="50%",cols="1,^1,5"]
1833|=============================
1834|Field Name ||Description
1835|`status` |optional|
1836The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
1837"`C`"=Copied, "`W`"=Rewritten). +
1838Not set if the file was Modified ("`M`").
1839|`binary` |not set if `false`|Whether the file is binary.
1840|`old_path` |optional|
1841The old file path. +
1842Only set if file was renamed or copied.
1843|`lines_inserted`|optional|
1844Number of inserted lines. +
1845Not set for binary files or if no lines were inserted.
1846|`lines_deleted` |optional|
1847Number of deleted lines. +
1848Not set for binary files or if no lines were deleted.
1849|=============================
1850
1851[[git-person-info]]
1852GitPersonInfo
1853~~~~~~~~~~~~~
1854The `GitPersonInfo` entity contains information about the
1855author/committer of a commit.
1856
1857[options="header",width="50%",cols="1,6"]
1858|==========================
1859|Field Name |Description
1860|`name` |The name of the author/committer.
1861|`email` |The email address of the author/committer.
1862|`date` |The link:rest-api.html#timestamp[timestamp] of when
1863this identity was constructed.
1864|`tz` |The timezone offset from UTC of when this identity was
1865constructed.
1866|==========================
1867
1868[[label-info]]
1869LabelInfo
1870~~~~~~~~~
1871The `LabelInfo` entity contains information about a label on a change.
1872
1873[options="header",width="50%",cols="1,^1,5"]
1874|===========================
1875|Field Name ||Description
1876|`approved` |optional|The user who approved this label on the change
Edwin Kempin963dfd02013-02-27 12:39:32 +01001877as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
Edwin Kempine3446292013-02-19 16:40:14 +01001878Only set if link:#labels[labels] are requested.
1879|`rejected` |optional|The user who rejected this label on the change
Edwin Kempin963dfd02013-02-27 12:39:32 +01001880as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
Edwin Kempine3446292013-02-19 16:40:14 +01001881Only set if link:#labels[labels] are requested.
1882|`recommended` |optional|The user who recommended this label on the
Edwin Kempin963dfd02013-02-27 12:39:32 +01001883change as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
Edwin Kempine3446292013-02-19 16:40:14 +01001884Only set if link:#labels[labels] are requested.
1885|`disliked` |optional|The user who disliked this label on the change
Edwin Kempin963dfd02013-02-27 12:39:32 +01001886as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
Edwin Kempine3446292013-02-19 16:40:14 +01001887Only set if link:#labels[labels] are requested.
1888|`value` |optional|The voting value of the user who
1889recommended/disliked this label on the change if it is not
1890"`+1`"/"`-1`". +
1891Only set if link:#labels[labels] are requested.
1892|`optional` |not set if `false`|
1893Whether the label is optional. Optional means the label may be set, but
1894it's neither necessary for submission nor does it block submission if
1895set.
1896|`all` |optional|List of all approvals for this label as a list
1897of link:#approval-info[ApprovalInfo] entities. +
1898Only set if link:#detailed-labels[detailed labels] are requested.
1899|`values` |optional|A map of all values that are allowed for this
1900label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
1901to the value descriptions. +
1902Only set if link:#detailed-labels[detailed labels] are requested.
1903|===========================
1904
Edwin Kempined5364b2013-02-22 10:39:33 +01001905[[restore-input]]
1906RestoreInput
1907~~~~~~~~~~~~
1908The `RestoreInput` entity contains information for restoring a change.
1909
1910[options="header",width="50%",cols="1,^1,5"]
1911|===========================
1912|Field Name ||Description
1913|`message` |optional|
1914Message to be added as review comment to the change when restoring the
1915change.
1916|===========================
1917
Edwin Kempind2ec4152013-02-22 12:17:19 +01001918[[revert-input]]
1919RevertInput
1920~~~~~~~~~~~
1921The `RevertInput` entity contains information for reverting a change.
1922
1923[options="header",width="50%",cols="1,^1,5"]
1924|===========================
1925|Field Name ||Description
1926|`message` |optional|
1927Message to be added as review comment to the change when reverting the
1928change.
1929|===========================
1930
Edwin Kempin67498de2013-02-25 16:15:34 +01001931[[review-info]]
1932ReviewInfo
1933~~~~~~~~~~
1934The `ReviewInfo` entity contains information about a review.
1935
1936[options="header",width="50%",cols="1,6"]
1937|===========================
1938|Field Name |Description
1939|`labels` |
1940The labels of the review as a map that maps the label names to the
1941voting values.
1942|===========================
1943
1944[[review-input]]
1945ReviewInput
1946~~~~~~~~~~~
1947The `ReviewInput` entity contains information for adding a review to a
1948revision.
1949
1950[options="header",width="50%",cols="1,^1,5"]
1951|============================
1952|Field Name ||Description
1953|`message` |optional|
1954The message to be added as review comment.
1955|`labels` |optional|
1956The votes that should be added to the revision as a map that maps the
1957label names to the voting values.
1958|`comments` |optional|
1959The comments that should be added as a map that maps a file path to a
1960list of link:#comment-input[CommentInput] entities.
1961|`strict_labels`|`true` if not set|
1962Whether all labels are rquired to be within the user's permitted ranges
1963based on access controls. +
1964If `true`, attempting to use a label not granted to the user will fail
1965the entire modify operation early. +
1966If `false`, the operation will execute anyway, but the proposed labels
1967will be modified to be the "best" value allowed by the access controls.
1968|`drafts` |optional|
1969Draft handling that defines how draft comments are handled that are
1970already in the database but that were not also described in this
1971input. +
1972Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
1973If not set, the default is `DELETE`.
1974|`notify` |optional|
1975Notify handling that defines to whom email notifications should be sent
1976after the review is stored. +
1977Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
1978If not set, the default is `ALL`.
1979|============================
1980
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001981[[reviewer-info]]
1982ReviewerInfo
1983~~~~~~~~~~~~
1984The `ReviewerInfo` entity contains information about a reviewer and its
1985votes on a change.
1986
Edwin Kempin963dfd02013-02-27 12:39:32 +01001987`ReviewerInfo` has the same fields as
1988link:rest-api-accounts.html#account-info[AccountInfo] and includes
1989link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001990In addition `ReviewerInfo` has the following fields:
1991
1992[options="header",width="50%",cols="1,6"]
1993|==========================
1994|Field Name |Description
1995|`kind` |`gerritcodereview#reviewer`
1996|`approvals` |
1997The approvals of the reviewer as a map that maps the label names to the
1998approval values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`").
1999|==========================
2000
Edwin Kempin392328e2013-02-25 12:50:03 +01002001[[reviewer-input]]
2002ReviewerInput
2003~~~~~~~~~~~~~
2004The `ReviewerInput` entity contains information for adding a reviewer
2005to a change.
2006
2007[options="header",width="50%",cols="1,^1,5"]
2008|===========================
2009|Field Name ||Description
2010|`reviewer` ||
2011The link:rest-api-accounts.html#account-id[ID] of one account that
2012should be added as reviewer or the link:rest-api-groups.html#group-id[
2013ID] of one group for which all members should be added as reviewers. +
2014If an ID identifies both an account and a group, only the account is
2015added as reviewer to the change.
2016|`confirmed` |optional|
2017Whether adding the reviewer is confirmed. +
2018The Gerrit server may be configured to
2019link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
2020confirmation] when adding a group as reviewer that has many members.
2021|===========================
2022
Edwin Kempine3446292013-02-19 16:40:14 +01002023[[revision-info]]
2024RevisionInfo
2025~~~~~~~~~~~~
2026The `RevisionInfo` entity contains information about a patch set.
2027
2028[options="header",width="50%",cols="1,^1,5"]
2029|===========================
2030|Field Name ||Description
2031|`draft` |not set if `false`|Whether the patch set is a draft.
2032|`_number` ||The patch set number.
2033|`fetch` ||
2034Information about how to fetch this patch set. The fetch information is
2035provided as a map that maps the protocol name ("`git`", "`http`",
2036"`ssh`") to link:#fetch-info[FetchInfo] entities.
2037|`commit` ||The commit of the patch set as
2038link:#commit-info[CommitInfo] entity.
2039|`files` ||
2040The files of the patch set as a map that maps the file names to
2041link:#file-info[FileInfo] entities.
2042|===========================
2043
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002044[[rule-input]]
2045RuleInput
2046~~~~~~~~~
2047The `RuleInput` entity contains information to test a Prolog rule.
2048
2049[options="header",width="50%",cols="1,^1,5"]
2050|===========================
2051|Field Name ||Description
2052|`rule`||
2053Prolog code to execute instead of the code in `refs/meta/config`.
2054|`filters`|`RUN` if not set|
2055When `RUN` filter rules in the parent projects are called to
2056post-process the results of the project specific rule. This
2057behavior matches how the rule will execute if installed. +
2058If `SKIP` the parent filters are not called, allowing the test
2059to return results from the input rule.
2060|===========================
2061
Edwin Kempin14b58112013-02-26 16:30:19 +01002062[[submit-info]]
2063SubmitInfo
2064~~~~~~~~~~
2065The `SubmitInfo` entity contains information about the change status
2066after submitting.
2067
2068[options="header",width="50%",cols="1,6"]
2069|==========================
2070|Field Name |Description
2071|`status` |
2072The status of the change after submitting, can be `MERGED` or
2073`SUBMITTED`. +
2074If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
2075`false` the returned status is `SUBMITTED` and the caller can't know
2076whether the change could be merged successfully.
2077|==========================
2078
Edwin Kempin0eddba02013-02-22 15:30:12 +01002079[[submit-input]]
2080SubmitInput
2081~~~~~~~~~~~
2082The `SubmitInput` entity contains information for submitting a change.
2083
2084[options="header",width="50%",cols="1,^1,5"]
2085|===========================
2086|Field Name ||Description
2087|`wait_for_merge`|`false` if not set|
2088Whether the request should wait for the merge to complete. +
2089If `false` the request returns immediately after the change has been
2090added to the merge queue and the caller can't know whether the change
2091could be merged successfully.
2092|===========================
2093
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002094[[submit-record]]
2095SubmitRecord
2096~~~~~~~~~~~~
2097The `SubmitRecord` entity describes results from a submit_rule.
2098
2099[options="header",width="50%",cols="1,^1,5"]
2100|===========================
2101|Field Name ||Description
2102|`status`||
2103`OK`, the change can be submitted. +
2104`NOT_READY`, additional labels are required before submit. +
2105`CLOSED`, closed changes cannot be submitted. +
2106`RULE_ERROR`, rule code failed with an error.
2107|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01002108Map of labels that are approved; an
2109link:rest-api-accounts.html#account-info[AccountInfo] identifies the
2110voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002111|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01002112Map of labels that are preventing submit;
2113link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002114|`need`|optional|
2115Map of labels that need to be given to submit. The value is
2116currently an empty object.
2117|`may`|optional|
2118Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01002119link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
2120if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002121|`impossible`|optional|
2122Map of labels that should have been in `need` but cannot be
2123used by any user because of access restrictions. The value
2124is currently an empty object.
2125|`error_message`|optional|
2126When status is RULE_ERROR this message provides some text describing
2127the failure of the rule predicate.
2128|===========================
2129
Edwin Kempin64006bb2013-02-22 08:17:04 +01002130[[topic-input]]
2131TopicInput
2132~~~~~~~~~~
2133The `TopicInput` entity contains information for setting a topic.
2134
2135[options="header",width="50%",cols="1,^1,5"]
2136|===========================
2137|Field Name ||Description
2138|`topic` |optional|The topic. +
2139The topic will be deleted if not set.
2140|`message` |optional|
2141Message to be added as review comment to the change when setting the
2142topic.
2143|===========================
2144
Edwin Kempind0a63922013-01-23 16:32:59 +01002145
2146GERRIT
2147------
2148Part of link:index.html[Gerrit Code Review]