Rest Users » History » Version 4

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

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