Web API for Dashboards: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
Dashboards API | Dashboards API provides functions for accessing Dashboard objects: finding dashboards by identifier path, getting a dashboard by id, creating dashboards, and modifying existing dashboards. | ||
Note that the [[Web API for Workspace Elements|Workspace Elements API]] | A Dashboard object represents a dashboard created in the PA UI. Its ''Views'' property is a JSON array of UiElements and should contain one UiElement of type ''View''. | ||
Note that the [[Web API for Workspace Elements|Workspace Elements API]] also operates on dashboard views as UiElements of type ''View''. Dashboard deletion is handled through the Workspace Elements API, not through a documented DELETE method under ''api/dashboards''. | |||
==Methods== | ==Methods== | ||
| Line 7: | Line 9: | ||
<pre> | <pre> | ||
GET api/dashboards | GET api/dashboards?identifierPath={identifierPath}&includeProjectPath={includeProjectPath}&projectId={projectId} | ||
</pre> | </pre> | ||
Gets a list of all | Gets a list of dashboard objects accessible to the current user whose UiElements match the specified ''identifierPath''. | ||
The ''includeProjectPath'' query parameter is optional and defaults to ''true''. When it is ''true'', the returned View UiElement includes the ''ProjectPath'' property, containing the part of the absolute identifier path without the UiElement identifier. If the current user does not have access to all projects in the path, ''ProjectPath'' is ''null''. | |||
The ''projectId'' query parameter is optional. If it is specified and ''identifierPath'' is a relative path, only dashboards belonging to that project are returned. | |||
<pre> | <pre> | ||
GET api/dashboards/{ | GET api/dashboards/{dashboardId}?includeProjectPath={includeProjectPath} | ||
</pre> | </pre> | ||
Gets a dashboard | Gets a dashboard object by id. The ''dashboardId'' is the database id of the dashboard's UiElement. | ||
The returned Dashboard object's ''Views'' property contains only the UiElement identified by ''dashboardId''. That UiElement includes a ''Permissions'' property containing the current user's permissions for the project the UiElement belongs to. If the UiElement's ''ProjectId'' is 0 or null, the ''Permissions'' property contains the user's global permissions. | |||
The ''includeProjectPath'' query parameter is optional and defaults to ''true''. When it is ''true'', the returned View UiElement includes the ''ProjectPath'' property. If the current user does not have access to all projects in the path, ''ProjectPath'' is ''null''. | |||
<pre> | <pre> | ||
POST api/dashboards | POST api/dashboards/?projectId={projectId} | ||
</pre> | </pre> | ||
Creates a new | Creates a new dashboard in the database. The request body is a Dashboard object. The ''projectId'' query parameter specifies the project into which the dashboard is created. If ''projectId'' is omitted, the dashboard is created at the root level. | ||
Returns a dashboard creation result object, not the created Dashboard object. The result contains the saved dashboard View UiElement's ''Id'', ''Name'', and ''IdMappings'' from input object ids to database ids. | |||
<pre> | <pre> | ||
PUT api/dashboards/{ | PUT api/dashboards/{dashboardId} | ||
</pre> | </pre> | ||
Modifies an existing dashboard in the database. The request body is a Dashboard object. The method does not return content. | |||
When a dashboard is saved, the relevant UiElement is the first View UiElement in the Dashboard object's ''Views'' property. For an existing element, the saved properties include ''Name'', ''Description'', ''Identifier'', and custom or optional parameters, and the element's update metadata is refreshed. | |||
==Permissions== | |||
Viewing a dashboard requires ''GenericRead'' permission for all projects containing the dashboard's underlying UiElements. | |||
Creating, modifying, and deleting a dashboard requires ''EditDashboards'' permission for all projects containing the dashboard's underlying UiElements. | |||
==Deleting dashboards== | |||
There is no documented | |||
<pre> | <pre> | ||
DELETE api/dashboards/{id} | DELETE api/dashboards/{id} | ||
</pre> | </pre> | ||
method in the dashboard API requirements. To delete a dashboard view, use the Workspace Elements API for the underlying UiElement of type ''View'', for example: | |||
<pre> | |||
DELETE api/uielements/{elementId} | |||
</pre> | |||
or the bulk Workspace Elements delete method: | |||
<pre> | |||
DELETE api/uielements/ | |||
</pre> | |||
Revision as of 09:54, 5 June 2026
Dashboards API provides functions for accessing Dashboard objects: finding dashboards by identifier path, getting a dashboard by id, creating dashboards, and modifying existing dashboards.
A Dashboard object represents a dashboard created in the PA UI. Its Views property is a JSON array of UiElements and should contain one UiElement of type View.
Note that the Workspace Elements API also operates on dashboard views as UiElements of type View. Dashboard deletion is handled through the Workspace Elements API, not through a documented DELETE method under api/dashboards.
Methods
The dashboards API has the following methods.
GET api/dashboards?identifierPath={identifierPath}&includeProjectPath={includeProjectPath}&projectId={projectId}
Gets a list of dashboard objects accessible to the current user whose UiElements match the specified identifierPath.
The includeProjectPath query parameter is optional and defaults to true. When it is true, the returned View UiElement includes the ProjectPath property, containing the part of the absolute identifier path without the UiElement identifier. If the current user does not have access to all projects in the path, ProjectPath is null.
The projectId query parameter is optional. If it is specified and identifierPath is a relative path, only dashboards belonging to that project are returned.
GET api/dashboards/{dashboardId}?includeProjectPath={includeProjectPath}
Gets a dashboard object by id. The dashboardId is the database id of the dashboard's UiElement.
The returned Dashboard object's Views property contains only the UiElement identified by dashboardId. That UiElement includes a Permissions property containing the current user's permissions for the project the UiElement belongs to. If the UiElement's ProjectId is 0 or null, the Permissions property contains the user's global permissions.
The includeProjectPath query parameter is optional and defaults to true. When it is true, the returned View UiElement includes the ProjectPath property. If the current user does not have access to all projects in the path, ProjectPath is null.
POST api/dashboards/?projectId={projectId}
Creates a new dashboard in the database. The request body is a Dashboard object. The projectId query parameter specifies the project into which the dashboard is created. If projectId is omitted, the dashboard is created at the root level.
Returns a dashboard creation result object, not the created Dashboard object. The result contains the saved dashboard View UiElement's Id, Name, and IdMappings from input object ids to database ids.
PUT api/dashboards/{dashboardId}
Modifies an existing dashboard in the database. The request body is a Dashboard object. The method does not return content.
When a dashboard is saved, the relevant UiElement is the first View UiElement in the Dashboard object's Views property. For an existing element, the saved properties include Name, Description, Identifier, and custom or optional parameters, and the element's update metadata is refreshed.
Permissions
Viewing a dashboard requires GenericRead permission for all projects containing the dashboard's underlying UiElements.
Creating, modifying, and deleting a dashboard requires EditDashboards permission for all projects containing the dashboard's underlying UiElements.
Deleting dashboards
There is no documented
DELETE api/dashboards/{id}
method in the dashboard API requirements. To delete a dashboard view, use the Workspace Elements API for the underlying UiElement of type View, for example:
DELETE api/uielements/{elementId}
or the bulk Workspace Elements delete method:
DELETE api/uielements/