Rest api » History » Version 95

Go MAEDA, 2016-03-20 03:28
Added Search API

1 26 Jean-Philippe Lang
{{>toc}}
2 26 Jean-Philippe Lang
3 1 Jean-Philippe Lang
h1. Redmine API
4 1 Jean-Philippe Lang
5 60 Jean-Philippe Lang
Redmine exposes some of its data through a REST API. This API provides access and basic CRUD operations (create, update, delete) for the resources described below. The API supports both "XML":http://en.wikipedia.org/wiki/Xml and "JSON":http://en.wikipedia.org/wiki/JSON formats.
6 1 Jean-Philippe Lang
7 1 Jean-Philippe Lang
h2. API Description
8 1 Jean-Philippe Lang
9 24 Jean-Philippe Lang
|_.Resource                     |_.Status     |_.Notes  |_.Availability|
10 91 Jean-Philippe Lang
|[[Rest_Issues|Issues]]         | Stable        |  | 1.0 |
11 91 Jean-Philippe Lang
|[[Rest_Projects|Projects]]     | Stable        |   | 1.0 |
12 55 Jean-Philippe Lang
|[[Rest_Memberships|Project Memberships]]  | Alpha | | 1.4 |
13 56 Jean-Philippe Lang
|[[Rest_Users|Users]]           | Stable | | 1.1 |
14 56 Jean-Philippe Lang
|[[Rest_TimeEntries|Time Entries]]           | Stable | | 1.1 |
15 28 Jean-Philippe Lang
|[[Rest_News|News]]             | Prototype | Prototype implementation for @index@ only | 1.1 |
16 43 Jean-Philippe Lang
|[[Rest_IssueRelations|Issue Relations]]  | Alpha | | 1.3 |
17 43 Jean-Philippe Lang
|[[Rest_Versions|Versions]]  | Alpha | | 1.3 |
18 85 Jean-Philippe Lang
|[[Rest_WikiPages|Wiki Pages]]  | Alpha | | 2.2 |
19 44 Jean-Philippe Lang
|[[Rest_Queries|Queries]]  | Alpha | | 1.3 |
20 63 Jean-Philippe Lang
|[[Rest_Attachments|Attachments]]  | Beta | Adding attachments via the API added in 1.4 | 1.3 |
21 53 Jean-Philippe Lang
|[[Rest_IssueStatuses|Issue Statuses]]  | Alpha | Provides the list of all statuses | 1.3 |
22 51 Jean-Philippe Lang
|[[Rest_Trackers|Trackers]]  | Alpha | Provides the list of all trackers | 1.3 |
23 84 Jean-Philippe Lang
|[[Rest_Enumerations|Enumerations]]  | Alpha | Provides the list of issue priorities and time tracking activities | 2.2 |
24 52 Jean-Philippe Lang
|[[Rest_IssueCategories|Issue Categories]]  | Alpha | | 1.3 |
25 55 Jean-Philippe Lang
|[[Rest_Roles|Roles]]  | Alpha | | 1.4 |
26 79 Jean-Philippe Lang
|[[Rest_Groups|Groups]]  | Alpha | | 2.1 |
27 92 Jean-Philippe Lang
|[[Rest_CustomFields|Custom Fields]]  | Alpha | | 2.4 |
28 95 Go MAEDA
|[[Rest_Search|Search]]  | Alpha | | 3.3 |
29 24 Jean-Philippe Lang
30 15 Eric Davis
Status legend:
31 1 Jean-Philippe Lang
32 1 Jean-Philippe Lang
* Stable - feature complete, no major changes planned
33 1 Jean-Philippe Lang
* Beta - usable for integrations with some bugs or missing minor functionality
34 1 Jean-Philippe Lang
* Alpha - major functionality in place, needs feedback from API users and integrators
35 1 Jean-Philippe Lang
* Prototype - very rough implementation, possible major breaking changes mid-version. *Not recommended for integration*
36 1 Jean-Philippe Lang
* Planned - planned in a future version, depending on developer availability
37 1 Jean-Philippe Lang
38 24 Jean-Philippe Lang
h2. General topics
39 1 Jean-Philippe Lang
40 78 Jean-Philippe Lang
h3. Specify @Content-Type@ on @POST@/@PUT@ requests
41 66 Etienne Massip
42 83 Jean-Philippe Lang
When creating or updating a remote element, the @Content-Type@ of the request *MUST* be specified even if the remote URL is suffixed accordingly (e.g. @POST ../issues.json@):
43 82 Jean-Philippe Lang
* for JSON content, it must be set to @Content-Type: application/json@.
44 78 Jean-Philippe Lang
* for XML content, to @Content-Type: application/xml@.
45 66 Etienne Massip
46 24 Jean-Philippe Lang
h3. Authentication
47 24 Jean-Philippe Lang
48 24 Jean-Philippe Lang
Most of the time, the API requires authentication. To enable the API-style authentication, you have to check *Enable REST API* in Administration -> Settings -> Authentication. Then, authentication can be done in 2 different ways:
49 24 Jean-Philippe Lang
* using your regular login/password via HTTP Basic authentication.
50 38 Jean-Philippe Lang
* using your API key which is a handy way to avoid putting a password in a script. The API key may be attached to each request in one of the following way:
51 38 Jean-Philippe Lang
** passed in as a "key" parameter
52 38 Jean-Philippe Lang
** passed in as a username with a random password via HTTP Basic authentication
53 46 John Galambos
** passed in as a "X-Redmine-API-Key" HTTP header (added in Redmine 1.1.0)
54 38 Jean-Philippe Lang
55 38 Jean-Philippe Lang
You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.
56 24 Jean-Philippe Lang
57 89 Jean-Philippe Lang
h3. User Impersonation
58 89 Jean-Philippe Lang
59 89 Jean-Philippe Lang
As of Redmine 2.2.0, you can impersonate user through the REST API by setting the @X-Redmine-Switch-User@ header of your API request. It must be set to a user login (eg. @X-Redmine-Switch-User: jsmith@). This only works when using the API with an administrator account, this header will be ignored when using the API with a regular user account.
60 89 Jean-Philippe Lang
61 90 Jean-Philippe Lang
If the login specified with the @X-Redmine-Switch-User@ header does not exist or is not active, you will receive a 412 error response.
62 90 Jean-Philippe Lang
63 24 Jean-Philippe Lang
h3. Collection resources and pagination
64 24 Jean-Philippe Lang
65 47 Tom Clegg
The response to a GET request on a collection ressources (eg. @/issues.xml@, @/users.xml@) generally won't return all the objects available in your database. Redmine version:1.1.0 introduces a common way to query such ressources using the following parameters:
66 24 Jean-Philippe Lang
67 24 Jean-Philippe Lang
* @offset@: the offset of the first object to retrieve
68 24 Jean-Philippe Lang
* @limit@: the number of items to be present in the response (default is 25, maximum is 100)
69 24 Jean-Philippe Lang
70 24 Jean-Philippe Lang
Examples:
71 24 Jean-Philippe Lang
72 24 Jean-Philippe Lang
<pre>
73 24 Jean-Philippe Lang
GET /issues.xml
74 24 Jean-Philippe Lang
=> returns the 25 first issues
75 24 Jean-Philippe Lang
76 24 Jean-Philippe Lang
GET /issues.xml?limit=100
77 24 Jean-Philippe Lang
=> returns the 100 first issues
78 24 Jean-Philippe Lang
79 24 Jean-Philippe Lang
GET /issues.xml?offset=30&limit=10
80 24 Jean-Philippe Lang
=> returns 10 issues from the 30th
81 24 Jean-Philippe Lang
</pre>
82 24 Jean-Philippe Lang
83 24 Jean-Philippe Lang
Responses to GET requests on collection ressources provide information about the total object count available in Redmine and the offset/limit used for the response. Examples:
84 24 Jean-Philippe Lang
85 24 Jean-Philippe Lang
<pre>
86 24 Jean-Philippe Lang
GET /issues.xml
87 24 Jean-Philippe Lang
88 24 Jean-Philippe Lang
<issues type="array" total_count="2595" limit="25" offset="0">
89 24 Jean-Philippe Lang
  ...
