blob: 8fee481ca30c365cfae9fc4c85d935645c7bb18c [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 Kempin82d30372013-02-04 08:49:34 +010011GET /projects/ (List Projects)
12~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +010013Lists the projects accessible by the caller. This is the same as
14using the link:cmd-ls-projects.html[ls-projects] command over SSH,
15and accepts the same options as query parameters.
16
Edwin Kempin51a6dc92013-02-04 15:43:59 +010017As result a map is returned that maps the project names to
18link:#project-info[ProjectInfo] entries. The entries in the map are sorted
19by project name.
20
Edwin Kempind0a63922013-01-23 16:32:59 +010021----
22 GET /projects/?d HTTP/1.0
23
24 HTTP/1.1 200 OK
25 Content-Disposition: attachment
26 Content-Type: application/json;charset=UTF-8
27
28 )]}'
29 {
30 "external/bison": {
31 "kind": "gerritcodereview#project",
32 "id": "external%2Fbison",
33 "description": "GNU parser generator"
34 },
35 "external/gcc": {
36 "kind": "gerritcodereview#project",
37 "id": "external%2Fgcc",
38 },
39 "external/openssl": {
40 "kind": "gerritcodereview#project",
41 "id": "external%2Fopenssl",
42 "description": "encryption\ncrypto routines"
43 },
44 "test": {
45 "kind": "gerritcodereview#project",
46 "id": "test",
47 "description": "\u003chtml\u003e is escaped"
48 }
49 }
50----
51
Edwin Kempina64c4b92013-01-23 11:30:40 +010052.Get all projects with their description
53****
54get::/projects/?d
55****
56
Edwin Kempind0a63922013-01-23 16:32:59 +010057[[suggest-projects]]
58The `/projects/` URL also accepts a prefix string in the `p` parameter.
59This limits the results to those projects that start with the specified
60prefix.
61List all projects that start with `platform/`:
62----
63 GET /projects/?p=platform%2F HTTP/1.0
64
65 HTTP/1.1 200 OK
66 Content-Disposition: attachment
67 Content-Type: application/json;charset=UTF-8
68
69 )]}'
70 {
71 "platform/drivers": {
72 "kind": "gerritcodereview#project",
73 "id": "platform%2Fdrivers",
74 },
75 "platform/tools": {
76 "kind": "gerritcodereview#project",
77 "id": "platform%2Ftools",
78 }
79 }
80----
81E.g. this feature can be used by suggestion client UI's to limit results.
82
Edwin Kempin7fe2f7f2013-02-06 10:12:52 +010083GET /projects/\{project-name\}/dashboards/ (List Dashboards)
84~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +010085List custom dashboards for a project.
86
Edwin Kempind0a63922013-01-23 16:32:59 +010087List all dashboards for the `work/my-project` project:
88----
89 GET /projects/work%2Fmy-project/dashboards/ HTTP/1.0
90
91 HTTP/1.1 200 OK
92 Content-Disposition: attachment
93 Content-Type: application/json;charset=UTF-8
94
95 )]}'
96 [
97 {
98 "kind": "gerritcodereview#dashboard",
99 "id": "main:closed",
100 "ref": "main",
101 "path": "closed",
102 "description": "Merged and abandoned changes in last 7 weeks",
103 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
104 "default": true,
105 "title": "Closed changes",
106 "sections": [
107 {
108 "name": "Merged",
109 "query": "status:merged age:7w"
110 },
111 {
112 "name": "Abandoned",
113 "query": "status:abandoned age:7w"
114 }
115 ]
116 }
117 ]
118----
119
Edwin Kempina64c4b92013-01-23 11:30:40 +0100120.Get all dashboards of the 'All-Projects' project
121****
122get::/projects/All-Projects/dashboards/
123****
124
Edwin Kempind0a63922013-01-23 16:32:59 +0100125To retrieve only the default dashboard, add `default` to the URL:
126----
127 GET /projects/work%2Fmy-project/dashboards/default HTTP/1.0
128
129 HTTP/1.1 200 OK
130 Content-Disposition: attachment
131 Content-Type: application/json;charset=UTF-8
132
133 )]}'
134 {
135 "kind": "gerritcodereview#dashboard",
136 "id": "main:closed",
137 "ref": "main",
138 "path": "closed",
139 "default": true,
140 ...
141 }
142----
143
Edwin Kempin51a6dc92013-02-04 15:43:59 +0100144[[json-entities]]
145JSON Entities
146-------------
147
148[[project-info]]
149ProjectInfo
150~~~~~~~~~~~
151The `ProjectInfo` entity contains information about a project.
152
153[options="header",width="50%",cols="1,^2,4"]
154|===========================
155|Field Name ||Description
156|`kind` ||`gerritcodereview#project`
157|`id` ||The URL encoded project name.
158|`name` |
159not set if returned in a map where the project name is used as map key|
160The name of the project.
161|`parent` |optional, +
162not set for the root project|
163The name of the parent project. +
164`?-<n>` if the parent project is not visible (`<n>` is a number which
165is increased for each non-visible project).
166|`description` |optional|The description of the project.
167|`branches` |optional|Map of branch names to HEAD revisions.
168|===========================
169
Edwin Kempind0a63922013-01-23 16:32:59 +0100170
171GERRIT
172------
173Part of link:index.html[Gerrit Code Review]