blob: a3e9f0836685dff1be4449f71b26f19b95621000 [file] [log] [blame]
Edwin Kempind0a63922013-01-23 16:32:59 +01001Gerrit Code Review - '/changes/' REST API
2=========================================
3
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 Kempin82d30372013-02-04 08:49:34 +010013GET /changes/ (Query Changes)
14~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +010015Queries changes visible to the caller. The query string must be
16provided by the `q` parameter. The `n` parameter can be used to limit
17the returned results.
18
Edwin Kempine3446292013-02-19 16:40:14 +010019As result a list of link:#change-info[ChangeInfo] entries is returned.
20The change output is sorted by the last update time, most recently
21updated to oldest updated.
22
Edwin Kempind0a63922013-01-23 16:32:59 +010023Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010024
25.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010026----
Edwin Kempin2091edb2013-01-23 19:07:38 +010027 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010028----
Edwin Kempind0a63922013-01-23 16:32:59 +010029
Edwin Kempin37440832013-02-06 11:36:00 +010030.Response
31----
Edwin Kempind0a63922013-01-23 16:32:59 +010032 HTTP/1.1 200 OK
33 Content-Disposition: attachment
34 Content-Type: application/json;charset=UTF-8
35
36 )]}'
37 {
38 "kind": "gerritcodereview#change",
39 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
40 "project": "demo",
41 "branch": "master",
42 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
43 "subject": "One change",
44 "status": "NEW",
45 "created": "2012-07-17 07:18:30.854000000",
46 "updated": "2012-07-17 07:19:27.766000000",
47 "reviewed": true,
Edwin Kempindb1f0b82013-02-21 15:07:00 +010048 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +010049 "_sortkey": "001e7057000006dc",
50 "_number": 1756,
51 "owner": {
52 "name": "John Doe"
53 },
54 },
55 {
56 "kind": "gerritcodereview#change",
57 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
58 "project": "demo",
59 "branch": "master",
60 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
61 "subject": "Another change",
62 "status": "NEW",
63 "created": "2012-07-17 07:18:30.884000000",
64 "updated": "2012-07-17 07:18:30.885000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +010065 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +010066 "_sortkey": "001e7056000006dd",
67 "_number": 1757,
68 "owner": {
69 "name": "John Doe"
70 },
71 "_more_changes": true
72 }
73----
74
Edwin Kempind0a63922013-01-23 16:32:59 +010075If the `n` query parameter is supplied and additional changes exist
76that match the query beyond the end, the last change object has a
77`_more_changes: true` JSON field set. Callers can resume a query with
Christian Aistleitner55364012013-02-17 12:18:22 +010078the `N` query parameter, supplying the last change's `_sortkey` field
79as the value. When going in the reverse direction with the `P` query
Edwin Kempind0a63922013-01-23 16:32:59 +010080parameter a `_more_changes: true` is put in the first change object if
81there are results *before* the first change returned.
82
83Clients are allowed to specify more than one query by setting the `q`
84parameter multiple times. In this case the result is an array of
85arrays, one per query in the same order the queries were given in.
86
Edwin Kempina64c4b92013-01-23 11:30:40 +010087.Query for the 25 most recent open changes of the projects that you watch
88****
89get::/changes/?q=status:open+is:watched&n=25
90****
91
Edwin Kempind0a63922013-01-23 16:32:59 +010092Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +010093
94.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010095----
96 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 +010097----
Edwin Kempind0a63922013-01-23 16:32:59 +010098
Edwin Kempin37440832013-02-06 11:36:00 +010099.Response
100----
Edwin Kempind0a63922013-01-23 16:32:59 +0100101 HTTP/1.1 200 OK
102 Content-Disposition: attachment
103 Content-Type: application/json;charset=UTF-8
104
105 )]}'
106 [
107 [
108 {
109 "kind": "gerritcodereview#change",
110 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
111 "project": "demo",
112 "branch": "master",
113 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
114 "subject": "One change",
115 "status": "NEW",
116 "created": "2012-07-17 07:18:30.854000000",
117 "updated": "2012-07-17 07:19:27.766000000",
118 "reviewed": true,
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100119 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100120 "_sortkey": "001e7057000006dc",
121 "_number": 1756,
122 "owner": {
123 "name": "John Doe"
124 },
125 "labels": {
126 "Verified": {},
127 "Code-Review": {}
128 }
129 }
130 ],
131 [],
132 []
133 ]
134----
135
Edwin Kempina64c4b92013-01-23 11:30:40 +0100136.Query the changes for your user dashboard
137****
138get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
139****
140
Edwin Kempind0a63922013-01-23 16:32:59 +0100141Additional fields can be obtained by adding `o` parameters, each
142option requires more database lookups and slows down the query
143response time to the client so they are generally disabled by
144default. Optional fields are:
145
Edwin Kempine3446292013-02-19 16:40:14 +0100146[[labels]]
147--
Edwin Kempind0a63922013-01-23 16:32:59 +0100148* `LABELS`: a summary of each label required for submit, and
149 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100150--
Edwin Kempind0a63922013-01-23 16:32:59 +0100151
Edwin Kempine3446292013-02-19 16:40:14 +0100152[[detailed-labels]]
153--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800154* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800155 values of all existing approvals, recognized label values, values
156 permitted to be set by the current user, and reviewers that may be
157 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100158--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800159
Edwin Kempine3446292013-02-19 16:40:14 +0100160[[current-revision]]
161--
Edwin Kempind0a63922013-01-23 16:32:59 +0100162* `CURRENT_REVISION`: describe the current revision (patch set)
163 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100164--
Edwin Kempind0a63922013-01-23 16:32:59 +0100165
Edwin Kempine3446292013-02-19 16:40:14 +0100166[[all-revisions]]
167--
Edwin Kempind0a63922013-01-23 16:32:59 +0100168* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100169--
Edwin Kempind0a63922013-01-23 16:32:59 +0100170
Edwin Kempine3446292013-02-19 16:40:14 +0100171[[current-commit]]
172--
Edwin Kempind0a63922013-01-23 16:32:59 +0100173* `CURRENT_COMMIT`: parse and output all header fields from the
174 commit object, including message. Only valid when the current
175 revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100176--
Edwin Kempind0a63922013-01-23 16:32:59 +0100177
Edwin Kempine3446292013-02-19 16:40:14 +0100178[[all-commits]]
179--
Edwin Kempind0a63922013-01-23 16:32:59 +0100180* `ALL_COMMITS`: parse and output all header fields from the
181 output revisions. If only `CURRENT_REVISION` was requested
182 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100183--
Edwin Kempind0a63922013-01-23 16:32:59 +0100184
Edwin Kempine3446292013-02-19 16:40:14 +0100185[[current-files]]
186--
Edwin Kempind0a63922013-01-23 16:32:59 +0100187* `CURRENT_FILES`: list files modified by the commit, including
188 basic line counts inserted/deleted per file. Only valid when
189 the current revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100190--
Edwin Kempind0a63922013-01-23 16:32:59 +0100191
Edwin Kempine3446292013-02-19 16:40:14 +0100192[[all-files]]
193--
Edwin Kempind0a63922013-01-23 16:32:59 +0100194* `ALL_FILES`: list files modified by the commit, including
195 basic line counts inserted/deleted per file. If only the
196 `CURRENT_REVISION` was requested the only that commit's
197 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100198--
Edwin Kempind0a63922013-01-23 16:32:59 +0100199
Edwin Kempine3446292013-02-19 16:40:14 +0100200[[detailed-accounts]]
201--
Dave Borowitz8926a882013-02-01 14:32:48 -0800202* `DETAILED_ACCOUNTS`: include `_account_id` and `email` fields when
203 referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100204--
Dave Borowitz8926a882013-02-01 14:32:48 -0800205
Edwin Kempin37440832013-02-06 11:36:00 +0100206.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100207----
208 GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100209----
Edwin Kempind0a63922013-01-23 16:32:59 +0100210
Edwin Kempin37440832013-02-06 11:36:00 +0100211.Response
212----
Edwin Kempind0a63922013-01-23 16:32:59 +0100213 HTTP/1.1 200 OK
214 Content-Disposition: attachment
215 Content-Type: application/json;charset=UTF-8
216
217 )]}'
218 [
219 {
220 "kind": "gerritcodereview#change",
221 "id": "demo~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
222 "project": "gerrit",
223 "branch": "master",
224 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
225 "subject": "Use an EventBus to manage star icons",
226 "status": "NEW",
227 "created": "2012-04-25 00:52:25.580000000",
228 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100229 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100230 "_sortkey": "001c9bf400000061",
231 "_number": 97,
232 "owner": {
233 "name": "Shawn Pearce"
234 },
235 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
236 "revisions": {
237 "184ebe53805e102605d11f6b143486d15c23a09c": {
238 "_number": 1,
239 "fetch": {
240 "git": {
241 "url": "git://localhost/gerrit",
242 "ref": "refs/changes/97/97/1"
243 },
244 "http": {
245 "url": "http://127.0.0.1:8080/gerrit",
246 "ref": "refs/changes/97/97/1"
247 }
248 },
249 "commit": {
250 "parents": [
251 {
252 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
253 "subject": "Migrate contributor agreements to All-Projects."
254 }
255 ],
256 "author": {
257 "name": "Shawn O. Pearce",
258 "email": "sop@google.com",
259 "date": "2012-04-24 18:08:08.000000000",
260 "tz": -420
261 },
262 "committer": {
263 "name": "Shawn O. Pearce",
264 "email": "sop@google.com",
265 "date": "2012-04-24 18:08:08.000000000",
266 "tz": -420
267 },
268 "subject": "Use an EventBus to manage star icons",
269 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
270 },
271 "files": {
272 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
273 "lines_deleted": 8
274 },
275 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
276 "lines_inserted": 1
277 },
278 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
279 "lines_inserted": 11,
280 "lines_deleted": 19
281 },
282 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
283 "lines_inserted": 23,
284 "lines_deleted": 20
285 },
286 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
287 "status": "D",
288 "lines_deleted": 139
289 },
290 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
291 "status": "A",
292 "lines_inserted": 204
293 },
294 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
295 "lines_deleted": 9
296 }
297 }
298 }
299 }
300 }
301 ]
302----
303
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100304[[get-change]]
305GET /changes/\{change-id\} (Get Change)
306~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307Retrieves a change.
308
309.Request
310----
311 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
312----
313
314As response a link:#change-info[ChangeInfo] entity is returned that
315describes the change.
316
317.Response
318----
319 HTTP/1.1 200 OK
320 Content-Disposition: attachment
321 Content-Type: application/json;charset=UTF-8
322
323 )]}'
324 {
325 "kind": "gerritcodereview#change",
326 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
327 "project": "myProject",
328 "branch": "master",
329 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
330 "subject": "Implementing Feature X",
331 "status": "NEW",
332 "created": "2013-02-01 09:59:32.126000000",
333 "updated": "2013-02-21 11:16:36.775000000",
334 "reviewed": true,
335 "mergeable": true,
336 "_sortkey": "0023412400000f7d",
337 "_number": 3965,
338 "owner": {
339 "name": "John Doe"
340 }
341 }
342----
343
Edwin Kempin8e492202013-02-21 15:38:25 +0100344[[get-change-detail]]
345GET /changes/\{change-id\}/detail (Get Change Detail)
346~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347Retrieves a change with link:#labels[labels], link:#detailed-labels[
348detailed labels] and link:#detailed-accounts[detailed accounts].
349
350.Request
351----
352 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
353----
354
355As response a link:#change-info[ChangeInfo] entity is returned that
356describes the change.
357
358.Response
359----
360 HTTP/1.1 200 OK
361 Content-Disposition: attachment
362 Content-Type: application/json;charset=UTF-8
363
364 )]}'
365 {
366 "kind": "gerritcodereview#change",
367 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
368 "project": "myProject",
369 "branch": "master",
370 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
371 "subject": "Implementing Feature X",
372 "status": "NEW",
373 "created": "2013-02-01 09:59:32.126000000",
374 "updated": "2013-02-21 11:16:36.775000000",
375 "reviewed": true,
376 "mergeable": true,
377 "_sortkey": "0023412400000f7d",
378 "_number": 3965,
379 "owner": {
380 "_account_id": 1000096,
381 "name": "John Doe",
382 "email": "john.doe@example.com"
383 },
384 "labels": {
385 "Verified": {
386 "all": [
387 {
388 "value": 0,
389 "_account_id": 1000096,
390 "name": "John Doe",
391 "email": "john.doe@example.com"
392 },
393 {
394 "value": 0,
395 "_account_id": 1000097,
396 "name": "Jane Roe",
397 "email": "jane.roe@example.com"
398 }
399 ],
400 "values": {
401 "-1": "Fails",
402 " 0": "No score",
403 "+1": "Verified"
404 }
405 },
406 "Code-Review": {
407 "recommended": {
408 "_account_id": 1000097,
409 "name": "Jane Roe",
410 "email": "jane.roe@example.com"
411 },
412 "disliked": {
413 "_account_id": 1000096,
414 "name": "John Doe",
415 "email": "john.doe@example.com"
416 },
417 "all": [
418 {
419 "value": -1,
420 "_account_id": 1000096,
421 "name": "John Doe",
422 "email": "john.doe@example.com"
423 },
424 {
425 "value": 1,
426 "_account_id": 1000097,
427 "name": "Jane Roe",
428 "email": "jane.roe@example.com"
429 }
430 ]
431 "values": {
432 "-2": "Do not submit",
433 "-1": "I would prefer that you didn\u0027t submit this",
434 " 0": "No score",
435 "+1": "Looks good to me, but someone else must approve",
436 "+2": "Looks good to me, approved"
437 }
438 }
439 },
440 "permitted_labels": {
441 "Verified": [
442 "-1",
443 " 0",
444 "+1"
445 ],
446 "Code-Review": [
447 "-2",
448 "-1",
449 " 0",
450 "+1",
451 "+2"
452 ]
453 },
454 "removable_reviewers": [
455 {
456 "_account_id": 1000096,
457 "name": "John Doe",
458 "email": "john.doe@example.com"
459 },
460 {
461 "_account_id": 1000097,
462 "name": "Jane Roe",
463 "email": "jane.roe@example.com"
464 }
465 ]
466 }
467----
468
Edwin Kempin64006bb2013-02-22 08:17:04 +0100469[[get-topic]]
470GET /changes/\{change-id\}/topic (Get Topic)
471~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472Retrieves the topic of a change.
473
474.Request
475----
476 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
477----
478
479.Response
480----
481 HTTP/1.1 200 OK
482 Content-Disposition: attachment
483 Content-Type: application/json;charset=UTF-8
484
485 )]}'
486 "Documentation"
487----
488
489If the change does not have a topic an empty string is returned.
490
491[[set-topic]]
492PUT /changes/\{change-id\}/topic (Set Topic)
493~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
494Sets the topic of a change.
495
496The new topic must be provided in the request body inside a
497link:#topic-input[TopicInput] entity.
498
499.Request
500----
501 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
502 Content-Type: application/json;charset=UTF-8
503
504 {
505 "topic": "Documentation"
506 }
507----
508
509As response the new topic is returned.
510
511.Response
512----
513 HTTP/1.1 200 OK
514 Content-Disposition: attachment
515 Content-Type: application/json;charset=UTF-8
516
517 )]}'
518 "Documentation"
519----
520
521If the topic was deleted the response is "`204 No Content`".
522
523[[delete-topic]]
524DELETE /changes/\{change-id\}/topic (Delete Topic)
525~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
526Deletes the topic of a change.
527
528The request body does not need to include a link:#topic-input[
529TopicInput] entity if no review comment is added.
530
531Please note that some proxies prohibit request bodies for DELETE
532requests. In this case, if you want to specify a commit message, use
533link:#set-topic[PUT] to delete the topic.
534
535.Request
536----
537 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
538----
539
540.Response
541----
542 HTTP/1.1 204 No Content
543----
544
Edwin Kempined5364b2013-02-22 10:39:33 +0100545[[abandon-change]]
546POST /changes/\{change-id\}/abandon (Abandon Change)
547~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
548Abandons a change.
549
550The request body does not need to include a link:#abandon-input[
551AbandonInput] entity if no review comment is added.
552
553.Request
554----
555 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
556----
557
558As response a link:#change-info[ChangeInfo] entity is returned that
559describes the abandoned change.
560
561.Response
562----
563 HTTP/1.1 200 OK
564 Content-Disposition: attachment
565 Content-Type: application/json;charset=UTF-8
566
567 )]}'
568 {
569 "kind": "gerritcodereview#change",
570 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
571 "project": "myProject",
572 "branch": "master",
573 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
574 "subject": "Implementing Feature X",
575 "status": "ABANDONED",
576 "created": "2013-02-01 09:59:32.126000000",
577 "updated": "2013-02-21 11:16:36.775000000",
578 "reviewed": true,
579 "mergeable": true,
580 "_sortkey": "0023412400000f7d",
581 "_number": 3965,
582 "owner": {
583 "name": "John Doe"
584 }
585 }
586----
587
588If the change cannot be abandoned because the change state doesn't
589allow abandoning of the change, the response is "`409 Conflict`" and
590the error message is contained in the response body.
591
592.Response
593----
594 HTTP/1.1 409 Conflict
595 Content-Disposition: attachment
596 Content-Type: text/plain;charset=UTF-8
597
598 change is merged
599----
600
601[[restore-change]]
602POST /changes/\{change-id\}/restore (Restore Change)
603~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604Restores a change.
605
606The request body does not need to include a link:#restore-input[
607RestoreInput] entity if no review comment is added.
608
609.Request
610----
611 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
612----
613
614As response a link:#change-info[ChangeInfo] entity is returned that
615describes the restored change.
616
617.Response
618----
619 HTTP/1.1 200 OK
620 Content-Disposition: attachment
621 Content-Type: application/json;charset=UTF-8
622
623 )]}'
624 {
625 "kind": "gerritcodereview#change",
626 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
627 "project": "myProject",
628 "branch": "master",
629 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
630 "subject": "Implementing Feature X",
631 "status": "NEW",
632 "created": "2013-02-01 09:59:32.126000000",
633 "updated": "2013-02-21 11:16:36.775000000",
634 "reviewed": true,
635 "mergeable": true,
636 "_sortkey": "0023412400000f7d",
637 "_number": 3965,
638 "owner": {
639 "name": "John Doe"
640 }
641 }
642----
643
644If the change cannot be restored because the change state doesn't
645allow restoring the change, the response is "`409 Conflict`" and
646the error message is contained in the response body.
647
648.Response
649----
650 HTTP/1.1 409 Conflict
651 Content-Disposition: attachment
652 Content-Type: text/plain;charset=UTF-8
653
654 change is new
655----
656
Edwin Kempind2ec4152013-02-22 12:17:19 +0100657[[revert-change]]
658POST /changes/\{change-id\}/revert (Revert Change)
659~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
660Reverts a change.
661
662The request body does not need to include a link:#revert-input[
663RevertInput] entity if no review comment is added.
664
665.Request
666----
667 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
668----
669
670As response a link:#change-info[ChangeInfo] entity is returned that
671describes the reverting change.
672
673.Response
674----
675 HTTP/1.1 200 OK
676 Content-Disposition: attachment
677 Content-Type: application/json;charset=UTF-8
678
679 )]}'
680 {
681 "kind": "gerritcodereview#change",
682 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
683 "project": "myProject",
684 "branch": "master",
685 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
686 "subject": "Revert \"Implementing Feature X\"",
687 "status": "NEW",
688 "created": "2013-02-01 09:59:32.126000000",
689 "updated": "2013-02-21 11:16:36.775000000",
690 "reviewed": true,
691 "mergeable": true,
692 "_sortkey": "0023412400000f7d",
693 "_number": 3965,
694 "owner": {
695 "name": "John Doe"
696 }
697 }
698----
699
700If the change cannot be reverted because the change state doesn't
701allow reverting the change, the response is "`409 Conflict`" and
702the error message is contained in the response body.
703
704.Response
705----
706 HTTP/1.1 409 Conflict
707 Content-Disposition: attachment
708 Content-Type: text/plain;charset=UTF-8
709
710 change is new
711----
712
Edwin Kempin0eddba02013-02-22 15:30:12 +0100713[[submit-change]]
714POST /changes/\{change-id\}/submit (Submit Change)
715~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
716Submits a change.
717
718The request body only needs to include a link:#submit-input[
719SubmitInput] entity if the request should wait for the merge to
720complete.
721
722.Request
723----
724 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
725 Content-Type: application/json;charset=UTF-8
726
727 {
728 "wait_for_merge": true
729 }
730----
731
732As response a link:#change-info[ChangeInfo] entity is returned that
733describes the submitted/merged change.
734
735.Response
736----
737 HTTP/1.1 200 OK
738 Content-Disposition: attachment
739 Content-Type: application/json;charset=UTF-8
740
741 )]}'
742 {
743 "kind": "gerritcodereview#change",
744 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
745 "project": "myProject",
746 "branch": "master",
747 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
748 "subject": "Implementing Feature X",
749 "status": "MERGED",
750 "created": "2013-02-01 09:59:32.126000000",
751 "updated": "2013-02-21 11:16:36.775000000",
752 "reviewed": true,
753 "mergeable": true,
754 "_sortkey": "0023412400000f7d",
755 "_number": 3965,
756 "owner": {
757 "name": "John Doe"
758 }
759 }
760----
761
762If the change cannot be submitted because the submit rule doesn't allow
763submitting the change, the response is "`409 Conflict`" and the error
764message is contained in the response body.
765
766.Response
767----
768 HTTP/1.1 409 Conflict
769 Content-Disposition: attachment
770 Content-Type: text/plain;charset=UTF-8
771
772 blocked by Verified
773----
774
Edwin Kempin1dbe19e2013-02-22 16:18:58 +0100775[[reviewer-endpoints]]
776Reviewer Endpoints
777------------------
778
779[[list-reviewers]]
780GET /changes/\{change-id\}/reviewers/ (List Reviewers)
781~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
782Lists the reviewers of a change.
783
784As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
785
786.Request
787----
788 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
789----
790
791.Response
792----
793 HTTP/1.1 200 OK
794 Content-Disposition: attachment
795 Content-Type: application/json;charset=UTF-8
796
797 )]}'
798 [
799 {
800 "kind": "gerritcodereview#reviewer",
801 "approvals": {
802 "Verified": "+1",
803 "Code-Review": "+2"
804 },
805 "_account_id": 1000096,
806 "name": "John Doe",
807 "email": "john.doe@example.com"
808 },
809 {
810 "kind": "gerritcodereview#reviewer",
811 "approvals": {
812 "Verified": " 0",
813 "Code-Review": "-1"
814 },
815 "_account_id": 1000097,
816 "name": "Jane Roe",
817 "email": "jane.roe@example.com"
818 }
819 ]
820----
821
Edwin Kempina3d02ef2013-02-22 16:31:53 +0100822[[get-reviewer]]
823GET /changes/\{change-id\}/reviewers/\{account-id\} (Get Reviewer)
824~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
825Retrieves a reviewer of a change.
826
827As response a link:#reviewer-info[ReviewerInfo] entity is returned that
828describes the reviewer.
829
830.Request
831----
832 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
833----
834
835.Response
836----
837 HTTP/1.1 200 OK
838 Content-Disposition: attachment
839 Content-Type: application/json;charset=UTF-8
840
841 )]}'
842 {
843 "kind": "gerritcodereview#reviewer",
844 "approvals": {
845 "Verified": "+1",
846 "Code-Review": "+2"
847 },
848 "_account_id": 1000096,
849 "name": "John Doe",
850 "email": "john.doe@example.com"
851 }
852----
853
Edwin Kempin392328e2013-02-25 12:50:03 +0100854[[add-reviewer]]
855POST /changes/\{change-id\}/reviewers (Add Reviewer)
856~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
857Adds one user or all members of one group as reviewer to the change.
858
859The reviewer to be added to the change must be provided in the request
860body as a link:#reviewer-input[ReviewerInput] entity.
861
862.Request
863----
864 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
865 Content-Type: application/json;charset=UTF-8
866
867 {
868 "reviewer": "john.doe@example.com"
869 }
870----
871
872As response an link:#add-reviewer-result[AddReviewerResult] entity is
873returned that describes the newly added reviewers.
874
875.Response
876----
877 HTTP/1.1 200 OK
878 Content-Disposition: attachment
879 Content-Type: application/json;charset=UTF-8
880
881 )]}'
882 {
883 "reviewers": [
884 {
885 "kind": "gerritcodereview#reviewer",
886 "approvals": {
887 "Verified": " 0",
888 "Code-Review": " 0"
889 },
890 "_account_id": 1000096,
891 "name": "John Doe",
892 "email": "john.doe@example.com"
893 }
894 ]
895 }
896----
897
898If a group is specified, adding the group members as reviewers is an
899atomic operation. This means if an error is returned, none of the
900members are added as reviewer.
901
902If a group with many members is added as reviewer a confirmation may be
903required.
904
905.Request
906----
907 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
908 Content-Type: application/json;charset=UTF-8
909
910 {
911 "reviewer": "MyProjectVerifiers"
912 }
913----
914
915.Response
916----
917 HTTP/1.1 200 OK
918 Content-Disposition: attachment
919 Content-Type: application/json;charset=UTF-8
920
921 )]}'
922 {
923 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
924 "confirm": true
925 }
926----
927
928To confirm the addition of the reviewers, resend the request with the
929`confirm` flag being set.
930
931.Request
932----
933 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
934 Content-Type: application/json;charset=UTF-8
935
936 {
937 "reviewer": "MyProjectVerifiers",
938 "confirm": true
939 }
940----
941
Edwin Kempin53301072013-02-25 12:57:07 +0100942[[delete-reviewer]]
943DELETE /changes/\{change-id\}/reviewers/\{account-id\} (Delete Reviewer)
944~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
945Deletes a reviewer from a change.
946
947.Request
948----
949 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
950----
951
952.Response
953----
954 HTTP/1.1 204 No Content
955----
956
Edwin Kempinda6e5fa2013-02-25 14:48:12 +0100957[[revision-endpoints]]
958Revision Endpoints
959------------------
960
961[[get-review]]
962GET /changes/\{change-id\}/revisions/\{revision-id\}/review (Get Review)
963~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
964Retrieves a review of a revision.
965
966.Request
967----
968 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
969----
970
971As response a link:#change-info[ChangeInfo] entity with
972link:#detailed-labels[detailed labels] and link:#detailed-accounts[
973detailed accounts] is returned that describes the review of the
974revision. The revision for which the review is retrieved is contained
975in the `revisions` field. In addition the `current_revision` field is
976set, if the revision for which the review is retrieved, is the current
977revision of the change. Please note that the returned labels are always
978for the current patch set.
979
980.Response
981----
982 HTTP/1.1 200 OK
983 Content-Disposition: attachment
984 Content-Type: application/json;charset=UTF-8
985
986 )]}'
987 {
988 "kind": "gerritcodereview#change",
989 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
990 "project": "myProject",
991 "branch": "master",
992 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
993 "subject": "Implementing Feature X",
994 "status": "NEW",
995 "created": "2013-02-01 09:59:32.126000000",
996 "updated": "2013-02-21 11:16:36.775000000",
997 "reviewed": true,
998 "mergeable": true,
999 "_sortkey": "0023412400000f7d",
1000 "_number": 3965,
1001 "owner": {
1002 "_account_id": 1000096,
1003 "name": "John Doe",
1004 "email": "john.doe@example.com"
1005 },
1006 "labels": {
1007 "Verified": {
1008 "all": [
1009 {
1010 "value": 0,
1011 "_account_id": 1000096,
1012 "name": "John Doe",
1013 "email": "john.doe@example.com"
1014 },
1015 {
1016 "value": 0,
1017 "_account_id": 1000097,
1018 "name": "Jane Roe",
1019 "email": "jane.roe@example.com"
1020 }
1021 ],
1022 "values": {
1023 "-1": "Fails",
1024 " 0": "No score",
1025 "+1": "Verified"
1026 }
1027 },
1028 "Code-Review": {
1029 "all": [
1030 {
1031 "value": -1,
1032 "_account_id": 1000096,
1033 "name": "John Doe",
1034 "email": "john.doe@example.com"
1035 },
1036 {
1037 "value": 1,
1038 "_account_id": 1000097,
1039 "name": "Jane Roe",
1040 "email": "jane.roe@example.com"
1041 }
1042 ]
1043 "values": {
1044 "-2": "Do not submit",
1045 "-1": "I would prefer that you didn\u0027t submit this",
1046 " 0": "No score",
1047 "+1": "Looks good to me, but someone else must approve",
1048 "+2": "Looks good to me, approved"
1049 }
1050 }
1051 },
1052 "permitted_labels": {
1053 "Verified": [
1054 "-1",
1055 " 0",
1056 "+1"
1057 ],
1058 "Code-Review": [
1059 "-2",
1060 "-1",
1061 " 0",
1062 "+1",
1063 "+2"
1064 ]
1065 },
1066 "removable_reviewers": [
1067 {
1068 "_account_id": 1000096,
1069 "name": "John Doe",
1070 "email": "john.doe@example.com"
1071 },
1072 {
1073 "_account_id": 1000097,
1074 "name": "Jane Roe",
1075 "email": "jane.roe@example.com"
1076 }
1077 ],
1078 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1079 "revisions": {
1080 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1081 "_number": 2,
1082 "fetch": {
1083 "http": {
1084 "url": "http://gerrit/myProject",
1085 "ref": "refs/changes/65/3965/2"
1086 }
1087 }
1088 }
1089 }
1090----
1091
Edwin Kempin67498de2013-02-25 16:15:34 +01001092[[set-review]]
1093POST /changes/\{change-id\}/revisions/\{revision-id\}/review (Set Review)
1094~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1095Sets a review on a revision.
1096
1097The review must be provided in the request body as a
1098link:#review-input[ReviewInput] entity.
1099
1100.Request
1101----
1102 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1103 Content-Type: application/json;charset=UTF-8
1104
1105 {
1106 "message": "Some nits need to be fixed.",
1107 "labels": {
1108 "Code-Review": -1
1109 },
1110 "comments": {
1111 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1112 {
1113 "line": 23,
1114 "message": "[nit] trailing whitespace"
1115 },
1116 {
1117 "line": 49,
1118 "message": "[nit] s/conrtol/control"
1119 }
1120 ]
1121 }
1122 }
1123----
1124
1125As response a link:#review-info[ReviewInfo] entity is returned that
1126describes the applied labels.
1127
1128.Response
1129----
1130 HTTP/1.1 200 OK
1131 Content-Disposition: attachment
1132 Content-Type: application/json;charset=UTF-8
1133
1134 )]}'
1135 {
1136 "labels": {
1137 "Code-Review": -1
1138 }
1139 }
1140----
1141
Edwin Kempin14b58112013-02-26 16:30:19 +01001142[[submit-revision]]
1143POST /changes/\{change-id\}/revisions/\{revision-id\}/submit (Submit Revision)
1144~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1145Submits a revision.
1146
1147The request body only needs to include a link:#submit-input[
1148SubmitInput] entity if the request should wait for the merge to
1149complete.
1150
1151.Request
1152----
1153 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
1154 Content-Type: application/json;charset=UTF-8
1155
1156 {
1157 "wait_for_merge": true
1158 }
1159----
1160
1161As response a link:#submit-info[SubmitInfo] entity is returned that
1162describes the status of the submitted change.
1163
1164.Response
1165----
1166 HTTP/1.1 200 OK
1167 Content-Disposition: attachment
1168 Content-Type: application/json;charset=UTF-8
1169
1170 )]}'
1171 {
1172 "status": "MERGED"
1173 }
1174----
1175
1176If the revision cannot be submitted, e.g. because the submit rule
1177doesn't allow submitting the revision or the revision is not the
1178current revision, the response is "`409 Conflict`" and the error
1179message is contained in the response body.
1180
1181.Response
1182----
1183 HTTP/1.1 409 Conflict
1184 Content-Type: text/plain;charset=UTF-8
1185
1186 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
1187----
1188
Edwin Kempincb6724a2013-02-26 16:58:51 +01001189[[list-drafts]]
1190GET /changes/\{change-id\}/revisions/\{revision-id\}/drafts/ (List Drafts)
1191~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempin3ca57192013-02-27 07:44:01 +01001192Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01001193user.
1194
1195As result a map is returned that maps the file path to a list of
1196link:#comment-info[CommentInfo] entries. The entries in the map are
1197sorted by file path.
1198
1199.Request
1200----
1201 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
1202----
1203
1204.Response
1205----
1206 HTTP/1.1 200 OK
1207 Content-Disposition: attachment
1208 Content-Type: application/json;charset=UTF-8
1209
1210 )]}'
1211 {
1212 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1213 {
1214 "kind": "gerritcodereview#comment",
1215 "id": "TvcXrmjM",
1216 "line": 23,
1217 "message": "[nit] trailing whitespace",
1218 "updated": "2013-02-26 15:40:43.986000000"
1219 },
1220 {
1221 "kind": "gerritcodereview#comment",
1222 "id": "TveXwFiA",
1223 "line": 49,
1224 "in_reply_to": "TfYX-Iuo",
1225 "message": "Done",
1226 "updated": "2013-02-26 15:40:45.328000000"
1227 }
1228 ]
1229 }
1230----
1231
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001232[[create-draft]]
1233PUT /changes/\{change-id\}/revisions/\{revision-id\}/drafts (Create Draft)
1234~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1235Creates a draft comment on a revision.
1236
1237The new draft comment must be provided in the request body inside a
1238link:#comment-input[CommentInput] entity.
1239
1240.Request
1241----
1242 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
1243 Content-Type: application/json;charset=UTF-8
1244
1245 {
1246 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1247 "line": 23,
1248 "message": "[nit] trailing whitespace"
1249 }
1250----
1251
1252As response a link:#comment-info[CommentInfo] entity is returned that
1253describes the draft comment.
1254
1255.Response
1256----
1257 HTTP/1.1 200 OK
1258 Content-Disposition: attachment
1259 Content-Type: application/json;charset=UTF-8
1260
1261 )]}'
1262 {
1263 "kind": "gerritcodereview#comment",
1264 "id": "TvcXrmjM",
1265 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1266 "line": 23,
1267 "message": "[nit] trailing whitespace",
1268 "updated": "2013-02-26 15:40:43.986000000"
1269 }
1270----
1271
Edwin Kempin3ca57192013-02-27 07:44:01 +01001272[[get-draft]]
1273GET /changes/\{change-id\}/revisions/\{revision-id\}/drafts/\{draft-id\} (Get Draft)
1274~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1275Retrieves a draft comment of a revision that belongs to the calling
1276user.
1277
1278.Request
1279----
1280 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1281----
1282
1283As response a link:#comment-info[CommentInfo] entity is returned that
1284describes the draft comment.
1285
1286.Response
1287----
1288 HTTP/1.1 200 OK
1289 Content-Disposition: attachment
1290 Content-Type: application/json;charset=UTF-8
1291
1292 )]}'
1293 {
1294 "kind": "gerritcodereview#comment",
1295 "id": "TvcXrmjM",
1296 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1297 "line": 23,
1298 "message": "[nit] trailing whitespace",
1299 "updated": "2013-02-26 15:40:43.986000000"
1300 }
1301----
1302
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001303[[update-draft]]
1304PUT /changes/\{change-id\}/revisions/\{revision-id\}/drafts/\{draft-id\} (Update Draft)
1305~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1306Updates a draft comment on a revision.
1307
1308The new draft comment must be provided in the request body inside a
1309link:#comment-input[CommentInput] entity.
1310
1311.Request
1312----
1313 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1314 Content-Type: application/json;charset=UTF-8
1315
1316 {
1317 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1318 "line": 23,
1319 "message": "[nit] trailing whitespace"
1320 }
1321----
1322
1323As response a link:#comment-info[CommentInfo] entity is returned that
1324describes the draft comment.
1325
1326.Response
1327----
1328 HTTP/1.1 200 OK
1329 Content-Disposition: attachment
1330 Content-Type: application/json;charset=UTF-8
1331
1332 )]}'
1333 {
1334 "kind": "gerritcodereview#comment",
1335 "id": "TvcXrmjM",
1336 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1337 "line": 23,
1338 "message": "[nit] trailing whitespace",
1339 "updated": "2013-02-26 15:40:43.986000000"
1340 }
1341----
1342
1343[[delete-draft]]
1344DELETE /changes/\{change-id\}/revisions/\{revision-id\}/drafts/\{draft-id\} (Delete Draft)
1345~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1346Deletes a draft comment from a revision.
1347
1348.Request
1349----
1350 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1351----
1352
1353.Response
1354----
1355 HTTP/1.1 204 No Content
1356----
1357
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001358[[set-reviewed]]
1359PUT /changes/\{change-id\}/revisions/\{revision-id\}/files/\{patch-id\}\reviewed (Set Reviewed)
1360~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1361Marks a patch of a revision as reviewed by the calling user.
1362
1363.Request
1364----
1365 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
1366----
1367
1368.Response
1369----
1370 HTTP/1.1 201 Created
1371----
1372
1373If the patch was already marked as reviewed by the calling user the
1374response is "`200 OK`".
1375
1376[[delete-reviewed]]
1377DELETE /changes/\{change-id\}/revisions/\{revision-id\}/files/\{patch-id\}\reviewed (Delete Reviewed)
1378~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1379Deletes the reviewed flag of the calling user from a patch of a revision.
1380
1381.Request
1382----
1383 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
1384----
1385
1386.Response
1387----
1388 HTTP/1.1 204 No Content
1389----
1390
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001391
1392[[ids]]
1393IDs
1394---
1395
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001396[[account-id]]
1397link:rest-api-accounts.html#account-id[\{account-id\}]
1398~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1399--
1400--
1401
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001402[[change-id]]
1403\{change-id\}
1404~~~~~~~~~~~~~
1405Identifier that uniquely identifies one change.
1406
1407This can be:
1408
1409* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
1410 where for the branch the `refs/heads/` prefix can be omitted
1411 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
1412* a Change-Id if it uniquely identifies one change
1413 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
1414* a legacy numeric change ID ("4247")
1415
Edwin Kempin3ca57192013-02-27 07:44:01 +01001416[[draft-id]]
1417\{draft-id\}
1418~~~~~~~~~~~~
1419UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01001420
Edwin Kempin9300e4c2013-02-27 08:42:06 +01001421[[patch-id]]
1422\{patch-id\}
1423~~~~~~~~~~~~
1424The file path of the patch.
1425
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001426[[revision-id]]
1427\{revision-id\}
1428~~~~~~~~~~~~~~~
1429Identifier that uniquely identifies one revision of a change.
1430
1431This can be:
1432
1433* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
1434* an abbreviated commit ID that uniquely identifies one revision of the
1435 change ("674ac754"), at least 4 digits are required
1436* a legacy numeric patch number ("1" for first patch set of the change)
1437
1438
Edwin Kempine3446292013-02-19 16:40:14 +01001439[[json-entities]]
1440JSON Entities
1441-------------
1442
Edwin Kempined5364b2013-02-22 10:39:33 +01001443[[abandon-input]]
1444AbandonInput
1445~~~~~~~~~~~~
1446The `AbandonInput` entity contains information for abandoning a change.
1447
1448[options="header",width="50%",cols="1,^1,5"]
1449|===========================
1450|Field Name ||Description
1451|`message` |optional|
1452Message to be added as review comment to the change when abandoning the
1453change.
1454|===========================
1455
Edwin Kempine3446292013-02-19 16:40:14 +01001456[[account-info]]
1457AccountInfo
1458~~~~~~~~~~~
1459The `AccountInfo` entity contains information about an account.
1460
1461[options="header",width="50%",cols="1,^1,5"]
1462|===========================
1463|Field Name ||Description
1464|`_account_id` ||The numeric ID of the account.
1465|`name` |optional|The full name of the user. +
1466Only set if link:#detailed-accounts[detailed account information] is
1467requested.
1468|`email` |optional|
1469The email address the user prefers to be contacted through. +
1470Only set if link:#detailed-accounts[detailed account information] is
1471requested.
1472|===========================
1473
Edwin Kempin392328e2013-02-25 12:50:03 +01001474[[add-reviewer-result]]
1475AddReviewerResult
1476~~~~~~~~~~~~~~~~~
1477The `AddReviewerResult` entity describes the result of adding a
1478reviewer to a change.
1479
1480[options="header",width="50%",cols="1,^1,5"]
1481|===========================
1482|Field Name ||Description
1483|`reviewers` |optional|
1484The newly added reviewers as a list of link:#reviewer-info[
1485ReviewerInfo] entities.
1486|`error` |optional|
1487Error message explaining why the reviewer could not be added. +
1488If a group was specified in the input and an error is returned, it
1489means that none of the members were added as reviewer.
1490|`confirm` |`false` if not set|
1491Whether adding the reviewer requires confirmation.
1492|===========================
1493
Edwin Kempine3446292013-02-19 16:40:14 +01001494[[approval-info]]
1495ApprovalInfo
1496~~~~~~~~~~~~
1497The `ApprovalInfo` entity contains information about an approval from a
1498user for a label on a change.
1499
1500`ApprovalInfo` has the same fields as link:#account-info[AccountInfo].
1501In addition `ApprovalInfo` has the following fields:
1502
1503[options="header",width="50%",cols="1,^1,5"]
1504|===========================
1505|Field Name ||Description
1506|`value` ||The vote that the user has given for the label.
1507|===========================
1508
1509[[change-info]]
1510ChangeInfo
1511~~~~~~~~~~
1512The `ChangeInfo` entity contains information about a change.
1513
1514[options="header",width="50%",cols="1,^1,5"]
1515|==================================
1516|Field Name ||Description
1517|`kind` ||`gerritcodereview#change`
1518|`id` ||
1519The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
1520where project, branch and Change-Id are URL encoded. For branch the
1521`refs/heads/` prefix is omitted.
1522|`project` ||The name of the project.
1523|`branch` ||
1524The name of the target branch. +
1525The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01001526|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01001527|`change_id` ||The Change-Id of the change.
1528|`subject` ||
1529The subject of the change (header line of the commit message).
1530|`status` ||
1531The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
1532`DRAFT`).
1533|`created` ||
1534The link:rest-api.html#timestamp[timestamp] of when the change was
1535created.
1536|`updated` ||
1537The link:rest-api.html#timestamp[timestamp] of when the change was last
1538updated.
1539|`starred` |not set if `false`|
1540Whether the calling user has starred this change.
1541|`reviewed` |not set if `false`|
1542Whether the change was reviewed by the calling user.
1543|`mergeable` ||Whether the change is mergeable.
1544|`_sortkey` ||The sortkey of the change.
1545|`_number` ||The legacy numeric ID of the change.
1546|`owner` ||
1547The owner of the change as an link:#account-info[AccountInfo] entity.
1548|`labels` |optional|
1549The labels of the change as a map that maps the label names to
1550link:#label-info[LabelInfo] entries. +
1551Only set if link:#labels[labels] or link:#detailed-labels[detailed
1552labels] are requested.
1553|`permitted_labels` |optional|
1554A map of the permitted labels that maps a label name to the list of
1555values that are allowed for that label. +
1556Only set if link:#detailed-labels[detailed labels] are requested.
1557|`removable_reviewers`|optional|
1558The reviewers that can be removed by the calling user as a list of
1559link:#account-info[AccountInfo] entities. +
1560Only set if link:#detailed-labels[detailed labels] are requested.
1561|`current_revision` |optional|
1562The commit ID of the current patch set of this change. +
1563Only set if link:#current-revision[the current revision] is requested
1564or if link:#all-revisions[all revisions] are requested.
1565|`revisions` |optional|
1566All patch sets of this changes as a map that maps the commit ID of the
1567patch set to a link:#revision-info[RevisionInfo] entity. +
1568Only set if link:#all-revisions[all revisions] are requested.
1569|`_more_changes` |optional, not set if `false`|
1570Whether the query would deliver more results if not limited. +
1571Only set on either the last or the first change that is returned.
1572|==================================
1573
Edwin Kempincb6724a2013-02-26 16:58:51 +01001574[[comment-info]]
1575CommentInfo
1576~~~~~~~~~~~
1577The `CommitInfo` entity contains information about an inline comment.
1578
1579[options="header",width="50%",cols="1,^1,5"]
1580|===========================
1581|Field Name ||Description
1582|`kind` ||`gerritcodereview#comment`
1583|`id` ||The URL encoded UUID of the draft comment.
1584|`path` |optional|
1585The path of the file for which the inline comment was done. +
1586Not set if returned in a map where the key is the file path.
1587|`side` |optional|
1588The side on which the comment was added. +
1589Allowed values are `REVISION` and `PARENT`. +
1590If not set, the default is `REVISION`.
1591|`line` |optional|
1592The number of the line for which the comment was done. +
1593If not set, it's a file comment.
1594|`in_reply_to` |optional|
1595The URL encoded UUID of the comment to which this comment is a reply.
1596|`message` |optional|The comment message.
1597|`updated` ||
1598The link:rest-api.html#timestamp[timestamp] of when this comment was
1599written.
1600|===========================
1601
Edwin Kempin67498de2013-02-25 16:15:34 +01001602[[comment-input]]
1603CommentInput
1604~~~~~~~~~~~~
1605The `CommitInput` entity contains information for creating an inline
1606comment.
1607
1608[options="header",width="50%",cols="1,^1,5"]
1609|===========================
1610|Field Name ||Description
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001611|`kind` |optional|
1612Must be `gerritcodereview#comment` if provided.
Edwin Kempin67498de2013-02-25 16:15:34 +01001613|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01001614The URL encoded UUID of the comment if an existing draft comment should
1615be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001616|`path` |optional|
1617The path of the file for which the inline comment should be added. +
1618Doesn't need to be set if contained in a map where the key is the file
1619path.
Edwin Kempin67498de2013-02-25 16:15:34 +01001620|`side` |optional|
1621The side on which the comment should be added. +
1622Allowed values are `REVISION` and `PARENT`. +
1623If not set, the default is `REVISION`.
1624|`line` |optional|
1625The number of the line for which the comment should be added. +
1626`0` if it is a file comment. +
1627If not set, a file comment is added.
1628|`in_reply_to` |optional|
1629The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001630|`updated` |optional|
1631The link:rest-api.html#timestamp[timestamp] of this comment. +
1632Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01001633|`message` |optional|
1634The comment message. +
1635If not set and an existing draft comment is updated, the existing draft
1636comment is deleted.
1637|===========================
1638
Edwin Kempine3446292013-02-19 16:40:14 +01001639[[commit-info]]
1640CommitInfo
1641~~~~~~~~~~
1642The `CommitInfo` entity contains information about a commit.
1643
1644[options="header",width="50%",cols="1,6"]
1645|==========================
1646|Field Name |Description
1647|`commit` |The commit ID.
1648|`parent` |
1649The parent commits of this commit as a list of
1650link:#commit-info[CommitInfo] entities.
1651|`author` |The author of the commit as a
1652link:#git-person-info[GitPersonInfo] entity.
1653|`committer` |The committer of the commit as a
1654link:#git-person-info[GitPersonInfo] entity.
1655|`subject` |
1656The subject of the commit (header line of the commit message).
1657|`message` |The commit message.
1658|==========================
1659
1660[[fetch-info]]
1661FetchInfo
1662~~~~~~~~~
1663The `FetchInfo` entity contains information about how to fetch a patch
1664set via a certain protocol.
1665
1666[options="header",width="50%",cols="1,6"]
1667|==========================
1668|Field Name |Description
1669|`url` |The URL of the project.
1670|`ref` |The ref of the patch set.
1671|==========================
1672
1673[[file-info]]
1674FileInfo
1675~~~~~~~~
1676The `FileInfo` entity contains information about a file in a patch set.
1677
1678[options="header",width="50%",cols="1,^1,5"]
1679|=============================
1680|Field Name ||Description
1681|`status` |optional|
1682The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
1683"`C`"=Copied, "`W`"=Rewritten). +
1684Not set if the file was Modified ("`M`").
1685|`binary` |not set if `false`|Whether the file is binary.
1686|`old_path` |optional|
1687The old file path. +
1688Only set if file was renamed or copied.
1689|`lines_inserted`|optional|
1690Number of inserted lines. +
1691Not set for binary files or if no lines were inserted.
1692|`lines_deleted` |optional|
1693Number of deleted lines. +
1694Not set for binary files or if no lines were deleted.
1695|=============================
1696
1697[[git-person-info]]
1698GitPersonInfo
1699~~~~~~~~~~~~~
1700The `GitPersonInfo` entity contains information about the
1701author/committer of a commit.
1702
1703[options="header",width="50%",cols="1,6"]
1704|==========================
1705|Field Name |Description
1706|`name` |The name of the author/committer.
1707|`email` |The email address of the author/committer.
1708|`date` |The link:rest-api.html#timestamp[timestamp] of when
1709this identity was constructed.
1710|`tz` |The timezone offset from UTC of when this identity was
1711constructed.
1712|==========================
1713
1714[[label-info]]
1715LabelInfo
1716~~~~~~~~~
1717The `LabelInfo` entity contains information about a label on a change.
1718
1719[options="header",width="50%",cols="1,^1,5"]
1720|===========================
1721|Field Name ||Description
1722|`approved` |optional|The user who approved this label on the change
1723as a link:#account-info[AccountInfo] entity. +
1724Only set if link:#labels[labels] are requested.
1725|`rejected` |optional|The user who rejected this label on the change
1726as a link:#account-info[AccountInfo] entity. +
1727Only set if link:#labels[labels] are requested.
1728|`recommended` |optional|The user who recommended this label on the
1729change as a link:#account-info[AccountInfo] entity. +
1730Only set if link:#labels[labels] are requested.
1731|`disliked` |optional|The user who disliked this label on the change
1732as a link:#account-info[AccountInfo] entity. +
1733Only set if link:#labels[labels] are requested.
1734|`value` |optional|The voting value of the user who
1735recommended/disliked this label on the change if it is not
1736"`+1`"/"`-1`". +
1737Only set if link:#labels[labels] are requested.
1738|`optional` |not set if `false`|
1739Whether the label is optional. Optional means the label may be set, but
1740it's neither necessary for submission nor does it block submission if
1741set.
1742|`all` |optional|List of all approvals for this label as a list
1743of link:#approval-info[ApprovalInfo] entities. +
1744Only set if link:#detailed-labels[detailed labels] are requested.
1745|`values` |optional|A map of all values that are allowed for this
1746label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
1747to the value descriptions. +
1748Only set if link:#detailed-labels[detailed labels] are requested.
1749|===========================
1750
Edwin Kempined5364b2013-02-22 10:39:33 +01001751[[restore-input]]
1752RestoreInput
1753~~~~~~~~~~~~
1754The `RestoreInput` entity contains information for restoring a change.
1755
1756[options="header",width="50%",cols="1,^1,5"]
1757|===========================
1758|Field Name ||Description
1759|`message` |optional|
1760Message to be added as review comment to the change when restoring the
1761change.
1762|===========================
1763
Edwin Kempind2ec4152013-02-22 12:17:19 +01001764[[revert-input]]
1765RevertInput
1766~~~~~~~~~~~
1767The `RevertInput` entity contains information for reverting a change.
1768
1769[options="header",width="50%",cols="1,^1,5"]
1770|===========================
1771|Field Name ||Description
1772|`message` |optional|
1773Message to be added as review comment to the change when reverting the
1774change.
1775|===========================
1776
Edwin Kempin67498de2013-02-25 16:15:34 +01001777[[review-info]]
1778ReviewInfo
1779~~~~~~~~~~
1780The `ReviewInfo` entity contains information about a review.
1781
1782[options="header",width="50%",cols="1,6"]
1783|===========================
1784|Field Name |Description
1785|`labels` |
1786The labels of the review as a map that maps the label names to the
1787voting values.
1788|===========================
1789
1790[[review-input]]
1791ReviewInput
1792~~~~~~~~~~~
1793The `ReviewInput` entity contains information for adding a review to a
1794revision.
1795
1796[options="header",width="50%",cols="1,^1,5"]
1797|============================
1798|Field Name ||Description
1799|`message` |optional|
1800The message to be added as review comment.
1801|`labels` |optional|
1802The votes that should be added to the revision as a map that maps the
1803label names to the voting values.
1804|`comments` |optional|
1805The comments that should be added as a map that maps a file path to a
1806list of link:#comment-input[CommentInput] entities.
1807|`strict_labels`|`true` if not set|
1808Whether all labels are rquired to be within the user's permitted ranges
1809based on access controls. +
1810If `true`, attempting to use a label not granted to the user will fail
1811the entire modify operation early. +
1812If `false`, the operation will execute anyway, but the proposed labels
1813will be modified to be the "best" value allowed by the access controls.
1814|`drafts` |optional|
1815Draft handling that defines how draft comments are handled that are
1816already in the database but that were not also described in this
1817input. +
1818Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
1819If not set, the default is `DELETE`.
1820|`notify` |optional|
1821Notify handling that defines to whom email notifications should be sent
1822after the review is stored. +
1823Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
1824If not set, the default is `ALL`.
1825|============================
1826
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001827[[reviewer-info]]
1828ReviewerInfo
1829~~~~~~~~~~~~
1830The `ReviewerInfo` entity contains information about a reviewer and its
1831votes on a change.
1832
1833`ReviewerInfo` has the same fields as link:#account-info[AccountInfo]
1834and includes link:#detailed-accounts[detailed account information].
1835In addition `ReviewerInfo` has the following fields:
1836
1837[options="header",width="50%",cols="1,6"]
1838|==========================
1839|Field Name |Description
1840|`kind` |`gerritcodereview#reviewer`
1841|`approvals` |
1842The approvals of the reviewer as a map that maps the label names to the
1843approval values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`").
1844|==========================
1845
Edwin Kempin392328e2013-02-25 12:50:03 +01001846[[reviewer-input]]
1847ReviewerInput
1848~~~~~~~~~~~~~
1849The `ReviewerInput` entity contains information for adding a reviewer
1850to a change.
1851
1852[options="header",width="50%",cols="1,^1,5"]
1853|===========================
1854|Field Name ||Description
1855|`reviewer` ||
1856The link:rest-api-accounts.html#account-id[ID] of one account that
1857should be added as reviewer or the link:rest-api-groups.html#group-id[
1858ID] of one group for which all members should be added as reviewers. +
1859If an ID identifies both an account and a group, only the account is
1860added as reviewer to the change.
1861|`confirmed` |optional|
1862Whether adding the reviewer is confirmed. +
1863The Gerrit server may be configured to
1864link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
1865confirmation] when adding a group as reviewer that has many members.
1866|===========================
1867
Edwin Kempine3446292013-02-19 16:40:14 +01001868[[revision-info]]
1869RevisionInfo
1870~~~~~~~~~~~~
1871The `RevisionInfo` entity contains information about a patch set.
1872
1873[options="header",width="50%",cols="1,^1,5"]
1874|===========================
1875|Field Name ||Description
1876|`draft` |not set if `false`|Whether the patch set is a draft.
1877|`_number` ||The patch set number.
1878|`fetch` ||
1879Information about how to fetch this patch set. The fetch information is
1880provided as a map that maps the protocol name ("`git`", "`http`",
1881"`ssh`") to link:#fetch-info[FetchInfo] entities.
1882|`commit` ||The commit of the patch set as
1883link:#commit-info[CommitInfo] entity.
1884|`files` ||
1885The files of the patch set as a map that maps the file names to
1886link:#file-info[FileInfo] entities.
1887|===========================
1888
Edwin Kempin14b58112013-02-26 16:30:19 +01001889[[submit-info]]
1890SubmitInfo
1891~~~~~~~~~~
1892The `SubmitInfo` entity contains information about the change status
1893after submitting.
1894
1895[options="header",width="50%",cols="1,6"]
1896|==========================
1897|Field Name |Description
1898|`status` |
1899The status of the change after submitting, can be `MERGED` or
1900`SUBMITTED`. +
1901If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
1902`false` the returned status is `SUBMITTED` and the caller can't know
1903whether the change could be merged successfully.
1904|==========================
1905
Edwin Kempin0eddba02013-02-22 15:30:12 +01001906[[submit-input]]
1907SubmitInput
1908~~~~~~~~~~~
1909The `SubmitInput` entity contains information for submitting a change.
1910
1911[options="header",width="50%",cols="1,^1,5"]
1912|===========================
1913|Field Name ||Description
1914|`wait_for_merge`|`false` if not set|
1915Whether the request should wait for the merge to complete. +
1916If `false` the request returns immediately after the change has been
1917added to the merge queue and the caller can't know whether the change
1918could be merged successfully.
1919|===========================
1920
Edwin Kempin64006bb2013-02-22 08:17:04 +01001921[[topic-input]]
1922TopicInput
1923~~~~~~~~~~
1924The `TopicInput` entity contains information for setting a topic.
1925
1926[options="header",width="50%",cols="1,^1,5"]
1927|===========================
1928|Field Name ||Description
1929|`topic` |optional|The topic. +
1930The topic will be deleted if not set.
1931|`message` |optional|
1932Message to be added as review comment to the change when setting the
1933topic.
1934|===========================
1935
Edwin Kempind0a63922013-01-23 16:32:59 +01001936
1937GERRIT
1938------
1939Part of link:index.html[Gerrit Code Review]