Rest Users » History » Version 4
Version 3 (Jean-Philippe Lang, 2011-08-01 18:23) → Version 4/27 (Jean-Philippe Lang, 2011-08-01 18:34)
h1. Users
{{>toc}}
h2. Listing users
GET /users.xml
Returns users.
h2. Showing a user
GET /users/[id].xml
Returns the user of given id.
GET /users/current.xml
Returns the user whose credentials are used to access the API.
+Parameters+:
* @include@ (optional): a coma separated list of associations to include in the response:
* @memberships@
+Example+:
GET /users/3.xml?include=memberships
Returns the details about user ID 3, and additional detail about the user's project memberships.
+Reponse+:
<pre>
<user>
<id>3</id>
<login>jplang</login>
<firstname>Jean-Philippe</firstname>
<lastname>Lang</lastname>
<mail>jp_lang@yahoo.fr</mail>
<created_on>2007-09-28T00:16:04+02:00</created_on>
<last_login_on>2011-08-01T18:05:45+02:00</last_login_on>
<custom_fields type="array" />
<memberships type="array">
<membership>
<project name="Redmine" id="1"/>
<roles type="array">
<role name="Administrator" id="3"/>
<role name="Contributor" id="4"/>
</roles>
</membership>
<membership>
</user>
</pre>
h2. Creating a user
POST /users.xml
Creates a user.
+Parameters+:
* @user@ (required): a hash of the user attributes, including:
* @login@ (required): the user login
* @password@: the user password
* @firstname@ (required)
* @lastname@ (required)
* @mail@ (required)
+Example+:
<pre>
POST /users.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<user>
<login>jplang</login>
<firstname>Jean-Philippe</firstname>
<lastname>Lang</lastname>
<password>secret</password>
<mail>jp_lang@yahoo.fr</mail>
</user>
</pre>
+Response+:
* @201 Created@: user was created
* @422 Unprocessable Entity@: user was not created due to validation failures (response body contains the error messages)
h2. Updating a user
PUT /users/[id].xml
+Parameters+:
* @user@ (required): a hash of the user attributes (same as for user creation)
Updates the user of given id.
h2. Deleting a user
DELETE /users/[id].xml
Deletes the Deleting a user of given id.
+Response+:
* @200 OK@: user was deleted is not supported yet.
{{>toc}}
h2. Listing users
GET /users.xml
Returns users.
h2. Showing a user
GET /users/[id].xml
Returns the user of given id.
GET /users/current.xml
Returns the user whose credentials are used to access the API.
+Parameters+:
* @include@ (optional): a coma separated list of associations to include in the response:
* @memberships@
+Example+:
GET /users/3.xml?include=memberships
Returns the details about user ID 3, and additional detail about the user's project memberships.
+Reponse+:
<pre>
<user>
<id>3</id>
<login>jplang</login>
<firstname>Jean-Philippe</firstname>
<lastname>Lang</lastname>
<mail>jp_lang@yahoo.fr</mail>
<created_on>2007-09-28T00:16:04+02:00</created_on>
<last_login_on>2011-08-01T18:05:45+02:00</last_login_on>
<custom_fields type="array" />
<memberships type="array">
<membership>
<project name="Redmine" id="1"/>
<roles type="array">
<role name="Administrator" id="3"/>
<role name="Contributor" id="4"/>
</roles>
</membership>
<membership>
</user>
</pre>
h2. Creating a user
POST /users.xml
Creates a user.
+Parameters+:
* @user@ (required): a hash of the user attributes, including:
* @login@ (required): the user login
* @password@: the user password
* @firstname@ (required)
* @lastname@ (required)
* @mail@ (required)
+Example+:
<pre>
POST /users.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<user>
<login>jplang</login>
<firstname>Jean-Philippe</firstname>
<lastname>Lang</lastname>
<password>secret</password>
<mail>jp_lang@yahoo.fr</mail>
</user>
</pre>
+Response+:
* @201 Created@: user was created
* @422 Unprocessable Entity@: user was not created due to validation failures (response body contains the error messages)
h2. Updating a user
PUT /users/[id].xml
+Parameters+:
* @user@ (required): a hash of the user attributes (same as for user creation)
Updates the user of given id.
h2. Deleting a user
DELETE /users/[id].xml
Deletes the Deleting a user of given id.
+Response+:
* @200 OK@: user was deleted is not supported yet.