Interact with Groups

Version 1 by Robin Shen
on Dec 24, 2009 08:09.


 
compared with
Current by Robin Shen
on Jun 10, 2010 14:13.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 22 changes. View first change.

 h1. Access group by id
  h1. Get all groups in the system
  
 h2. Syntax
Group can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/group?id=<group id>{code}
 The response is of mime type _application/xml_ and the content is xml representation of the group.
  Groups in the system can be accessed using http GET method through below url:
 {code}http://localhost:8810/rest/groups{code}
 The response is of mime type _application/xml_ and the content is XML representation of all groups 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.
  You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative right.
  
 h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to get group of id _1_:
 {code}curl -u admin:admin http://localhost:8810/rest/group?id=1{code}
  Below [curl|http://curl.haxx.se/] command demonstrates how to get all groups:
 {code}curl -u admin:admin http://localhost:8810/rest/groups{code}
  
h1. Access group by name
  h1. Access group by id
  
 h2. Syntax
Group can be accessed by name using http GET method through below url:
 {code}http://localhost:8810/rest/group?name=<group name>{code}
 The response is of mime type _application/xml_ and the content is xml representation of the group.
  Group can be accessed by id using http GET method through below url:
 {code}http://localhost:8810/rest/groups/<group id>{code}
 The response is of mime type _application/xml_ and the content is XML representation of the group.
  
 h2. Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative rights.
  You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have adminstrative right.
  
 h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to get group of name _developer_:
 {code}curl -u admin:admin http://localhost:8810/rest/group?name=developer{code}
  Below [curl|http://curl.haxx.se/] command demonstrates how to get group of id _1_:
 {code}curl -u admin:admin http://localhost:8810/rest/groups/1{code}
  
h1. Access all groups in the system
  
 h2. Syntax
 Groups in the system can be accessed using http GET method through below url:
 {code}http://localhost:8810/rest/groups{code}
 The response is of mime type _application/xml_ and the content is xml representation of list of groups 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 groups:
 {code}curl -u admin:admin http://localhost:8810/rest/groups{code}
  
  
 h1. Update group
  
 h2. Syntax
 Group can be updated by posting xml representation of the group to below url:
{code}http://localhost:8810/rest/group{code}
 Normally you do not need to create the xml from scratch: you may retrieve xml representation of the group using http GET method, modify certain parts of the xml and post back to above url.
  {code}http://localhost:8810/rest/groups{code}
 Normally you do not need to create the XML from scratch: you may retrieve XML representation of the group 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 group id being updated.
  
 h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
  You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative right.
  
 h2. Demo
 We will use [curl|http://curl.haxx.se/] to demonstrate how to modify description of group _developer_:
# Get id of group _developer_ with [id service|retrieve object identifier]
 {code}curl http://localhost/rest/ids?group_name=developer{code}
 Assume returned id is _1_.
 # Retrieve xml representation of group _developer_ into a temp file using below command:
{code}curl -u admin:admin http://localhost:8810/rest/group?name=developer > tempfile.xml{code}
 # Edit _tempfile.xml_ and change the _description_ property to desired value.
  {code}curl -u admin:admin http://localhost:8810/rest/groups/1 > tempfile.xml{code}
 # Edit _tempfile.xml_ and change _description_ element to desired value (or add the _description_ element if it does not already exist).
 # Post back modified content using below command:
{code}curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/group{code}
  {code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/groups{code}
  
 h1. Create group
  
 h2. Syntax
Group can be created by posting xml representation of the group to below url:
 {code}http://localhost:8810/rest/group{code}
 Please note that the posted xml should NOT contain the _id_ element; otherwise, QuickBuild will treat the post as an updating to the group with that id.
 Normally you do not need to create the xml from scratch: you may retrieve xml representation of a templating group 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 group.
  Group can be created by posting XML representation of the group to below url:
 {code}http://localhost:8810/rest/groups{code}
 Please note that the posted XML should NOT contain the _id_ element; otherwise, QuickBuild will treat the post as an updating to the group with that id.
 Normally you do not need to create the XML from scratch: you may retrieve XML representation of a templating group 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 the newly created group id.
  
 h2. Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
  You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative right.
  
 h2. Demo
 We will use [curl|http://curl.haxx.se/] to demonstrate how to create a new group _tester_ by copying the existing group _developer_.
# Get id of group _developer_ with [id service|retrieve object identifier]
 {code}curl http://localhost/rest/ids?group_name=developer{code}
 Assume returned id is _1_.
 # Retrieve xml representation of group _developer_ into a temp file using below command:
{code}curl -u admin:admin http://localhost:8810/rest/group?name=developer > tempfile.xml{code}
  {code}curl -u admin:admin http://localhost:8810/rest/groups/1 > tempfile.xml{code}
 # Edit _tempfile.xml_, remove the _id_ element, and change the _name_ element to be _tester_
 # Post back modified content using below command:
{code}curl -X POST -u admin:admin -d @tempfile.xml -u admin:admin http://localhost:8810/rest/group{code}
  {code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/groups{code}
  
 h1. Delete group
  
 h2. Syntax
 Group can be deleted using http DELETE method through below url:
{code}http://localhost:8810/rest/group?id=<group id>{code}
 Here _<group id}_ stands for id of the group to be deleted.
  {code}http://localhost:8810/rest/groups/<group id>{code}
 Here _<group id>_ stands for id of the group 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.
  You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative right.
  
 h2. Demo
 Below [curl|http://curl.haxx.se/] command demonstrates how to delete the group with id _2_:
 {code}curl -X DELETE -u admin:admin http://localhost:8810/rest/group?id=2{code}
  {code}curl -X DELETE -u admin:admin http://localhost:8810/rest/groups/2{code}