Getting the settings and data from the [Dashboard] section

PDF
Advanced

Getting the settings and the dashboards data is implemented in the AnalyticsService service and in the AnalyticsServiceUtils utility in the Platform package.

Sample requests to the AnalyticsService service
Advanced
Request headers
Accept:application/json

Methods 

GetDashboardViewConfig()
POST /0/rest/AnalyticsService/GetDashboardViewConfig

{
    "id": "a71d5c04-dff7-4892-90e5-9e7cc2246915"
}
{
  "items": [
    {
      "layout": {
        "column": 0,
        "row": 0,
        "colSpan": 12,
        "rowSpan": 5
      },
      "name": "Chart4",
      "itemType": 4,
      "widgetType": "Chart"
    }
  ]
}
GetDashboardData()
POST /0/rest/AnalyticsService/GetDashboardData

{
    "id": "a71d5c04-dff7-4892-90e5-9e7cc2246915",
    "timeZoneOffset": 120
}
{
    "items": [
        {
            "name": "Indicator1",
            "caption": "Average time for activity",
            "widgetType": "Indicator",
            "style": "widget-green",
            "data": 2
        }
    ]
}
GetDashboardItemData()
POST /0/rest/AnalyticsService/GetDashboardItemData

{
    "dashboardId": "a71d5c04-dff7-4892-90e5-9e7cc2246915",
    "itemName": "Chart4",
    "timeZoneOffset": 120
}
{
  "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": []
}
AnalyticsService class
Advanced

Class implements the functionality of getting settings and the dashboards data.

Methods 

Stream GetDashboardViewConfig(Guid id)

Returns the settings of a view and widgets on the dashboards tab by the dashboard page Id.

Stream GetDashboardData(Guid id, int timeZoneOffset)

Returns the data from all widgets on the dashboards tab by the dashboard page Id.

Stream GetDashboardItemData(Guid dashboardId, string itemName, int timeZoneOffset)

Returns data from athe specific widget by the dashboard page Id and the widget name.

timeZoneOffset – the time zone offset (in minutes) from the UTC. Dashboards data will be received using this time zone.