Dashboards Web Service
As an administrator, you can use the npc API web services to perform dashboard management tasks.
As an administrator, you can use the
Performance CenterAPI web services to perform dashboard management tasks.
Use the dashboards RESTful web service to create and manage dashboard pages to display data views:
- Create new dashboards
- Import and export dashboards
- Build the dashboards once and deploy them in an additional tenant. The import feature lets you deploy extra dashboards without manually recreating them.
To import a dashboard for a specific tenant, log in as the administrator for that tenant.
Exporting a dashboard in XML format via the RESTful web service can result in a broken dashboard after you post the XML. To avoid this issue, create a dashboard by copying an existing one using the UI. For more information, see Manage Dashboards.
Issue the following call to see the parameters for the dashboards web service:
Export a Dashboard
Perform a GET operation to export a dashboard to an XML file that is suitable for importing into another instance of CAPC.
To export a dashboard, the internally assigned page ID is required. Use the product user interface to find the ID:
- Navigate to the dashboard to export.
- In the browser window, find the page ID in the URL.Example:http://PC_host:8181/pc/desktop/page?pg=2000040The page ID is 2000040.
- In a REST client, set the URL to the following:http://PC_host:8181/pc/center/webservice/dashboards/pageId
- Perform a GET operation.An error or success message appears in the response.
Import a Dashboard
You can import a dashboard from an XML file.
- Browse to select the XML file that represents a dashboard that you have exported, or paste the exported text of the XML file into the Body field.
- Update the dashboardMenu, menuItem, and dashboardTitle attributes in the XML body for the dashboard that you import:<dashboardMenu>MyCustomDashboard_DashboardMenuName</dashboardMenu> <menuItem>MyCustomDashboard_MenuItemName</menuItem> <dashboardTitle>MyCustomDashboard_DashboardTitleName</dashboardTitle>
- <dashboardMenu>The title that appears at the top of the dashboard menu. Specify an existing top-level dashboard menu title for this attribute.Examples:Infrastructure Health, Capacity Planning
- <menuItem>The title of the dashboard that appears in the dashboards menu. This property is unique to each tenant.
- <dashboardTitle>The title of the dashboard that appears at the top of the dashboard page. This property is unique to each tenant.
- (Optional) Test the import of a dashboard before you import it.Perform the following POST operation:http://PC_host:8181/pc/center/webservice/dashboards/test/The following message appears to indicate that the test was successful:<?xml version="1.0" encoding="UTF-8"?><msg>Validation successful.</msg>Checking is performed for the unique menuItem and dashboardTitle attrributes.
- Set the URL to the following:http://PC_host:8181/pc/center/webservice/dashboards/import
- Perform a POST operation.
- An error or success message appears in the response.The web service assigns a page ID to the imported dashboard.
Update a Dashboard
You can update a dashboard based on a page ID. Edit the XML to modify the dashboard:
- Set the URL to the following:http://PC_host:8181/pc/center/webservice/dashboards/pageId
- Paste the XML file that represents the dashboard into the Body field, and edit the XML as needed.
- Perform a PUT operation.An error or success message appears in the response.