Skip to main content
Version: QB11

Interact with User Share

info

User share is the object used to control dashboard sharing with users

Get all user shares in the system

Syntax

User shares in the system can be accessed using http GET method through below url:

http://localhost:8810/rest/user_shares

The response is of mime type application/xml and the content is XML representation of all user shares in the system.

Security

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

Demo

Below curl command demonstrates how to get all user shares:

curl -u admin:admin http://localhost:8810/rest/user_shares

Access user share by id

Syntax

User share can be accessed by id using http GET method through below url:

http://localhost:8810/rest/user_shares/<user_share id>

The response is of mime type application/xml and the content is XML representation of the user share.

Security

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

Demo

Below curl command demonstrates how to get user share of id 1:

curl -u admin:admin http://localhost:8810/rest/user_shares/1

Access user shares of a particular dashboard

Syntax

User shares of particular dashboard can be accessed using http GET method through below url:

http://localhost:8810/rest/user_shares?dashboard_id=<dashboard id>

The response is of mime type application/xml and the content is XML representation of all user shares of specified dashboard.

Security

You will need to use http BASIC authentication to login as administrator or the user owning queried dashboard.

Demo

Below curl command demonstrates how to get user shares of dashboard with id 2:

curl -u admin:admin http://localhost:8810/rest/user_shares?dashboard_id=2

Access user shares of a particular user

Syntax

User shares of particular user can be accessed using http GET method through below url:

http://localhost:8810/rest/user_shares?user_id=<user id>

The response is of mime type application/xml and the content is XML representation of all user shares of specified user.

Security

You will need to use http BASIC authentication to login as administrator or the user being queried.

Demo

Below curl command demonstrates how to get user shares of user with id 1:

curl -u admin:admin http://localhost:8810/rest/user_shares?user_id=1

Update user share

Syntax

User share can be updated by posting xml representation of the user share to below url:

http://localhost:8810/rest/user_shares

Normally you do not need to create the XML from scratch: you may retrieve XML representation of the user 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 user share id being updated.

Security

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

Demo

We will use curl to demonstrate how to share dashboard project1 with user1 instead of user2:

  1. Assume id of dashboard project1 is 2 , id of user user1 is 1 , and id of user user2 is 2 . Ids of these entities can be accessed using id service.

  2. Run below command to get user shares of dashboard project1 :

    curl -u admin:admin http://localhost:8810/rest/user_shares?dashboard_id=2
  3. Analyze response of above command to find out the user share with user id 1 . Save xml snippet of found user share to a temp file, say tempfile.xml.

  4. Modify tempfile.xml and change the user element to use value of 2.

  5. Post content of tempfile.xml back to QuickBuild using below command:

    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/user_shares

Create user share

Syntax

User share can be created by posting XML representation of the user share to below url:

http://localhost:8810/rest/user_shares

A sample user share XML representation is like below:

<com.pmease.quickbuild.model.UserShare>
<!-- id of associated user of this user share. -->
<user>2</user>

<!-- id of associated dashboard of this user share. -->
<dashboard>1</dashboard>
</com.pmease.quickbuild.model.GroupShare>

The response is of mime type text/plain and the content is string representation of the newly created user share id.

Security

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

Demo

We will use curl to demonstrate how to share dashboard project1 (assume id is 2 ) with user user1 (assume the id is 3).

  1. Save below content into file tempfile.xml :

    <com.pmease.quickbuild.model.UserShare>
    <dashboard>2</dashboard>
    <user>3</user>
    </com.pmease.quickbuild.model.UserShare>
  2. Post content of tempfile.xml to QuickBuild using below command:

    curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/user_shares

Delete user share

Syntax

User share can be deleted using http DELETE method through below url:

http://localhost:8810/rest/user_shares/<user share id>

Here <user share id> stands for id of the user share to be deleted.

Security

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

Demo

Below curl command demonstrates how to remove user user1 (assume id is 3 ) from share list of dashboard project1 (assume the id is 2).

  1. Get user shares of dashboard project1 with below command:

    curl -u admin:admin http://localhost:8810/rest/user_shares?dashboard_id=2
  2. Analyze response of above command to find out id of the user share associated with user id 3 , assume id of the found user share is 100.

  3. Delete the found user share with below command:

    curl -X DELETE -u admin:admin http://localhost:8810/rest/user_shares/100