View Source

{info}Group share is the object used to control dashboard sharing with groups{info}

h1. Get all group shares in the system

h2. Syntax
Group shares in the system can be accessed using http GET method through below url:
{code}http://localhost:8810/rest/group_shares{code}
The response is of mime type _application/xml_ and the content is XML representation of all group shares in the system.

h2. Security
You will need to use http BASIC authentication to login as administrator.

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

{info}group share with no group information means to share with everyone{info}

h1. Access group share by id

h2. Syntax
Group share can be accessed by id using http GET method through below url:
{code}http://localhost:8810/rest/group_shares/<group_share id>{code}
The response is of mime type _application/xml_ and the content is XML representation of the group share.

h2. Security
You will need to use http BASIC authentication to login as administrator or user owning dashboard of the group share.

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

h1. Update group share

h2. Syntax
Group share can be updated by posting xml representation of the group share to below url:
{code}http://localhost:8810/rest/group_shares{code}
Normally you do not need to create the XML from scratch: you may retrieve XML representation of the group share 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 share id being updated.

h2. Security
You will need to use http BASIC authentication to login as administrator or user owning dashboard of the group share.

h1. Create group share

h2. Syntax
Group share can be created by posting XML representation of the group share to below url:
{code}http://localhost:8810/rest/group_shares{code}
A sample group share XML representation is like below:
{code}
<com.pmease.quickbuild.model.GroupShare>
<!-- id of associated group of this group share. If group element does not exist, QuickBuild will share the dashboard with everyone -->
<group>2</group>

<!-- id of associated group of this group share. -->
<dashboard>1</dashboard>
</com.pmease.quickbuild.model.GroupShare>
{code}
The response is of mime type _text/plain_ and the content is string representation of the newly created group share id.

h2. Security
You will need to use http BASIC authentication to login as administrator or user owning dashboard of the group share.

h2. Demo
We will use [curl|http://curl.haxx.se/] to demonstrate how to share dashboard _project1_ (assume id is _2_) with group _group1_ (assume the id is _3_).
# Save below content into file _tempfile.xml_:
{code}
<com.pmease.quickbuild.model.GroupShare>
<dashboard>2</dashboard>
<group>3</group>
</com.pmease.quickbuild.model.GroupShare>
{code}
# Post content of _tempfile.xml_ to QuickBuild using below command:
{code}curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/group_shares{code}

h1. Delete group share

h2. Syntax
Group share can be deleted using http DELETE method through below url:
{code}http://localhost:8810/rest/group_shares/<group share id>{code}
Here _<group share id>_ stands for id of the group share to be deleted.

h2. Security
You will need to use http BASIC authentication to login as administrator or user owning dashboard of the group share.

h2. Demo
Below [curl|http://curl.haxx.se/] command demonstrates how to remove group _group1_ (assume id is _3_) from share list of dashboard _project1_ (assume the id is _2_).
# Get group shares of dashboard _project1_ with below command:
{code}curl -u admin:admin http://localhost:8810/rest/group_shares?dashboard_id=2{code}
# Analyze response of above command to find out id of the group share associated with group id _3_, assume id of the found group share is _100_.
# Delete the found membership with below command:
{code}curl -X DELETE -u admin:admin http://localhost:8810/rest/group_shares/100{code}