Interact with User Share
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:
-
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.
-
Run below command to get user shares of dashboard project1 :
curl -u admin:admin http://localhost:8810/rest/user_shares?dashboard_id=2
-
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.
-
Modify tempfile.xml and change the user element to use value of 2.
-
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