blob: 903724f5c8d4f407832d3e7e0049895a2a94e633 [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 Kempin82d30372013-02-04 08:49:34 +010083GET /projects/*/dashboards/ (List Dashboards)
84~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edwin Kempind0a63922013-01-23 16:32:59 +010085List custom dashboards for a project.
86
87The `/projects/{name}/dashboards/` URL expects the a URL encoded
88project name as part of the URL. If name contains / the correct
89encoding is to use `%2F`.
90
91List all dashboards for the `work/my-project` project:
92----
93 GET /projects/work%2Fmy-project/dashboards/ HTTP/1.0
94
95 HTTP/1.1 200 OK
96 Content-Disposition: attachment
97 Content-Type: application/json;charset=UTF-8
98
99 )]}'
100 [
101 {
102 "kind": "gerritcodereview#dashboard",
103 "id": "main:closed",
104 "ref": "main",
105 "path": "closed",
106 "description": "Merged and abandoned changes in last 7 weeks",
107 "url": "/dashboard/?title\u003dClosed+changes\u0026Merged\u003dstatus:merged+age:7w\u0026Abandoned\u003dstatus:abandoned+age:7w",
108 "default": true,
109 "title": "Closed changes",
110 "sections": [
111 {
112 "name": "Merged",
113 "query": "status:merged age:7w"
114 },
115 {
116 "name": "Abandoned",
117 "query": "status:abandoned age:7w"
118 }
119 ]
120 }
121 ]
122----
123
Edwin Kempina64c4b92013-01-23 11:30:40 +0100124.Get all dashboards of the 'All-Projects' project
125****
126get::/projects/All-Projects/dashboards/
127****
128
Edwin Kempind0a63922013-01-23 16:32:59 +0100129To retrieve only the default dashboard, add `default` to the URL:
130----
131 GET /projects/work%2Fmy-project/dashboards/default HTTP/1.0
132
133 HTTP/1.1 200 OK
134 Content-Disposition: attachment
135 Content-Type: application/json;charset=UTF-8
136
137 )]}'
138 {
139 "kind": "gerritcodereview#dashboard",
140 "id": "main:closed",
141 "ref": "main",
142 "path": "closed",
143 "default": true,
144 ...
145 }
146----
147
Edwin Kempin51a6dc92013-02-04 15:43:59 +0100148[[json-entities]]
149JSON Entities
150-------------
151
152[[project-info]]
153ProjectInfo
154~~~~~~~~~~~
155The `ProjectInfo` entity contains information about a project.
156
157[options="header",width="50%",cols="1,^2,4"]
158|===========================
159|Field Name ||Description
160|`kind` ||`gerritcodereview#project`
161|`id` ||The URL encoded project name.
162|`name` |
163not set if returned in a map where the project name is used as map key|
164The name of the project.
165|`parent` |optional, +
166not set for the root project|
167The name of the parent project. +
168`?-<n>` if the parent project is not visible (`<n>` is a number which
169is increased for each non-visible project).
170|`description` |optional|The description of the project.
171|`branches` |optional|Map of branch names to HEAD revisions.
172|===========================
173
Edwin Kempind0a63922013-01-23 16:32:59 +0100174
175GERRIT
176------
177Part of link:index.html[Gerrit Code Review]