Rest Users » History » Version 6

Jean-Philippe Lang, 2012-06-03 15:19
add groups association

1 1 Jean-Philippe Lang
h1. Users
2 1 Jean-Philippe Lang
3 3 Jean-Philippe Lang
{{>toc}}
4 3 Jean-Philippe Lang
5 1 Jean-Philippe Lang
h2. Listing users
6 1 Jean-Philippe Lang
7 1 Jean-Philippe Lang
  GET /users.xml
8 1 Jean-Philippe Lang
9 1 Jean-Philippe Lang
Returns users.
10 1 Jean-Philippe Lang
11 1 Jean-Philippe Lang
h2. Showing a user
12 1 Jean-Philippe Lang
13 1 Jean-Philippe Lang
  GET /users/[id].xml
14 1 Jean-Philippe Lang
15 1 Jean-Philippe Lang
Returns the user of given id.
16 1 Jean-Philippe Lang
17 1 Jean-Philippe Lang
  GET /users/current.xml
18 1 Jean-Philippe Lang
19 1 Jean-Philippe Lang
Returns the user whose credentials are used to access the API.
20 1 Jean-Philippe Lang
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 3 Jean-Philippe Lang
25 3 Jean-Philippe Lang
  * @memberships@
26 6 Jean-Philippe Lang
  * @groups@ (added in 2.1)
27 3 Jean-Philippe Lang
28 3 Jean-Philippe Lang
+Example+:
29 1 Jean-Philippe Lang
30 6 Jean-Philippe Lang
  GET /users/3.xml?include=memberships,groups
31 3 Jean-Philippe Lang
32 3 Jean-Philippe Lang
Returns the details about user ID 3, and additional detail about the user's project memberships.
33 3 Jean-Philippe Lang
34 3 Jean-Philippe Lang
+Reponse+:
35 3 Jean-Philippe Lang
36 3 Jean-Philippe Lang
<pre>
37 3 Jean-Philippe Lang
<user>
38 3 Jean-Philippe Lang
  <id>3</id>
39 3 Jean-Philippe Lang
  <login>jplang</login>
40 3 Jean-Philippe Lang
  <firstname>Jean-Philippe</firstname>
41 3 Jean-Philippe Lang
  <lastname>Lang</lastname>
42 3 Jean-Philippe Lang
  <mail>jp_lang@yahoo.fr</mail>
43 3 Jean-Philippe Lang
  <created_on>2007-09-28T00:16:04+02:00</created_on>
44 3 Jean-Philippe Lang
  <last_login_on>2011-08-01T18:05:45+02:00</last_login_on>
45 3 Jean-Philippe Lang
  <custom_fields type="array" />
46 3 Jean-Philippe Lang
  <memberships type="array">
47 3 Jean-Philippe Lang
    <membership>
48 3 Jean-Philippe Lang
      <project name="Redmine" id="1"/>
49 3 Jean-Philippe Lang
      <roles type="array">
50 3 Jean-Philippe Lang
        <role name="Administrator" id="3"/>
51 3 Jean-Philippe Lang
        <role name="Contributor" id="4"/>
52 1 Jean-Philippe Lang
      </roles>
53 1 Jean-Philippe Lang
    </membership>
54 6 Jean-Philippe Lang
  </memberships>
55 6 Jean-Philippe Lang
  <groups type="array">
56 6 Jean-Philippe Lang
    <group id="20" name="Developers"/>
57 6 Jean-Philippe Lang
  </groups>
58 3 Jean-Philippe Lang
</user>
59 3 Jean-Philippe Lang
</pre>
60 2 Bevan Rudge
61 1 Jean-Philippe Lang
h2. Creating a user
62 1 Jean-Philippe Lang
63 1 Jean-Philippe Lang
  POST /users.xml
64 1 Jean-Philippe Lang
65 1 Jean-Philippe Lang
Creates a user.
66 1 Jean-Philippe Lang
67 1 Jean-Philippe Lang
+Parameters+:
68 1 Jean-Philippe Lang
69 1 Jean-Philippe Lang
* @user@ (required): a hash of the user attributes, including:
70 1 Jean-Philippe Lang
71 1 Jean-Philippe Lang
  * @login@ (required): the user login
72 1 Jean-Philippe Lang
  * @password@: the user password
73 1 Jean-Philippe Lang
  * @firstname@ (required)
74 1 Jean-Philippe Lang
  * @lastname@ (required)
75 1 Jean-Philippe Lang
  * @mail@ (required)
76 5 Rick Mason
  * @auth_source_id@: authentication mode id
77 1 Jean-Philippe Lang
78 4 Jean-Philippe Lang
+Example+:
79 4 Jean-Philippe Lang
80 4 Jean-Philippe Lang
<pre>
81 4 Jean-Philippe Lang
POST /users.xml
82 4 Jean-Philippe Lang
83 4 Jean-Philippe Lang
<?xml version="1.0" encoding="ISO-8859-1" ?>
84 4 Jean-Philippe Lang
<user>
85 4 Jean-Philippe Lang
  <login>jplang</login>
86 4 Jean-Philippe Lang
  <firstname>Jean-Philippe</firstname>
87 4 Jean-Philippe Lang
  <lastname>Lang</lastname>
88 4 Jean-Philippe Lang
  <password>secret</password>
89 4 Jean-Philippe Lang
  <mail>jp_lang@yahoo.fr</mail>
90 5 Rick Mason
  <auth_source_id>2</auth_source_id>
91 4 Jean-Philippe Lang
</user>
92 4 Jean-Philippe Lang
</pre>
93 4 Jean-Philippe Lang
94 1 Jean-Philippe Lang
+Response+:
95 1 Jean-Philippe Lang
96 1 Jean-Philippe Lang
  * @201 Created@: user was created
97 1 Jean-Philippe Lang
  * @422 Unprocessable Entity@: user was not created due to validation failures (response body contains the error messages)
98 1 Jean-Philippe Lang
99 1 Jean-Philippe Lang
h2. Updating a user
100 1 Jean-Philippe Lang
101 1 Jean-Philippe Lang
  PUT /users/[id].xml
102 1 Jean-Philippe Lang
103 1 Jean-Philippe Lang
+Parameters+:
104 1 Jean-Philippe Lang
105 4 Jean-Philippe Lang
* @user@ (required): a hash of the user attributes (same as for user creation)
106 1 Jean-Philippe Lang
107 1 Jean-Philippe Lang
Updates the user of given id.
108 1 Jean-Philippe Lang
109 1 Jean-Philippe Lang
h2. Deleting a user
110 1 Jean-Philippe Lang
111 4 Jean-Philippe Lang
  DELETE /users/[id].xml
112 4 Jean-Philippe Lang
113 4 Jean-Philippe Lang
Deletes the user of given id.
114 4 Jean-Philippe Lang
115 4 Jean-Philippe Lang
+Response+:
116 4 Jean-Philippe Lang
117 4 Jean-Philippe Lang
  * @200 OK@: user was deleted