90 24 Jean-Philippe Lang
</issues>
91 24 Jean-Philippe Lang
</pre>
92 24 Jean-Philippe Lang
93 24 Jean-Philippe Lang
<pre>
94 24 Jean-Philippe Lang
GET /issues.json
95 24 Jean-Philippe Lang
96 24 Jean-Philippe Lang
{ "issues":[...], "total_count":2595, "limit":25, "offset":0 }
97 24 Jean-Philippe Lang
</pre>
98 24 Jean-Philippe Lang
99 24 Jean-Philippe Lang
Note: if you're using a REST client that does not support such top level attributes (total_count, limit, offset), you can set the @nometa@ parameter or @X-Redmine-Nometa@ HTTP header to 1 to get responses without them. Example:
100 24 Jean-Philippe Lang
101 24 Jean-Philippe Lang
<pre>
102 24 Jean-Philippe Lang
GET /issues.xml?nometa=1
103 24 Jean-Philippe Lang
104 24 Jean-Philippe Lang
<issues type="array">
105 24 Jean-Philippe Lang
  ...
106 24 Jean-Philippe Lang
</issues>
107 24 Jean-Philippe Lang
</pre>
108 23 Jean-Philippe Lang
109 29 Etienne Massip
h3. Fetching associated data
110 29 Etienne Massip
111 29 Etienne Massip
Since of version:1.1.0, you have to explicitly specify the associations you want to be included in the query result by appending the @include@ parameter to the query url :
112 29 Etienne Massip
113 29 Etienne Massip
Example:
114 29 Etienne Massip
115 41 Jean-Philippe Lang
To retrieve issue journals with its description:
116 29 Etienne Massip
117 29 Etienne Massip
<pre>
118 29 Etienne Massip
GET /issues/296.xml?include=journals
119 29 Etienne Massip
120 29 Etienne Massip
<issue>
121 29 Etienne Massip
  <id>296</id>
