The AMSUWL API: Users (BETA!)

Show

GET /users/#{id}.xml
Returns a single user.

Response
Status: 200 OK

<user>
  <created_at>2010-09-14 00:36:57 UTC</created_at>
  <updated_at>2011-01-16 15:48:33 UTC</updated_at>
  <login>sam@bennett.com</login>
  <token>c9c4db12 c7271aa6 9951af72 cacedb7 52489164 864eba25 46a5dsd2 e7fwe0aa</token>
  <id>5</id>
  <kind>n</kind>
  <first_name>Sam</first_name>
  <last_name>Bennett</last_name>
  <cell_provider_id>2</cell_provider_id>
  <cell>8005518900</cell>
  <voice_number>8005518900</voice_number>
</user>

List All

GET /users.xml
Returns a collection of users that are visible to the authenticated user.

Response
Status: 200 OK

<users>
  <user>
    ...
  </user>
  <user>
    ...
  </user>
</users>

Create

POST /users.xml?client_id=1
Creates a new user that belongs to the client id that is passed. The XML for the new user is returned on a successful request with the timestamps recorded.

Request
<user>
  <email>sam@bennett.com</email>
  <password>212121</password>
  <password_confirmation>212121</password_confirmation>
  <first_name>Benny</first_name>
  <last_name>Hanna</last_name>
</user>
Response
Status: 201 Created
Location: http://amsuwl.com/users/#{new-user_id}.xml

<user>
  ...
</user>

Update

PUT /users/#{id}.xml
Updates an existing user with new details from the submitted XML.

Request
<user>
  <first-name>Jack</first-name>
  <last-name>Inthebox</last-name>
</user>
Response
Status: 200 OK

Destroy

DELETE /users/#{id}.xml
Destroys the user at the referenced URL.

Response
Status: 200 OK