Skip to main content
Version: QB10

Interact with Dashboards

Get all dashboards in the system

Syntax

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

http://localhost:8810/rest/dashboards

The response is of mime type application/xml and the content is XML representation of all dashboards 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 dashboards:

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

Access dashboard by id

Syntax

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

http://localhost:8810/rest/dashboards/<dashboard id>

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

Security

You will need to use http BASIC authentication to login as user able to access the dashboard.

Demo

Below curl command demonstrates how to get dashboard of id 1:

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

Update dashboard

Syntax

Dashboard can be updated by posting xml representation of the dashboard to below url:

http://localhost:8810/rest/dashboards

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

Security

You will need to use http BASIC authentication to login as user able to access the dashboard.

Demo

We will use curl to demonstrate how to modify description of dashboard project1 for user with id 5:

  1. Get id of dashboard project1 with id service

    curl http://localhost/rest/ids?dashboard_fqn=5.project1

    Here you need to query with dashboard fqn (fully qualified name) which is of form <user id>.<dashboard name>. Assume returned id is 1.

  2. Retrieve xml representation of group project1 into a temp file using below command:

    curl -u admin:admin http://localhost:8810/rest/dashboards/1 > tempfile.xml
  3. Edit tempfile.xml and change description element to desired value (or add the description element if it does not already exist).

  4. Post back modified content using below command:

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

Create dashboard

Syntax

Dashboard can be created by posting XML representation of the dashboard to below url:

http://localhost:8810/rest/dashboards

Please note that the posted XML should NOT contain the id element; otherwise, QuickBuild will treat the post as an updating to the dashboard with that id.

Normally you do not need to create the XML from scratch: you may retrieve XML representation of a templating dashboard 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 dashboard id.

Security

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

Demo

We will use curl to demonstrate how to create a new dashboard project1 by copying the existing dashboard project2 under user with id 5.

  1. Get id of dashboard project1 with id service

    curl http://localhost/rest/ids?dashboard_fqn=5.project1

    Assume returned id is 1.

  2. Retrieve xml representation of dashboard project1 into a temp file using below command:

    curl -u admin:admin http://localhost:8810/rest/dashboards/1 > tempfile.xml
  3. Edit tempfile.xml , remove the id element, and change the name element to be project2

  4. Post back modified content using below command:

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

Delete dashboard

Syntax

Dashboard can be deleted using http DELETE method through below url:

http://localhost:8810/rest/dashboards/<dashboard id>

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

Security

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

Demo

Below curl command demonstrates how to delete the dashboard with id 2:

curl -X DELETE -u admin:admin http://localhost:8810/rest/dashboards/2