All Verbs | /RestApi/Sitefinity/Analytics/GetDashboardData | ||
---|---|---|---|
All Verbs | /RestApi/GetDashboardData |
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class GetDashboardDataMessage implements JsonSerializable
{
public function __construct(
/** @var string */
public string $DashboardId='',
/** @var string|null */
public ?string $jsStartDate=null,
/** @var string|null */
public ?string $jsEndDate=null,
/** @var array<string,string>|null */
public ?array $QueryStringFilters=null,
/** @var DateTime */
public DateTime $StartDate=new DateTime(),
/** @var DateTime */
public DateTime $EndDate=new DateTime(),
/** @var string|null */
public ?string $GroupBy=null,
/** @var array<string,string>|null */
public ?array $Dimensions=null,
/** @var string|null */
public ?string $MaxValue=null,
/** @var string */
public string $SiteId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DashboardId'])) $this->DashboardId = $o['DashboardId'];
if (isset($o['jsStartDate'])) $this->jsStartDate = $o['jsStartDate'];
if (isset($o['jsEndDate'])) $this->jsEndDate = $o['jsEndDate'];
if (isset($o['QueryStringFilters'])) $this->QueryStringFilters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['QueryStringFilters']);
if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
if (isset($o['GroupBy'])) $this->GroupBy = $o['GroupBy'];
if (isset($o['Dimensions'])) $this->Dimensions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Dimensions']);
if (isset($o['MaxValue'])) $this->MaxValue = $o['MaxValue'];
if (isset($o['SiteId'])) $this->SiteId = $o['SiteId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DashboardId)) $o['DashboardId'] = $this->DashboardId;
if (isset($this->jsStartDate)) $o['jsStartDate'] = $this->jsStartDate;
if (isset($this->jsEndDate)) $o['jsEndDate'] = $this->jsEndDate;
if (isset($this->QueryStringFilters)) $o['QueryStringFilters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->QueryStringFilters);
if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
if (isset($this->GroupBy)) $o['GroupBy'] = $this->GroupBy;
if (isset($this->Dimensions)) $o['Dimensions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Dimensions);
if (isset($this->MaxValue)) $o['MaxValue'] = $this->MaxValue;
if (isset($this->SiteId)) $o['SiteId'] = $this->SiteId;
return empty($o) ? new class(){} : $o;
}
}
class MetricItemDTO implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $DisplayName=null,
/** @var float */
public float $Value=0.0,
/** @var string|null */
public ?string $Unit=null,
/** @var string|null */
public ?string $DenominatorMetricName=null,
/** @var string|null */
public ?string $NominatorMetricName=null,
/** @var bool|null */
public ?bool $ShowInSelector=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['DisplayName'])) $this->DisplayName = $o['DisplayName'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['Unit'])) $this->Unit = $o['Unit'];
if (isset($o['DenominatorMetricName'])) $this->DenominatorMetricName = $o['DenominatorMetricName'];
if (isset($o['NominatorMetricName'])) $this->NominatorMetricName = $o['NominatorMetricName'];
if (isset($o['ShowInSelector'])) $this->ShowInSelector = $o['ShowInSelector'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->DisplayName)) $o['DisplayName'] = $this->DisplayName;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->Unit)) $o['Unit'] = $this->Unit;
if (isset($this->DenominatorMetricName)) $o['DenominatorMetricName'] = $this->DenominatorMetricName;
if (isset($this->NominatorMetricName)) $o['NominatorMetricName'] = $this->NominatorMetricName;
if (isset($this->ShowInSelector)) $o['ShowInSelector'] = $this->ShowInSelector;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class DimensionItem implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string|null */
public ?string $Value=null,
// @DataMember
/** @var string|null */
public ?string $Name=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['Name'])) $this->Name = $o['Name'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->Name)) $o['Name'] = $this->Name;
return empty($o) ? new class(){} : $o;
}
}
class SingleSerie implements JsonSerializable
{
public function __construct(
/** @var MetricItemDTO|null */
public ?MetricItemDTO $MainMetric=null,
/** @var string|null */
public ?string $CategoryFormat=null,
/** @var bool|null */
public ?bool $Batch=null,
/** @var bool|null */
public ?bool $IsCategory=null,
/** @var string|null */
public ?string $SeriesName=null,
/** @var array<DimensionItem>|null */
public ?array $SeriesDimensions=null,
/** @var string|null */
public ?string $RelatedDimension=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['MainMetric'])) $this->MainMetric = JsonConverters::from('MetricItemDTO', $o['MainMetric']);
if (isset($o['CategoryFormat'])) $this->CategoryFormat = $o['CategoryFormat'];
if (isset($o['Batch'])) $this->Batch = $o['Batch'];
if (isset($o['IsCategory'])) $this->IsCategory = $o['IsCategory'];
if (isset($o['SeriesName'])) $this->SeriesName = $o['SeriesName'];
if (isset($o['SeriesDimensions'])) $this->SeriesDimensions = JsonConverters::fromArray('DimensionItem', $o['SeriesDimensions']);
if (isset($o['RelatedDimension'])) $this->RelatedDimension = $o['RelatedDimension'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->MainMetric)) $o['MainMetric'] = JsonConverters::to('MetricItemDTO', $this->MainMetric);
if (isset($this->CategoryFormat)) $o['CategoryFormat'] = $this->CategoryFormat;
if (isset($this->Batch)) $o['Batch'] = $this->Batch;
if (isset($this->IsCategory)) $o['IsCategory'] = $this->IsCategory;
if (isset($this->SeriesName)) $o['SeriesName'] = $this->SeriesName;
if (isset($this->SeriesDimensions)) $o['SeriesDimensions'] = JsonConverters::toArray('DimensionItem', $this->SeriesDimensions);
if (isset($this->RelatedDimension)) $o['RelatedDimension'] = $this->RelatedDimension;
return empty($o) ? new class(){} : $o;
}
}
class DashBoardControl implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ControlType=null,
/** @var array<string,string>|null */
public ?array $attributes=null,
/** @var string|null */
public ?string $PlaceholderId=null,
/** @var string|null */
public ?string $DisplayName=null,
/** @var array<SingleSerie>|null */
public ?array $Series=null,
/** @var string|null */
public ?string $DimensionName=null,
/** @var array<string>|null */
public ?array $RelatedDimension=null,
/** @var string|null */
public ?string $SortbyField=null,
/** @var bool|null */
public ?bool $SortAsc=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ControlType'])) $this->ControlType = $o['ControlType'];
if (isset($o['attributes'])) $this->attributes = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['attributes']);
if (isset($o['PlaceholderId'])) $this->PlaceholderId = $o['PlaceholderId'];
if (isset($o['DisplayName'])) $this->DisplayName = $o['DisplayName'];
if (isset($o['Series'])) $this->Series = JsonConverters::fromArray('SingleSerie', $o['Series']);
if (isset($o['DimensionName'])) $this->DimensionName = $o['DimensionName'];
if (isset($o['RelatedDimension'])) $this->RelatedDimension = JsonConverters::fromArray('string', $o['RelatedDimension']);
if (isset($o['SortbyField'])) $this->SortbyField = $o['SortbyField'];
if (isset($o['SortAsc'])) $this->SortAsc = $o['SortAsc'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ControlType)) $o['ControlType'] = $this->ControlType;
if (isset($this->attributes)) $o['attributes'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->attributes);
if (isset($this->PlaceholderId)) $o['PlaceholderId'] = $this->PlaceholderId;
if (isset($this->DisplayName)) $o['DisplayName'] = $this->DisplayName;
if (isset($this->Series)) $o['Series'] = JsonConverters::toArray('SingleSerie', $this->Series);
if (isset($this->DimensionName)) $o['DimensionName'] = $this->DimensionName;
if (isset($this->RelatedDimension)) $o['RelatedDimension'] = JsonConverters::toArray('string', $this->RelatedDimension);
if (isset($this->SortbyField)) $o['SortbyField'] = $this->SortbyField;
if (isset($this->SortAsc)) $o['SortAsc'] = $this->SortAsc;
return empty($o) ? new class(){} : $o;
}
}
class KendoItem implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $category=null,
/** @var array<string,float>|null */
public ?array $values=null,
/** @var string|null */
public ?string $group=null,
/** @var string|null */
public ?string $tooltip=null,
/** @var array<string,string>|null */
public ?array $Dimensions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['category'])) $this->category = $o['category'];
if (isset($o['values'])) $this->values = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','float']), $o['values']);
if (isset($o['group'])) $this->group = $o['group'];
if (isset($o['tooltip'])) $this->tooltip = $o['tooltip'];
if (isset($o['Dimensions'])) $this->Dimensions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Dimensions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->category)) $o['category'] = $this->category;
if (isset($this->values)) $o['values'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','float']), $this->values);
if (isset($this->group)) $o['group'] = $this->group;
if (isset($this->tooltip)) $o['tooltip'] = $this->tooltip;
if (isset($this->Dimensions)) $o['Dimensions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Dimensions);
return empty($o) ? new class(){} : $o;
}
}
class GetDashboardData implements JsonSerializable
{
public function __construct(
/** @var array<DashBoardControl>|null */
public ?array $Controls=null,
/** @var string|null */
public ?string $LayoutTemplateName=null,
/** @var string|null */
public ?string $GroupBy=null,
/** @var array<MetricItemDTO>|null */
public ?array $MetricNames=null,
/** @var string|null */
public ?string $ErrorMessage=null,
/** @var bool|null */
public ?bool $NeedsGrouping=null,
/** @var bool|null */
public ?bool $IsDrillDown=null,
/** @var array<KendoItem>|null */
public ?array $DateItems=null,
/** @var array<KendoItem>|null */
public ?array $NonDateItems=null,
/** @var KendoItem|null */
public ?KendoItem $TotalsItem=null,
/** @var string[][]|null */
public ?array $MapDataTable=null,
/** @var bool|null */
public ?bool $IsMapRequest=null,
/** @var array<string,string[]>|null */
public ?array $SeriesSources=null,
/** @var int */
public int $StatusCode=0,
/** @var bool|null */
public ?bool $SuppressMultipleSeries=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Controls'])) $this->Controls = JsonConverters::fromArray('DashBoardControl', $o['Controls']);
if (isset($o['LayoutTemplateName'])) $this->LayoutTemplateName = $o['LayoutTemplateName'];
if (isset($o['GroupBy'])) $this->GroupBy = $o['GroupBy'];
if (isset($o['MetricNames'])) $this->MetricNames = JsonConverters::fromArray('MetricItemDTO', $o['MetricNames']);
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
if (isset($o['NeedsGrouping'])) $this->NeedsGrouping = $o['NeedsGrouping'];
if (isset($o['IsDrillDown'])) $this->IsDrillDown = $o['IsDrillDown'];
if (isset($o['DateItems'])) $this->DateItems = JsonConverters::fromArray('KendoItem', $o['DateItems']);
if (isset($o['NonDateItems'])) $this->NonDateItems = JsonConverters::fromArray('KendoItem', $o['NonDateItems']);
if (isset($o['TotalsItem'])) $this->TotalsItem = JsonConverters::from('KendoItem', $o['TotalsItem']);
if (isset($o['MapDataTable'])) $this->MapDataTable = JsonConverters::fromArray('string', $o['MapDataTable']);
if (isset($o['IsMapRequest'])) $this->IsMapRequest = $o['IsMapRequest'];
if (isset($o['SeriesSources'])) $this->SeriesSources = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','List<String>']), $o['SeriesSources']);
if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
if (isset($o['SuppressMultipleSeries'])) $this->SuppressMultipleSeries = $o['SuppressMultipleSeries'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Controls)) $o['Controls'] = JsonConverters::toArray('DashBoardControl', $this->Controls);
if (isset($this->LayoutTemplateName)) $o['LayoutTemplateName'] = $this->LayoutTemplateName;
if (isset($this->GroupBy)) $o['GroupBy'] = $this->GroupBy;
if (isset($this->MetricNames)) $o['MetricNames'] = JsonConverters::toArray('MetricItemDTO', $this->MetricNames);
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
if (isset($this->NeedsGrouping)) $o['NeedsGrouping'] = $this->NeedsGrouping;
if (isset($this->IsDrillDown)) $o['IsDrillDown'] = $this->IsDrillDown;
if (isset($this->DateItems)) $o['DateItems'] = JsonConverters::toArray('KendoItem', $this->DateItems);
if (isset($this->NonDateItems)) $o['NonDateItems'] = JsonConverters::toArray('KendoItem', $this->NonDateItems);
if (isset($this->TotalsItem)) $o['TotalsItem'] = JsonConverters::to('KendoItem', $this->TotalsItem);
if (isset($this->MapDataTable)) $o['MapDataTable'] = JsonConverters::toArray('string', $this->MapDataTable);
if (isset($this->IsMapRequest)) $o['IsMapRequest'] = $this->IsMapRequest;
if (isset($this->SeriesSources)) $o['SeriesSources'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','List<String>']), $this->SeriesSources);
if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
if (isset($this->SuppressMultipleSeries)) $o['SuppressMultipleSeries'] = $this->SuppressMultipleSeries;
return empty($o) ? new class(){} : $o;
}
}
PHP GetDashboardDataMessage DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /RestApi/Sitefinity/Analytics/GetDashboardData HTTP/1.1
Host: www.asg.com.au
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{Unable to show example output for type 'GetDashboardDataMessage' using the custom 'other' filter}One or more errors occurred.
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Controls":[{"ControlType":"String","attributes":{"String":"String"},"PlaceholderId":"String","DisplayName":"String","Series":[{"MainMetric":{"Name":"String","DisplayName":"String","Value":0,"Unit":"String","DenominatorMetricName":"String","NominatorMetricName":"String","ShowInSelector":false},"CategoryFormat":"String","Batch":false,"IsCategory":false,"SeriesName":"String","SeriesDimensions":[{}],"RelatedDimension":"String"}],"DimensionName":"String","RelatedDimension":["String"],"SortbyField":"String","SortAsc":false}],"LayoutTemplateName":"String","GroupBy":"String","MetricNames":[{"Name":"String","DisplayName":"String","Value":0,"Unit":"String","DenominatorMetricName":"String","NominatorMetricName":"String","ShowInSelector":false}],"ErrorMessage":"String","NeedsGrouping":false,"IsDrillDown":false,"DateItems":[{"category":"String","values":{"String":0},"group":"String","tooltip":"String","Dimensions":{"String":"String"}}],"NonDateItems":[{"category":"String","values":{"String":0},"group":"String","tooltip":"String","Dimensions":{"String":"String"}}],"TotalsItem":{"category":"String","values":{"String":0},"group":"String","tooltip":"String","Dimensions":{"String":"String"}},"MapDataTable":[["String"]],"IsMapRequest":false,"SeriesSources":{"String":["String"]},"StatusCode":0,"SuppressMultipleSeries":false}