View Source

h1. Access user by id

h2. Syntax
User can be accessed by id using http GET method through below url:
{code}http://localhost:8810/rest/user?id=<user id>{code}
The response is of mime type _application/xml_ and the content is xml representation of the user.

h2. Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative rights.

h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to get user of id _1_:
{code}curl -u admin:admin http://localhost:8810/rest/user?id=1{code}

h1. Access user by name

h2. Syntax
User can be accessed by name using http GET method through below url:
{code}http://localhost:8810/rest/user?name=<user name>{code}
The response is of mime type _application/xml_ and the content is xml representation of the user.

h2. Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative rights.

h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to get user of name _admin_:
{code}curl -u admin:admin http://localhost:8810/rest/user?name=admin{code}

h1. Access all users in the system

h2. Syntax
Users in the system can be accessed using http GET method through below url:
{code}http://localhost:8810/rest/users{code}
The response is of mime type _application/xml_ and the content is xml representation of list of users in the system.

h2. Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative rights.

h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to get all users:
{code}curl -u admin:admin http://localhost:8810/rest/users{code}


h1. Update user

h2. Syntax
User can be updated by posting xml representation of the user to below url:
{code}http://localhost:8810/rest/user{code}
Normally you do not need to create the xml from scratch: you may retrieve xml representation of the user using http GET method, modify certain parts of the xml and post back to above url.
The response is of mime type _text/plain_ and the content is string representation of the user id being updated.
{info}The _password_ element in the posted xml should be encrypted form. To encrypt password, please access below url:
{code}http://localhost:8810/rest/encrypt?password=<plain password>{code}
Here _<plain password>_ represents for clear text of the password, and the response is of mime type _plain/text_ and the content is encrypted form of the password.
{info}

h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

h2. Demo
We will use [curl|http://curl.haxx.se/] to demonstrate how to modify password of user _admin_ to be _12345_:
# Retrieve xml representation of user _admin_ into a temp file using below command:
{code}curl -u admin:admin http://localhost:8810/rest/user?name=admin > tempfile.xml{code}
# Encrypt password _12345_ using below command:
{code}curl -u admin:admin http://localhost:8810/rest/encrypt?password=12345{code}
# Edit _tempfile.xml_ and change the _password_ property to take encrypted form of password _12345_.
# Post back modified content using below command:
{code}curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/user{code}

h1. Create user

h2. Syntax
User can be created by posting xml representation of the user to below url:
{code}http://localhost:8810/rest/user{code}
Please note that the posted xml should NOT contain the _id_ element; otherwise, QuickBuild will treat the post as an updating to the user with that id.
Normally you do not need to create the xml from scratch: you may retrieve xml representation of a templating user using http GET method, remove the _id_ element, modify certain parts and post back to above url.
The response is of mime type _text/plain_ and the content is string representation of id of the newly created user.
{info}The _password_ element in the posted xml should be encrypted form. To encrypt password, please access below url:
{code}http://localhost:8810/rest/encrypt?password=<plain password>{code}
Here _<plain password>_ represents for clear text of the password, and the response is of mime type _plain/text_ and the content is encrypted form of the password.
{info}

h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

h2. Demo
We will use [curl|http://curl.haxx.se/] to demonstrate how to create a new user _robin_ by copying the existing user _admin_, and change the password to _12345_.
# Retrieve xml representation of user _admin_ into a temp file using below command:
{code}curl -u admin:admin http://localhost:8810/rest/user?name=admin > tempfile.xml{code}
# Encrypt password _12345_ using below command:
{code}curl -u admin:admin http://localhost:8810/rest/encrypt?password=12345{code}
# Edit _tempfile.xml_, remove the _id_ element, change the _name_ element to be _robin_, and change _password_ element to take encrypted form of password _12345_.
# Post back modified content using below command:
{code}curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/user{code}

h1. Delete user

h2. Syntax
User can be deleted using http DELETE method through below url:
{code}http://localhost:8810/rest/user?id=<user id>{code}
Here _<user id}_ stands for id of the user to be deleted.

h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.

h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to delete the user with id _2_:
{code}curl -X DELETE -u admin:admin http://localhost:8810/rest/user?id=2{code}