blob: 6442892ddf9e689d2da269d91d6e203c3fc9c609 [file] [log] [blame]
Edwin Kempind0a63922013-01-23 16:32:59 +01001Gerrit Code Review - '/projects/' REST API
2==========================================
3
4This page describes the project related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
8Endpoints
9---------
10
Edwin Kempinc3fe3cb2013-02-13 15:09:23 +010011[[project-endpoints]]
12Project Endpoints
13-----------------
14
Edwin Kempin76202742013-02-15 13:51:50 +010015[[list-projects]]
Edwin Kempin82d30372013-02-04 08:49:34 +010016GET /projects/ (List Projects)
17~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +010018Lists the projects accessible by the caller. This is the same as
19using the link:cmd-ls-projects.html[ls-projects] command over SSH,
20and accepts the same options as query parameters.
21
Edwin Kempin51a6dc92013-02-04 15:43:59 +010022As result a map is returned that maps the project names to
23link:#project-info[ProjectInfo] entries. The entries in the map are sorted
24by project name.
25
Edwin Kempin37440832013-02-06 11:36:00 +010026.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010027----
28 GET /projects/?d HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010029----
Edwin Kempind0a63922013-01-23 16:32:59 +010030
Edwin Kempin37440832013-02-06 11:36:00 +010031.Response
32----
Edwin Kempind0a63922013-01-23 16:32:59 +010033 HTTP/1.1 200 OK
34 Content-Disposition: attachment
35 Content-Type: application/json;charset=UTF-8
36
37 )]}'
38 {
39 "external/bison": {
40 "kind": "gerritcodereview#project",
41 "id": "external%2Fbison",
42 "description": "GNU parser generator"
43 },
44 "external/gcc": {
45 "kind": "gerritcodereview#project",
46 "id": "external%2Fgcc",
47 },
48 "external/openssl": {
49 "kind": "gerritcodereview#project",
50 "id": "external%2Fopenssl",
51 "description": "encryption\ncrypto routines"
52 },
53 "test": {
54 "kind": "gerritcodereview#project",
55 "id": "test",
56 "description": "\u003chtml\u003e is escaped"
57 }
58 }
59----
60
Edwin Kempina64c4b92013-01-23 11:30:40 +010061.Get all projects with their description
62****
63get::/projects/?d
64****
65
Edwin Kempind0a63922013-01-23 16:32:59 +010066[[suggest-projects]]
67The `/projects/` URL also accepts a prefix string in the `p` parameter.
68This limits the results to those projects that start with the specified
69prefix.
70List all projects that start with `platform/`:
Edwin Kempin37440832013-02-06 11:36:00 +010071
72.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010073----
74 GET /projects/?p=platform%2F HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010075----
Edwin Kempind0a63922013-01-23 16:32:59 +010076
Edwin Kempin37440832013-02-06 11:36:00 +010077.Response
78----
Edwin Kempind0a63922013-01-23 16:32:59 +010079 HTTP/1.1 200 OK
80 Content-Disposition: attachment
81 Content-Type: application/json;charset=UTF-8
82
83 )]}'
84 {
85 "platform/drivers": {
86 "kind": "gerritcodereview#project",
87 "id": "platform%2Fdrivers",
88 },
89 "platform/tools": {
90 "kind": "gerritcodereview#project",
91 "id": "platform%2Ftools",
92 }
93 }
94----
95E.g. this feature can be used by suggestion client UI's to limit results.
96
Edwin Kempin57f303c2013-02-13 15:52:22 +010097[[get-project-description]]
98GET /projects/\{project-name\}/description (Get Project Description)
99~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100Retrieves the description of a project.
101
102.Request
103----
104 GET /projects/plugins%2Freplication/description HTTP/1.0
105----
106
107.Response
108----
109 HTTP/1.1 200 OK
110 Content-Disposition: attachment
111 Content-Type: application/json;charset=UTF-8
112
113 )]}'
114 "Copies to other servers using the Git protocol"
115----
116
117[[set-project-description]]
118PUT /projects/\{project-name\}/description (Set Project Description)
119~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120Sets the description of a project.
121
122The new project description must be provided in the request body inside
123a link:#project-description-input[ProjectDescriptionInput] entity.
124
125.Request
126----
127 PUT /projects/plugins%2Freplication/description HTTP/1.0
128 Content-Type: application/json;charset=UTF-8
129
130 {
131 "description": "Plugin for Gerrit that handles the replication.",
132 "commit_message": "Update the project description"
133 }
134----
135
136As response the new project description is returned.
137
138.Response
139----
140 HTTP/1.1 200 OK
141 Content-Disposition: attachment
142 Content-Type: application/json;charset=UTF-8
143
144 )]}'
145 "Plugin for Gerrit that handles the replication."
146----
147
148[[delete-project-description]]
149DELETE /projects/\{project-name\}/description (Delete Project Description)
150~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151Deletes the description of a project.
152
153A message to commit the change of the project description can be
154specified in the request body inside a
155link:#project-description-input[ProjectDescriptionInput] entity.
156
157Please note, that some proxies prohibit request bodies for DELETE
158requests. In this case, if you want to specify a commit message, use
159link:#set-project-description[PUT] to delete the description.
160
161.Request
162----
163 DELETE /projects/plugins%2Freplication/description HTTP/1.0
164----
165
166.Response
167----
168 HTTP/1.1 204 No Content
169----
170
Edwin Kempinecad88c2013-02-14 12:09:44 +0100171[[get-project-parent]]
172GET /projects/\{project-name\}/parent (Get Project Parent)
173~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174Retrieves the name of a project's parent project. For the
175`All-Projects` root project an empty string is returned.
176
177.Request
178----
179 GET /projects/plugins%2Freplication/parent HTTP/1.0
180----
181
182.Response
183----
184 HTTP/1.1 200 OK
185 Content-Disposition: attachment
186 Content-Type: application/json;charset=UTF-8
187
188 )]}'
189 "All-Projects"
190----
191
192[[set-project-parent]]
193PUT /projects/\{project-name\}/parent (Set Project Parent)
194~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195Sets the parent project for a project.
196
197The new name of the parent project must be provided in the request body
198inside a link:#project-parent-input[ProjectParentInput] entity.
199
200.Request
201----
202 PUT /projects/plugins%2Freplication/parent HTTP/1.0
203 Content-Type: application/json;charset=UTF-8
204
205 {
206 "parent": "Public-Plugins",
207 "commit_message": "Update the project parent"
208 }
209----
210
211As response the new parent project name is returned.
212
213.Response
214----
215 HTTP/1.1 200 OK
216 Content-Disposition: attachment
217 Content-Type: application/json;charset=UTF-8
218
219 )]}'
220 "Public-Plugins"
221----
222
Edwin Kempinc3fe3cb2013-02-13 15:09:23 +0100223[[dashboard-endpoints]]
224Dashboard Endpoints
225-------------------
226
Edwin Kempin76202742013-02-15 13:51:50 +0100227[[list-dashboards]]
Edwin Kempin7fe2f7f2013-02-06 10:12:52 +0100228GET /projects/\{project-name\}/dashboards/ (List Dashboards)
229~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +0100230List custom dashboards for a project.
231
Edwin Kempin55367622013-02-05 09:09:23 +0100232As result a list of link:#dashboard-info[DashboardInfo] entries is
233returned.
234
Edwin Kempind0a63922013-01-23 16:32:59 +0100235List all dashboards for the `work/my-project` project:
Edwin Kempin37440832013-02-06 11:36:00 +0100236
237.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100238----
239 GET /projects/work%2Fmy-project/dashboards/ HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100240----
Edwin Kempind0a63922013-01-23 16:32:59 +0100241
Edwin Kempin37440832013-02-06 11:36:00 +0100242.Response
243----
Edwin Kempind0a63922013-01-23 16:32:59 +0100244 HTTP/1.1 200 OK
245 Content-Disposition: attachment
246 Content-Type: application/json;charset=UTF-8
247
248 )]}'
249 [
250 {
251 "kind": "gerritcodereview#dashboard",
252 "id": "main:closed",
253 "ref": "main",
254 "path": "closed",
255 "description": "Merged and abandoned changes in last 7 weeks",
256 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
257 "default": true,
258 "title": "Closed changes",
259 "sections": [
260 {
261 "name": "Merged",
262 "query": "status:merged age:7w"
263 },
264 {
265 "name": "Abandoned",
266 "query": "status:abandoned age:7w"
267 }
268 ]
269 }
270 ]
271----
272
Edwin Kempina64c4b92013-01-23 11:30:40 +0100273.Get all dashboards of the 'All-Projects' project
274****
275get::/projects/All-Projects/dashboards/
276****
277
Edwin Kempin67e923c2013-02-14 13:57:12 +0100278[[get-dashboard]]
279GET /projects/\{project-name\}/dashboards/\{dashboard-id\} (Get Dashboard)
280~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281Retrieves a project dashboard. The dashboard can be defined on that
282project or be inherited from a parent project.
283
284.Request
285----
286 GET /projects/work%2Fmy-project/dashboards/main:closed HTTP/1.0
287----
288
289As response a link:#dashboard-info[DashboardInfo] entity is returned
290that describes the dashboard.
291
292.Response
293----
294 HTTP/1.1 200 OK
295 Content-Disposition: attachment
296 Content-Type: application/json;charset=UTF-8
297
298 )]}'
299 {
300 "kind": "gerritcodereview#dashboard",
301 "id": "main:closed",
302 "ref": "main",
303 "path": "closed",
304 "description": "Merged and abandoned changes in last 7 weeks",
305 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
306 "default": true,
307 "title": "Closed changes",
308 "sections": [
309 {
310 "name": "Merged",
311 "query": "status:merged age:7w"
312 },
313 {
314 "name": "Abandoned",
315 "query": "status:abandoned age:7w"
316 }
317 ]
318 }
319----
320
321To retrieve the default dashboard of a project use `default` as
322dashboard-id.
Edwin Kempin37440832013-02-06 11:36:00 +0100323
324.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100325----
326 GET /projects/work%2Fmy-project/dashboards/default HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100327----
Edwin Kempind0a63922013-01-23 16:32:59 +0100328
Edwin Kempin37440832013-02-06 11:36:00 +0100329.Response
330----
Edwin Kempind0a63922013-01-23 16:32:59 +0100331 HTTP/1.1 200 OK
332 Content-Disposition: attachment
333 Content-Type: application/json;charset=UTF-8
334
335 )]}'
336 {
337 "kind": "gerritcodereview#dashboard",
338 "id": "main:closed",
339 "ref": "main",
340 "path": "closed",
Edwin Kempin67e923c2013-02-14 13:57:12 +0100341 "description": "Merged and abandoned changes in last 7 weeks",
342 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
Edwin Kempind0a63922013-01-23 16:32:59 +0100343 "default": true,
Edwin Kempin67e923c2013-02-14 13:57:12 +0100344 "title": "Closed changes",
345 "sections": [
346 {
347 "name": "Merged",
348 "query": "status:merged age:7w"
349 },
350 {
351 "name": "Abandoned",
352 "query": "status:abandoned age:7w"
353 }
354 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100355 }
356----
357
Edwin Kempin67e923c2013-02-14 13:57:12 +0100358[[set-dashboard]]
359PUT /projects/\{project-name\}/dashboards/\{dashboard-id\} (Set Dashboard)
360~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
361Updates/Creates a project dashboard.
362
363Currently only supported for the `default` dashboard.
364
365The creation/update information for the dashboard must be provided in
366the request body as a link:#dashboard-input[DashboardInput] entity.
367
368.Request
369----
370 PUT /projects/work%2Fmy-project/dashboards/default HTTP/1.0
371 Content-Type: application/json;charset=UTF-8
372
373 {
374 "id": "main:closed",
375 "commit_message": "Define the default dashboard"
376 }
377----
378
379As response the new/updated dashboard is returned as a
380link:#dashboard-info[DashboardInfo] entity.
381
382.Response
383----
384 HTTP/1.1 200 OK
385 Content-Disposition: attachment
386 Content-Type: application/json;charset=UTF-8
387
388 )]}'
389 {
390 "kind": "gerritcodereview#dashboard",
391 "id": "main:closed",
392 "ref": "main",
393 "path": "closed",
394 "description": "Merged and abandoned changes in last 7 weeks",
395 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
396 "default": true,
397 "title": "Closed changes",
398 "sections": [
399 {
400 "name": "Merged",
401 "query": "status:merged age:7w"
402 },
403 {
404 "name": "Abandoned",
405 "query": "status:abandoned age:7w"
406 }
407 ]
408 }
409----
410
411[[delete-dashboard]]
412DELETE /projects/\{project-name\}/dashboards/\{dashboard-id\} (Delete Dashboard)
413~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
414Deletes a project dashboard.
415
416Currently only supported for the `default` dashboard.
417
418A message to commit the deletion of the project dashboard can be
419specified in the request body inside a link:#dashboard-input[
420DashbaordInput] entity.
421
422Please note that some proxies prohibit request bodies for DELETE
423requests.
424
425.Request
426----
427 DELETE /projects/work%2Fmy-project/dashboards/default HTTP/1.0
428----
429
430.Response
431----
432 HTTP/1.1 204 No Content
433----
434
Edwin Kempin34d83352013-02-06 10:40:17 +0100435
436[[ids]]
437IDs
438---
439
Edwin Kempin67e923c2013-02-14 13:57:12 +0100440\{dashboard-id\}
441~~~~~~~~~~~~~~~~
442The ID of a dashboard in the format '<ref>:<path>'.
443
444A special dashboard ID is `default` which represents the default
445dashboard of a project.
446
Edwin Kempin34d83352013-02-06 10:40:17 +0100447\{project-name\}
448~~~~~~~~~~~~~~~~
449The name of the project.
450
451
Edwin Kempin51a6dc92013-02-04 15:43:59 +0100452[[json-entities]]
453JSON Entities
454-------------
455
Edwin Kempin55367622013-02-05 09:09:23 +0100456[[dashboard-info]]
457DashboardInfo
458~~~~~~~~~~~~~
459The `DashboardInfo` entity contains information about a project
460dashboard.
461
462[options="header",width="50%",cols="1,^2,4"]
463|===============================
464|Field Name ||Description
465|`kind` ||`gerritcodereview#dashboard`
466|`id` ||
467The ID of the dashboard. The ID has the format '<ref>:<path>',
468where ref and path are URL encoded.
469|`project` ||
470The name of the project for which this dashboard is returned.
471|`defining_project`||
472The name of the project in which this dashboard is defined.
473This is different from `project` if the dashboard is inherited from a
474parent project.
475|`ref` ||
476The name of the ref in which the dashboard is defined, without the
477`refs/meta/dashboards/` prefix, which is common for all dashboard refs.
478|`path` ||
479The path of the file in which the dashboard is defined.
480|`description` |optional|The description of the dashboard.
481|`foreach` |optional|
482Subquery that applies to all sections in the dashboard. +
483Tokens such as `${project}` are not resolved.
484|`url` ||
485The URL under which the dashboard can be opened in the Gerrit WebUI. +
486The URL is relative to the canonical web URL. +
487Tokens in the queries such as `${project}` are resolved.
488|`default` |not set if `false`|
489Whether this is the default dashboard of the project.
490|`title` |optional|The title of the dashboard.
491|`sections` ||
492The list of link:#dashboard-section-info[sections] in the dashboard.
493|===============================
494
Edwin Kempin67e923c2013-02-14 13:57:12 +0100495[[dashboard-input]]
496DashboardInput
497~~~~~~~~~~~~~~
498The `DashboardInput` entity contains information to create/update a
499project dashboard.
500
501[options="header",width="50%",cols="1,^2,4"]
502|=============================
503|Field Name ||Description
504|`id` |optional|
505ID of a dashboard to which this dashboard should link to.
506|`commit_message`|optional|
507Message that should be used to commit the change of the dashboard.
508|=============================
509
Edwin Kempin55367622013-02-05 09:09:23 +0100510[[dashboard-section-info]]
511DashboardSectionInfo
512~~~~~~~~~~~~~~~~~~~~
513The `DashboardSectionInfo` entity contains information about a section
514in a dashboard.
515
516[options="header",width="50%",cols="1,6"]
517|===========================
518|Field Name |Description
519|`name` |The title of the section.
520|`query` |The query of the section. +
521Tokens such as `${project}` are not resolved.
522|===========================
523
Edwin Kempin57f303c2013-02-13 15:52:22 +0100524[[project-description-input]]
525ProjectDescriptionInput
526~~~~~~~~~~~~~~~~~~~~~~~
527The `ProjectDescriptionInput` entity contains information for setting a
528project description.
529
530[options="header",width="50%",cols="1,^2,4"]
531|=============================
532|Field Name ||Description
533|`description` |optional|The project description. +
534The project description will be deleted if not set.
535|`commit_message`|optional|
536Message that should be used to commit the change of the project
537description in the `project.config` file to the `refs/meta/config`
538branch.
539|=============================
540
Edwin Kempin51a6dc92013-02-04 15:43:59 +0100541[[project-info]]
542ProjectInfo
543~~~~~~~~~~~
544The `ProjectInfo` entity contains information about a project.
545
546[options="header",width="50%",cols="1,^2,4"]
547|===========================
548|Field Name ||Description
549|`kind` ||`gerritcodereview#project`
550|`id` ||The URL encoded project name.
551|`name` |
552not set if returned in a map where the project name is used as map key|
553The name of the project.
554|`parent` |optional, +
555not set for the root project|
556The name of the parent project. +
557`?-<n>` if the parent project is not visible (`<n>` is a number which
558is increased for each non-visible project).
559|`description` |optional|The description of the project.
560|`branches` |optional|Map of branch names to HEAD revisions.
561|===========================
562
Edwin Kempinecad88c2013-02-14 12:09:44 +0100563[[project-parent-input]]
564ProjectParentInput
565~~~~~~~~~~~~~~~~~~
566The `ProjectParentInput` entity contains information for setting a
567project parent.
568
569[options="header",width="50%",cols="1,^2,4"]
570|=============================
571|Field Name ||Description
572|`parent` ||The name of the parent project.
573|`commit_message`|optional|
574Message that should be used to commit the change of the project parent
575in the `project.config` file to the `refs/meta/config` branch.
576|=============================
577
Edwin Kempind0a63922013-01-23 16:32:59 +0100578
579GERRIT
580------
581Part of link:index.html[Gerrit Code Review]