Project

General

Profile

Rest Users » History » Version 3

Jean-Philippe Lang, 2011-08-01 18:23

1 1 Jean-Philippe Lang
h1. Users
2
3 3 Jean-Philippe Lang
{{>toc}}
4
5 1 Jean-Philippe Lang
h2. Listing users
6
7
  GET /users.xml
8
9
Returns users.
10
11
h2. Showing a user
12
13
  GET /users/[id].xml
14
15
Returns the user of given id.
16
17
  GET /users/current.xml
18
19
Returns the user whose credentials are used to access the API.
20
21 3 Jean-Philippe Lang
+Parameters+:
22 1 Jean-Philippe Lang
23 3 Jean-Philippe Lang
* @include@ (optional): a coma separated list of associations to include in the response:
24
25
  * @memberships@
26
27
+Example+:
28
29
  GET /users/3.xml?include=memberships
30
31
Returns the details about user ID 3, and additional detail about the user's project memberships.
32
33
+Reponse+:
34
35
<pre>
36
<user>
37
  <id>3</id>
38
  <login>jplang</login>
39
  <firstname>Jean-Philippe</firstname>
40
  <lastname>Lang</lastname>
41
  <mail>jp_lang@yahoo.fr</mail>
42
  <created_on>2007-09-28T00:16:04+02:00</created_on>
43
  <last_login_on>2011-08-01T18:05:45+02:00</last_login_on>
44
  <custom_fields type="array" />
45
  <memberships type="array">
46
    <membership>
47
      <project name="Redmine" id="1"/>
48
      <roles type="array">
49
        <role name="Administrator" id="3"/>
50
        <role name="Contributor" id="4"/>
51
      </roles>
52
    </membership>
53
  <membership>
54
</user>
55
</pre>
56 2 Bevan Rudge
57 1 Jean-Philippe Lang
h2. Creating a user
58
59
  POST /users.xml
60
61
Creates a user.
62
63
+Parameters+:
64
65
* @user@ (required): a hash of the user attributes, including:
66
67
  * @login@ (required): the user login
68
  * @password@: the user password
69
  * @firstname@ (required)
70
  * @lastname@ (required)
71
  * @mail@ (required)
72
73
+Response+:
74
75
  * @201 Created@: user was created
76
  * @422 Unprocessable Entity@: user was not created due to validation failures (response body contains the error messages)
77
78
h2. Updating a user
79
80
  PUT /users/[id].xml
81
82
+Parameters+:
83
84
* @user@ (required): a hash of the user attributes
85
86
Updates the user of given id.
87
88
h2. Deleting a user
89
90
Deleting a user is not supported yet.