Rest Users » History » Version 5
Rick Mason, 2012-06-01 17:35
<auth_source_id> working on Redmine 2.0.0, Ruby 1.8.7, Rails 3.2.3 with LDAP authentication mode
| 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 | 5 | Rick Mason | * @auth_source_id@: authentication mode id |
| 73 | 1 | Jean-Philippe Lang | |
| 74 | 4 | Jean-Philippe Lang | +Example+: |
| 75 | |||
| 76 | <pre> |
||
| 77 | POST /users.xml |
||
| 78 | |||
| 79 | <?xml version="1.0" encoding="ISO-8859-1" ?> |
||
| 80 | <user> |
||
| 81 | <login>jplang</login> |
||
| 82 | <firstname>Jean-Philippe</firstname> |
||
| 83 | <lastname>Lang</lastname> |
||
| 84 | <password>secret</password> |
||
| 85 | <mail>jp_lang@yahoo.fr</mail> |
||
| 86 | 5 | Rick Mason | <auth_source_id>2</auth_source_id> |
| 87 | 4 | Jean-Philippe Lang | </user> |
| 88 | </pre> |
||
| 89 | |||
| 90 | 1 | Jean-Philippe Lang | +Response+: |
| 91 | |||
| 92 | * @201 Created@: user was created |
||
| 93 | * @422 Unprocessable Entity@: user was not created due to validation failures (response body contains the error messages) |
||
| 94 | |||
| 95 | h2. Updating a user |
||
| 96 | |||
| 97 | PUT /users/[id].xml |
||
| 98 | |||
| 99 | +Parameters+: |
||
| 100 | |||
| 101 | 4 | Jean-Philippe Lang | * @user@ (required): a hash of the user attributes (same as for user creation) |
| 102 | 1 | Jean-Philippe Lang | |
| 103 | Updates the user of given id. |
||
| 104 | |||
| 105 | h2. Deleting a user |
||
| 106 | |||
| 107 | 4 | Jean-Philippe Lang | DELETE /users/[id].xml |
| 108 | |||
| 109 | Deletes the user of given id. |
||
| 110 | |||
| 111 | +Response+: |
||
| 112 | |||
| 113 | * @200 OK@: user was deleted |