122 30 Etienne Massip
  ...
123 29 Etienne Massip
  <journals type="array">
124 29 Etienne Massip
  ...
125 1 Jean-Philippe Lang
  </journals>
126 41 Jean-Philippe Lang
</issue>
127 41 Jean-Philippe Lang
</pre>
128 41 Jean-Philippe Lang
129 41 Jean-Philippe Lang
You can also load multiple associations using a coma separated list of items.
130 41 Jean-Philippe Lang
131 41 Jean-Philippe Lang
Example:
132 41 Jean-Philippe Lang
133 41 Jean-Philippe Lang
<pre>
134 41 Jean-Philippe Lang
GET /issues/296.xml?include=journals,changesets
135 41 Jean-Philippe Lang
136 41 Jean-Philippe Lang
<issue>
137 41 Jean-Philippe Lang
  <id>296</id>
138 41 Jean-Philippe Lang
  ...
139 41 Jean-Philippe Lang
  <journals type="array">
140 41 Jean-Philippe Lang
  ...
141 41 Jean-Philippe Lang
  </journals>
142 41 Jean-Philippe Lang
  <changesets type="array">
143 41 Jean-Philippe Lang
  ...
144 41 Jean-Philippe Lang
  </changesets>
145 29 Etienne Massip
</issue>
146 29 Etienne Massip
</pre>
147 29 Etienne Massip
148 42 Jean-Philippe Lang
h3. Working with custom fields
149 42 Jean-Philippe Lang
150 42 Jean-Philippe Lang
Most of the Redmine objects support custom fields. Their values can be found in the @custom_fields@ attributes.
151 42 Jean-Philippe Lang
152 42 Jean-Philippe Lang
XML Example:
153 42 Jean-Philippe Lang
154 42 Jean-Philippe Lang
<pre>
155 42 Jean-Philippe Lang
GET /issues/296.xml      # an issue with 2 custom fields
156 42 Jean-Philippe Lang
157 42 Jean-Philippe Lang
<issue>
158 42 Jean-Philippe Lang
  <id>296</id>
159 42 Jean-Philippe Lang
  ...
160 42 Jean-Philippe Lang
  <custom_fields type="array">
161 42 Jean-Philippe Lang
    <custom_field name="Affected version" id="1">
162 42 Jean-Philippe Lang
      <value>1.0.1</value>
163 42 Jean-Philippe Lang
    </custom_field>
164 42 Jean-Philippe Lang
    <custom_field name="Resolution" id="2">
165 42 Jean-Philippe Lang
      <value>Fixed</value>
166 42 Jean-Philippe Lang
    </custom_field>
