Project

General

Profile

Rest Projects » History » Version 38

Mischa The Evil, 2022-07-27 03:34
Add issue_custom_fields to possible values for include parameters & convert sections to lists.

1 1 Jean-Philippe Lang
h1. Projects
2
3 21 yuya ito
{{>toc}}
4
5 1 Jean-Philippe Lang
h2. Listing projects
6
7
  GET /projects.xml
8
9 18 Jaroslav Balaz
Returns all projects (all public projects and private projects where user have access to)
10 1 Jean-Philippe Lang
11 17 Jean-Baptiste Barth
+Parameters+:
12
13 38 Mischa The Evil
* @include@: fetch associated data (optional). Values should be separated by a comma ",". Possible values:
14
** @trackers@
15
** @issue_categories@
16
** @enabled_modules@ (since 2.6.0)
17
** @time_entry_activities@ (since 3.4.0)
18
** @issue_custom_fields@ (since 4.2.0)
19 17 Jean-Baptiste Barth
20 1 Jean-Philippe Lang
+Response+:
21
22 24 Toshi MARUYAMA
<pre><code class="xml">
23 1 Jean-Philippe Lang
<projects type="array">
24 3 Christoph Witzany
  <project>
25
    <id>1</id>
26 13 Terence Mill
    <name>Redmine</name>
27
    <identifier>redmine</identifier>
28 1 Jean-Philippe Lang
    <description>
29 13 Terence Mill
      Redmine is a flexible project management web application written using Ruby on Rails framework.
30 1 Jean-Philippe Lang
    </description>
31
    <created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
32
    <updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
33 14 Jean-Baptiste Barth
    <is_public>true</is_public>
34 1 Jean-Philippe Lang
  </project>
35 3 Christoph Witzany
  <project>
36
    <id>2</id>
37 1 Jean-Philippe Lang
    ...
38
  </project>
39 24 Toshi MARUYAMA
</code></pre>
40 1 Jean-Philippe Lang
41 14 Jean-Baptiste Barth
+Notes+:
42
* @is_public@ is exposed since 2.6.0
43
44 1 Jean-Philippe Lang
h2. Showing a project
45
46
  GET /projects/[id].xml
47
48
Returns the project of given id or identifier.
49 9 Jean-Philippe Lang
50 1 Jean-Philippe Lang
+Parameters+:
51
52 38 Mischa The Evil
* @include@: fetch associated data (optional). Values should be separated by a comma ",". Possible values:
53
** @trackers@
54
** @issue_categories@
55
** @enabled_modules@ (since 2.6.0)
56
** @time_entry_activities@ (since 3.4.0)
57
** @issue_custom_fields@ (since 4.2.0)
58 9 Jean-Philippe Lang
59 1 Jean-Philippe Lang
+Examples+:
60
61
<pre>
62
GET /projects/12.xml
63 10 Jean-Philippe Lang
GET /projects/12.xml?include=trackers
64 1 Jean-Philippe Lang
GET /projects/12.xml?include=trackers,issue_categories
65 15 Jean-Baptiste Barth
GET /projects/12.xml?include=enabled_modules
66 13 Terence Mill
GET /projects/redmine.xml
67 1 Jean-Philippe Lang
</pre>
68
69
+Response+:
70
71 24 Toshi MARUYAMA
<pre><code class="xml">
72 1 Jean-Philippe Lang
<?xml version="1.0" encoding="UTF-8"?>
73
<project id="1">
74 13 Terence Mill
  <name>Redmine</name>
75
  <identifier>redmine</identifier>
76 1 Jean-Philippe Lang
  <description>
77 13 Terence Mill
    Redmine is a flexible project management web application written using Ruby on Rails framework.
78 1 Jean-Philippe Lang
  </description>
79
  <homepage></homepage>
80 32 Marius BĂLTEANU
  <status>1</status>
81 28 Go MAEDA
  <parent id="123" name="foo"/>
82 31 Marius BĂLTEANU
  <default_version id="3" name="2.0"/>
83
  <default_assignee id="2" name="John Smith"/>
