Version 8, last updated by Maxim Cretu at September 22, 2011 12:45 UTC

What is Rest (Representational State Transfer)?: It's an architectural style, not a standard. Find out more in the Wikipedia or read the following article if you want to know about REST in Rails

What do you need to access our REST API? You just need to know how to send  HTTP requests with basic authentication to our servers from your application.

TABLE OF CONTENTS

  • User Rest API
    • User XML Representation
    • Best profile (GET)
    • Team Members of a Space (GET)
    • Promote user in a Space (POST)
    • Demote user in a Space (POST)


USER REST API

 

USER XML REPRESENTATION

<user>
<id>aRIULIPCWr2Oq0aaeP0Qfc</id>
<login_name>andy</login_name>
<email>info@assembla.com</email>
<organization>Assembla</organization>
<website>www.assembla.com</website>
<first_im>
<type>Yahoo</type>
<id>asinglenet</id>
</first_im>
<second_im>
<type>Skype</type>
<id>andysingleton</id>
</second_im>
</user>

Note: You may not see all the attributes for a user. Information availability depends on user's choice. The only attributes which are always present are: id and login

 

BEST PROFILE (GET)

To access a user profile you need to send a GET request to: http://www.assembla.com/user/best_profile/<user_id>

Where <user_id> is the id of the user you want to get the information about. Profile's information availability may change depending on user's permissions. You can access a user's public information if you send the request without authentication but if you authenticate yourself using http basic authentication you may get more information from the profile.

If you want to get the response in xml format, be sure to include "Accept:application/xml" in your request header.

If you just know the user's login name, you can send a "login" param with the user's login name as the value. Eg. http://www.assembla.com/user/best_profile?login=sromano

Example using curl for public profile

curl -i -X GET -H "Accept: application/xml" http://www.assembla.com/user/best_profile/aRIULIPCWr2Oq0aaeP0Qfc

 

Example using curl for permissioned profile

curl -i -X GET -H "Accept: application/xml" http://user:password@www.assembla.com/user/best_profile/aRIULIPCWr2Oq0aaeP0Qfc

(Note: http://user:password@www.assembla.com/ is the way you use basic authentication with curl. You need to find out how to use it with your application)


RESPONSE: If the user is found you will get an xml representation of him, otherwise, you will get a 404 Not Found Status in the response

 

TEAM MEMBERS OF A SPACE(GET)

To access a the list of members in a space you need to send a GET request to http://www.assembla.com/spaces/<space_id>/users

Where <space_id> is the id (or wiki_name) of the space you want to get the information about.

If you want to get the response in xml format, be sure to include "Accept:application/xml" in your request header.

Example using curl:

curl -i -X GET -H "Accept: application/xml" http://user:password@www.assembla.com/spaces/<space_id>/users

(Note: http://user:password@www.assembla.com/ is the way you use basic authentication with curl. You need to find out how to use it with your application)

 

Promote User

To promote a user you have to send a POST request to: https://www.assembla.com/spaces/:space_id/users/:id/promote

cURL example:

curl -X POST -H "Accept: application/xml" https://user:password@www.assembla.com/spaces/:space_id/users/:user_id/promote

If request is completed successfully you will be noticed in an xml body

<messages>
  <notes type="array">
    <note>User _name was successfully promoted.</note>
  </notes>
</messages>

If request fails xml body will look like:

<messages>
  <errors type="array">
    <error>User cannot be promoted</error>
  </errors>
</messages>

Demote user

To demote a user you have to send a POST request to: https://www.assembla.com/spaces/:space_id/users/:id/demote

cURL example:

curl -X POST -H "Accept: application/xml" https://user:password@www.assembla.com/spaces/:space_id/users/:user_id/demote

If request is completed successfully you will be noticed in an xml body

<messages>
  <notes type="array">
    <note>User _name was successfully demoted.</note>
  </notes>
</messages>

If request fails xml body will look like:

<messages>
  <errors type="array">
    <error>User cannot be demoted</error>
  </errors>
</messages>