167 42 Jean-Philippe Lang
  </custom_fields>
168 42 Jean-Philippe Lang
</issue>
169 42 Jean-Philippe Lang
</pre>
170 42 Jean-Philippe Lang
171 42 Jean-Philippe Lang
JSON Example:
172 42 Jean-Philippe Lang
173 42 Jean-Philippe Lang
<pre>
174 42 Jean-Philippe Lang
GET /issues/296.json      # an issue with 2 custom fields
175 42 Jean-Philippe Lang
176 42 Jean-Philippe Lang
{"issue":
177 42 Jean-Philippe Lang
  {
178 42 Jean-Philippe Lang
    "id":8471,
179 42 Jean-Philippe Lang
    ...
180 42 Jean-Philippe Lang
    "custom_fields":
181 42 Jean-Philippe Lang
      [
182 42 Jean-Philippe Lang
        {"value":"1.0.1","name":"Affected version","id":1},
183 42 Jean-Philippe Lang
        {"value":"Fixed","name":"Resolution","id":2}
184 42 Jean-Philippe Lang
      ]
185 42 Jean-Philippe Lang
  }
186 42 Jean-Philippe Lang
}
187 42 Jean-Philippe Lang
</pre>
188 42 Jean-Philippe Lang
189 42 Jean-Philippe Lang
You can also set/change the values of the custom fields when creating/updating an object using the same syntax (except that the custom field name is not required).
190 42 Jean-Philippe Lang
191 42 Jean-Philippe Lang
XML Example:
192 42 Jean-Philippe Lang
193 42 Jean-Philippe Lang
<pre>
194 42 Jean-Philippe Lang
PUT /issues/296.xml
195 42 Jean-Philippe Lang
196 42 Jean-Philippe Lang
<issue>
197 42 Jean-Philippe Lang
  <subject>Updating custom fields of an issue</subject>
198 42 Jean-Philippe Lang
  ...
199 42 Jean-Philippe Lang
  <custom_fields type="array">
200 42 Jean-Philippe Lang
    <custom_field id="1">
201 42 Jean-Philippe Lang
      <value>1.0.2</value>
202 42 Jean-Philippe Lang
    </custom_field>
203 42 Jean-Philippe Lang
    <custom_field id="2">
204 42 Jean-Philippe Lang
      <value>Invalid</value>
205 42 Jean-Philippe Lang
    </custom_field>
206 42 Jean-Philippe Lang
  </custom_fields>
