Getting the settings and data from the [Dashboards] section
Glossary Item Box
Introduction
Getting the settings and the dashboards data is implemented in the AnalyticsService service and in the AnalyticsServiceUtils utility in the Platform package.
AnalyticsService
Class that implements the AnalyticsService service conteins following public methods:
- public Stream GetDashboardViewConfig(Guid id) – returns the settings of a view and widgets on the dashboards tab by the dashboard page Id.
- public Stream GetDashboardData(Guid id, int timeZoneOffset) – returns the data from all widgets on the dashboards tab by the dashboard page Id.
- public Stream GetDashboardItemData(Guid dashboardId, string itemName, int timeZoneOffset) – returns data from athe specific widget by the dashboard page Id and the widget name.
timeZoneOffset {int} – the time zone offset (in minutes) from the UTC. Dashboards data will be received using this time zone.
An example of the requests to the AnalyticsService service
HEADERS
Accept:application/json
The GetDashboardViewConfig() method
URL
POST /0/rest/AnalyticsService/GetDashboardViewConfig
The content of the request
{ "id": "a71d5c04-dff7-4892-90e5-9e7cc2246915" }
The content of the response
{ "items": [ { "layout": { "column": 0, "row": 0, "colSpan": 12, "rowSpan": 5 }, "name": "Chart4", "itemType": 4, "widgetType": "Chart" } ] }
The GetDashboardData() method
URL
POST /0/rest/AnalyticsService/GetDashboardData
The content of the request
{ "id": "a71d5c04-dff7-4892-90e5-9e7cc2246915", "timeZoneOffset": 120 }
The content of the response
{ "items": [ { "name": "Indicator1", "caption": "Average time for activity", "widgetType": "Indicator", "style": "widget-green", "data": 2 } ] }
The GetDashboardItemData() method
URL
POST /0/rest/AnalyticsService/GetDashboardItemData
The content of the request
{ "dashboardId": "a71d5c04-dff7-4892-90e5-9e7cc2246915", "itemName": "Chart4", "timeZoneOffset": 120 }
The content of the response
{ "name": "Chart4", "caption": "Invoice payment dynamics", "widgetType": "Chart", "chartConfig": { "xAxisDefaultCaption": null, "yAxisDefaultCaption": null, "seriesConfig": [ { "type": "column", "style": "widget-green", "xAxis": { "caption": null, "dateTimeFormat": "Month;Year" }, "yAxis": { "caption": "Actually paid", "dataValueType": 6 }, "schemaName": "Invoice", "schemaCaption": "Invoice", "useEmptyValue": null } ], "orderDirection": "asc" }, "style": "widget-green", "data": [] }