84 1 Jean-Philippe Lang
  <created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
85
  <updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
86 14 Jean-Baptiste Barth
  <is_public>true</is_public>
87 1 Jean-Philippe Lang
</project>
88 24 Toshi MARUYAMA
</code></pre>
89 1 Jean-Philippe Lang
90 14 Jean-Baptiste Barth
+Notes+:
91
* @is_public@ is exposed since 2.6.0
92 1 Jean-Philippe Lang
93
h2. Creating a project
94
95
  POST /projects.xml
96
97
Creates a the project.
98
99
+Parameters+:
100
101
* @project@ (required): a hash of the project attributes, including:
102
103
  * @name@ (required): the project name
104
  * @identifier@ (required): the project identifier
105
  * @description@
106 20 Lucile Quirion
  * @homepage@
107
  * @is_public@: true or false
108
  * @parent_id@: the parent project number
109
  * @inherit_members@: true or false
110 33 Marius BĂLTEANU
  * @default_assigned_to_id@: ID of the default user. It works only when the new project is a subproject and it inherits the members. 
111
  * @default_version_id@: ID of the default version. It works only with existing shared versions.
112 20 Lucile Quirion
  * @tracker_ids@: (repeatable element) the tracker id: 1 for Bug, etc.
113 1 Jean-Philippe Lang
  * @enabled_module_names@: (repeatable element) the module name: boards, calendar, documents, files, gantt, issue_tracking, news, repository, time_tracking, wiki.
114 27 Igor Rybak
  * @issue_custom_field_ids@: (repeatable element) issue custom field id.
115 35 Jan Catrysse
  * @custom_field_values@: array with @id => value@ pairs
116 1 Jean-Philippe Lang
117
<pre>
118
POST /projects.xml
119 24 Toshi MARUYAMA
</pre>
120
121 25 Toshi MARUYAMA
<pre><code class="xml">
122 26 Mayama Takeshi
<project>
123
  <name>test project</name>
124
  <identifier>test</identifier>
125
  <enabled_module_names>time_tracking</enabled_module_names>
126
  <enabled_module_names>issue_tracking</enabled_module_names>
127
</project>
128 35 Jan Catrysse
</code></pre>
129
130
<pre>
131
POST /projects.json
132
</pre>
133
134
<pre><code class="json">
135
{
136 36 Jan Catrysse
   "project":{
137
      "name":"Example name",
138
      "identifier":"example_name",
139
      "description":"Description of exapmple project",
140
      "is_public":false,
141
      "parent_id":1,
142
      "inherit_members":false,
143
      "tracker_ids":[
144
         1,
145
         2,
146
         3,
147
         4,
148
         5
149
      ],
150
      "enabled_module_names":[
151
         "issue_tracking"
152
      ],
153
      "custom_field_values":{
154
         "1":"VALUE"
155
      }
156
   }
157 35 Jan Catrysse
}
158 25 Toshi MARUYAMA
</code></pre>
159 1 Jean-Philippe Lang
160
+Response+:
161
162
  * @201 Created@: project was created
163
  * @422 Unprocessable Entity@: project was not created due to validation failures (response body contains the error messages)
164
165
h2. Updating a project
166
167
  PUT /projects/[id].xml
168
169
Updates the project of given id or identifier.
170
171 34 Go MAEDA
h2. Archiving a project
172
173
  PUT /projects/[id]/archive.xml
174
175
Archives the project of given id or identifier. Available since Redmine 5.0.
176
177
h2. Unarchiving a project
178
179
  PUT /projects/[id]/unarchive.xml
180
181
Unrchives the project of given id or identifier. Available since Redmine 5.0.
182
183 1 Jean-Philippe Lang
h2. Deleting a project
184
185
  DELETE /projects/[id].xml
186
187
Deletes the project of given id or identifier.
188 11 Wim Bertels
189
h2. Limitations:
190
191 23 Toshi MARUYAMA
A POST request on Redmine 1.0.1-2 (Debian stable) does not work using the API key, but does work with a login/passwd authentication
192
#12104