207 42 Jean-Philippe Lang
</issue>
208 42 Jean-Philippe Lang
</pre>
209 42 Jean-Philippe Lang
210 42 Jean-Philippe Lang
Note: the @type="array"@ attribute on @custom_fields@ XML tag is strictly required.
211 42 Jean-Philippe Lang
212 42 Jean-Philippe Lang
JSON Example:
213 42 Jean-Philippe Lang
214 42 Jean-Philippe Lang
<pre>
215 42 Jean-Philippe Lang
PUT /issues/296.json
216 42 Jean-Philippe Lang
217 42 Jean-Philippe Lang
{"issue":
218 42 Jean-Philippe Lang
  {
219 42 Jean-Philippe Lang
    "subject":"Updating custom fields of an issue",
220 42 Jean-Philippe Lang
    ...
221 42 Jean-Philippe Lang
    "custom_fields":
222 42 Jean-Philippe Lang
      [
223 42 Jean-Philippe Lang
        {"value":"1.0.2","id":1},
224 42 Jean-Philippe Lang
        {"value":"Invalid","id":2}
225 42 Jean-Philippe Lang
      ]
226 42 Jean-Philippe Lang
  }
227 42 Jean-Philippe Lang
}
228 42 Jean-Philippe Lang
</pre>
229 42 Jean-Philippe Lang
230 61 Jean-Philippe Lang
h3. Attaching files
231 61 Jean-Philippe Lang
232 61 Jean-Philippe Lang
Support for adding attachments through the REST API is added in Redmine version:1.4.0.
233 61 Jean-Philippe Lang
234 93 Jean-Philippe Lang
First, you need to upload each file with a POST request to @/uploads.xml@ (or @/uploads.json@). The request body should be the content of the file you want to attach and the @Content-Type@ header must be set to @application/octet-stream@ (otherwise you'll get a @406 Not Acceptable@ response). If the upload succeeds, you get a 201 response that contains a token for your uploaded file.
235 1 Jean-Philippe Lang
236 93 Jean-Philippe Lang
Then you can use this token to attach your uploaded file to a new or an existing issue.
237 93 Jean-Philippe Lang
238 93 Jean-Philippe Lang
+XML Example+
239 93 Jean-Philippe Lang
240 93 Jean-Philippe Lang
First, upload your file:
241 93 Jean-Philippe Lang
242 61 Jean-Philippe Lang
<pre>
243 61 Jean-Philippe Lang
POST /uploads.xml
244 61 Jean-Philippe Lang
Content-Type: application/octet-stream
245 61 Jean-Philippe Lang
...
246 61 Jean-Philippe Lang
(request body is the file content)
247 61 Jean-Philippe Lang
248 61 Jean-Philippe Lang
# 201 response
249 61 Jean-Philippe Lang
<upload>
250 61 Jean-Philippe Lang
  <token>7167.ed1ccdb093229ca1bd0b043618d88743</token>
251 61 Jean-Philippe Lang
</upload>
252 1 Jean-Philippe Lang
</pre>
253 61 Jean-Philippe Lang
254 93 Jean-Philippe Lang
Then create the issue using the upload token:
255 61 Jean-Philippe Lang
256 61 Jean-Philippe Lang
<pre>
257 61 Jean-Philippe Lang
POST /issues.xml
258 61 Jean-Philippe Lang
<issue>
259 61 Jean-Philippe Lang
  <project_id>1</project_id>
260 61 Jean-Philippe Lang
  <subject>Creating an issue with a uploaded file</subject>
261 62 Jean-Philippe Lang
  <uploads type="array">
262 61 Jean-Philippe Lang
    <upload>
263 61 Jean-Philippe Lang
      <token>7167.ed1ccdb093229ca1bd0b043618d88743</token>
264 61 Jean-Philippe Lang
      <filename>image.png</filename>
265 86 Etienne Massip
      <description>An optional description here</description>
266 61 Jean-Philippe Lang
      <content_type>image/png</content_type>
267 61 Jean-Philippe Lang
    </upload>
268 61 Jean-Philippe Lang
  </uploads>
269 61 Jean-Philippe Lang
</issue>
270 61 Jean-Philippe Lang
</pre>
271 61 Jean-Philippe Lang
272 64 Jean-Philippe Lang
If you try to upload a file that exceeds the maximum size allowed, you get a 422 response:
273 64 Jean-Philippe Lang
274 64 Jean-Philippe Lang
<pre>
275 64 Jean-Philippe Lang
POST /uploads.xml
276 64 Jean-Philippe Lang
Content-Type: application/octet-stream
277 64 Jean-Philippe Lang
...
278 64 Jean-Philippe Lang
(request body larger than the maximum size allowed)
279 64 Jean-Philippe Lang
280 64 Jean-Philippe Lang
# 422 response
281 64 Jean-Philippe Lang
<errors>
282 1 Jean-Philippe Lang
  <error>This file cannot be uploaded because it exceeds the maximum allowed file size (1024000)</error>
283 1 Jean-Philippe Lang
</errors>
284 93 Jean-Philippe Lang
</pre>
285 93 Jean-Philippe Lang
286 93 Jean-Philippe Lang
+JSON Example+
287 93 Jean-Philippe Lang
288 93 Jean-Philippe Lang
First, upload your file:
289 93 Jean-Philippe Lang
290 93 Jean-Philippe Lang
<pre>
291 93 Jean-Philippe Lang
POST /uploads.json
292 93 Jean-Philippe Lang
Content-Type: application/octet-stream
293 93 Jean-Philippe Lang
...
294 93 Jean-Philippe Lang
(request body is the file content)
295 93 Jean-Philippe Lang
296 93 Jean-Philippe Lang
# 201 response
297 93 Jean-Philippe Lang
{"upload":{"token":"7167.ed1ccdb093229ca1bd0b043618d88743"}}
298 93 Jean-Philippe Lang
</pre>
299 93 Jean-Philippe Lang
300 93 Jean-Philippe Lang
Then create the issue using the upload token:
301 93 Jean-Philippe Lang
302 93 Jean-Philippe Lang
<pre>
303 93 Jean-Philippe Lang
POST /issues.json
304 93 Jean-Philippe Lang
{
305 93 Jean-Philippe Lang
  "issue": {
306 93 Jean-Philippe Lang
    "project_id": "1",
307 93 Jean-Philippe Lang
    "subject": "Creating an issue with a uploaded file",
308 93 Jean-Philippe Lang
    "uploads": [
309 93 Jean-Philippe Lang
      {"token": "7167.ed1ccdb093229ca1bd0b043618d88743", "filename": "image.png", "content_type": "image/png"}
310 93 Jean-Philippe Lang
    ]
311 93 Jean-Philippe Lang
  }
312 93 Jean-Philippe Lang
}
313 93 Jean-Philippe Lang
</pre>
314 93 Jean-Philippe Lang
315 93 Jean-Philippe Lang
You can also upload multiple files (by doing multiple POST requests to @/uploads.json@), then create an issue with multiple attachments:
316 93 Jean-Philippe Lang
317 93 Jean-Philippe Lang
<pre>
318 93 Jean-Philippe Lang
POST /issues.json
319 93 Jean-Philippe Lang
{
320 93 Jean-Philippe Lang
  "issue": {
321 93 Jean-Philippe Lang
    "project_id": "1",
322 93 Jean-Philippe Lang
    "subject": "Creating an issue with a uploaded file",
323 93 Jean-Philippe Lang
    "uploads": [
324 93 Jean-Philippe Lang
      {"token": "7167.ed1ccdb093229ca1bd0b043618d88743", "filename": "image1.png", "content_type": "image/png"},
325 93 Jean-Philippe Lang
      {"token": "7168.d595398bbb104ed3bba0eed666785cc6", "filename": "image2.png", "content_type": "image/png"}
326 93 Jean-Philippe Lang
    ]
327 93 Jean-Philippe Lang
  }
328 93 Jean-Philippe Lang
}
329 64 Jean-Philippe Lang
</pre>
330 64 Jean-Philippe Lang
331 59 Jean-Philippe Lang
h3. Validation errors
332 59 Jean-Philippe Lang
333 59 Jean-Philippe Lang
When trying to create or update an object with invalid or missing attribute parameters, you will get a @422 Unprocessable Entity@ response. That means that the object could not be created or updated. In such cases, the response body contains the corresponding error messages:
334 59 Jean-Philippe Lang
335 59 Jean-Philippe Lang
+XML Example+:
336 59 Jean-Philippe Lang
337 59 Jean-Philippe Lang
<pre>
338 59 Jean-Philippe Lang
# Request with invalid or missing attributes
339 59 Jean-Philippe Lang
POST /users.xml
340 59 Jean-Philippe Lang
<user>
341 59 Jean-Philippe Lang
  <login>john</login>
342 59 Jean-Philippe Lang
  <lastname>Smith</lastname>
343 59 Jean-Philippe Lang
  <mail>john</mail>
344 59 Jean-Philippe Lang
</uer>
345 59 Jean-Philippe Lang
346 59 Jean-Philippe Lang
# 422 response with the error messages in its body
347 65 Jean-Philippe Lang
<errors type="array">
348 59 Jean-Philippe Lang
  <error>First name can't be blank</error>
349 59 Jean-Philippe Lang
  <error>Email is invalid</error>
350 59 Jean-Philippe Lang
</errors>
351 59 Jean-Philippe Lang
</pre>
352 59 Jean-Philippe Lang
353 59 Jean-Philippe Lang
354 59 Jean-Philippe Lang
+JSON Example+:
355 59 Jean-Philippe Lang
356 59 Jean-Philippe Lang
<pre>
357 59 Jean-Philippe Lang
# Request with invalid or missing attributes
358 59 Jean-Philippe Lang
POST /users.json
359 59 Jean-Philippe Lang
{
360 59 Jean-Philippe Lang
  "user":{
361 59 Jean-Philippe Lang
    "login":"john",
362 59 Jean-Philippe Lang
    "lastname":"Smith",
363 59 Jean-Philippe Lang
    "mail":"john"
364 59 Jean-Philippe Lang
  }
365 59 Jean-Philippe Lang
}
366 59 Jean-Philippe Lang
367 59 Jean-Philippe Lang
# 422 response with the error messages in its body
368 59 Jean-Philippe Lang
{
369 59 Jean-Philippe Lang
  "errors":[
370 59 Jean-Philippe Lang
    "First name can't be blank",
371 59 Jean-Philippe Lang
    "Email is invalid"
372 59 Jean-Philippe Lang
  ]
373 59 Jean-Philippe Lang
}
374 59 Jean-Philippe Lang
</pre>
375 59 Jean-Philippe Lang
376 81 Jean-Philippe Lang
h3. JSONP Support
377 81 Jean-Philippe Lang
378 88 Jean-Philippe Lang
Redmine 2.1.0+ API supports "JSONP":http://en.wikipedia.org/wiki/JSONP to request data from a Redmine server in a different domain (say, with JQuery). The callback can be passed using the @callback@ or @jsonp@ parameter. As of Redmine 2.3.0, JSONP support is optional and disabled by default, you can enable it by checking *Enable JSONP support* in Administration -> Settings -> Authentication.
379 81 Jean-Philippe Lang
380 81 Jean-Philippe Lang
Example:
381 81 Jean-Philippe Lang
382 81 Jean-Philippe Lang
<pre>
383 81 Jean-Philippe Lang
GET /issues.json?callback=myHandler
384 81 Jean-Philippe Lang
385 81 Jean-Philippe Lang
myHandler({"issues":[ ... ]})
386 81 Jean-Philippe Lang
</pre>
387 81 Jean-Philippe Lang
388 1 Jean-Philippe Lang
h2. API Usage in various languages/tools
389 5 Jean-Philippe Lang
390 1 Jean-Philippe Lang
* [[Rest_api_with_ruby|Ruby]]
391 1 Jean-Philippe Lang
* [[Rest_api_with_php|PHP]]
392 23 Jean-Philippe Lang
* [[Rest_api_with_python|Python]]
393 94 Go MAEDA
* [[Rest_api_with_perl|Perl]]
394 27 Jean-Philippe Lang
* [[Rest_api_with_java|Java]]
395 1 Jean-Philippe Lang
* [[Rest_api_with_curl|cURL]]
396 37 Bevan Rudge
* "Drupal Redmine API module, 2.x branch (currently not stable)":http://drupal.org/project/redmine
397 48 Dorin Huzum
* [[Rest_api_with_csharp|.NET]]
398 49 Rodrigo Carvalho
* [[Rest_api_with_delphi|Delphi]]
399 54 Jean-Philippe Lang
400 54 Jean-Philippe Lang
h2. API Change history
401 54 Jean-Philippe Lang
402 58 Jean-Philippe Lang
This section lists changes to the existing API features only. New features of the API are listed in the [[Rest_api#API-Description|API Description]].
403 57 Jean-Philippe Lang
404 54 Jean-Philippe Lang
h3. 2012-01-29: Multiselect custom fields (r8721, version:1.4.0)
405 54 Jean-Philippe Lang
406 54 Jean-Philippe Lang
Custom fields with multiple values are now supported in Redmine and may be found in API responses. These custom fields have a @multiple=true attribute@ and their @value@ attribute is an array.
407 54 Jean-Philippe Lang
408 54 Jean-Philippe Lang
Example:
409 54 Jean-Philippe Lang
410 54 Jean-Philippe Lang
<pre>
411 54 Jean-Philippe Lang
GET /issues/296.json
412 54 Jean-Philippe Lang
413 54 Jean-Philippe Lang
{"issue":
414 54 Jean-Philippe Lang
  {
415 54 Jean-Philippe Lang
    "id":8471,
416 54 Jean-Philippe Lang
    ...
417 54 Jean-Philippe Lang
    "custom_fields":
418 54 Jean-Philippe Lang
      [
419 54 Jean-Philippe Lang
        {"value":["1.0.1","1.0.2"],"multiple":true,"name":"Affected version","id":1},
420 54 Jean-Philippe Lang
        {"value":"Fixed","name":"Resolution","id":2}
421 54 Jean-Philippe Lang
      ]
422 54 Jean-Philippe Lang
  }
423 54 Jean-Philippe Lang
}
424 54 Jean-Philippe Lang
</pre>