CoreService

<back to all web services

GetTimeSeriesDefinition

TimeSeries - CRUD

Returns a timeseries definition by its ID

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/timeseries/{Id}Returns a timeseries definition
GET/api/timeseries/{Id}Returns a timeseries definition
GET/timeseries/{Name}/bynameReturns a timeseries definition
GET/api/timeseries/{Name}/bynameReturns a timeseries definition
<?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};


enum ObjectTypes : string
{
    case None = 'None';
    case ConfigItem = 'ConfigItem';
    case Tenant = 'Tenant';
    case Collection = 'Collection';
    case Resource = 'Resource';
    case ComputeNode = 'ComputeNode';
    case VirtualMachine = 'VirtualMachine';
    case PhysicalMachine = 'PhysicalMachine';
    case Disk = 'Disk';
    case Subnet = 'Subnet';
    case IPAddress = 'IPAddress';
    case Job = 'Job';
    case JobEvent = 'JobEvent';
    case FreezePeriod = 'FreezePeriod';
    case ResourceGroup = 'ResourceGroup';
    case Deployment = 'Deployment';
    case ResourceGroupTemplate = 'ResourceGroupTemplate';
    case DeploymentTemplate = 'DeploymentTemplate';
    case ResourceProvider = 'ResourceProvider';
    case GenericResource = 'GenericResource';
    case Role = 'Role';
    case Permission = 'Permission';
    case User = 'User';
    case PatchingWindow = 'PatchingWindow';
    case Update = 'Update';
    case ReportDefinition = 'ReportDefinition';
    case TimeSeries = 'TimeSeries';
    case DataPoint = 'DataPoint';
    case Action = 'Action';
    case ActionAssignment = 'ActionAssignment';
    case UserNote = 'UserNote';
}

enum IntervalUnits : string
{
    case Second = 'Second';
    case Minute = 'Minute';
    case Hour = 'Hour';
    case Day = 'Day';
    case Week = 'Week';
    case Month = 'Month';
    case Year = 'Year';
}

class TimeSeriesDefinitionDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $name='',
        /** @var string|null */
        public ?string $description=null,
        /** @var ObjectTypes|null */
        public ?ObjectTypes $sourceType=null,
        /** @var string|null */
        public ?string $autoCollectionQuery=null,
        /** @var float|null */
        public ?float $autoCollectionInterval=null,
        /** @var IntervalUnits|null */
        public ?IntervalUnits $autoCollectionIntervalUnit=null,
        /** @var DateInterval|null */
        public ?DateInterval $autoCollectionTime=null,
        /** @var DateTime|null */
        public ?DateTime $lastAutoCollected=null,
        /** @var bool|null */
        public ?bool $autoCollection=null,
        /** @var int|null */
        public ?int $retentionTimeMonths=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['sourceType'])) $this->sourceType = JsonConverters::from('ObjectTypes', $o['sourceType']);
        if (isset($o['autoCollectionQuery'])) $this->autoCollectionQuery = $o['autoCollectionQuery'];
        if (isset($o['autoCollectionInterval'])) $this->autoCollectionInterval = $o['autoCollectionInterval'];
        if (isset($o['autoCollectionIntervalUnit'])) $this->autoCollectionIntervalUnit = JsonConverters::from('IntervalUnits', $o['autoCollectionIntervalUnit']);
        if (isset($o['autoCollectionTime'])) $this->autoCollectionTime = JsonConverters::from('TimeOnly', $o['autoCollectionTime']);
        if (isset($o['lastAutoCollected'])) $this->lastAutoCollected = JsonConverters::from('DateTime', $o['lastAutoCollected']);
        if (isset($o['autoCollection'])) $this->autoCollection = $o['autoCollection'];
        if (isset($o['retentionTimeMonths'])) $this->retentionTimeMonths = $o['retentionTimeMonths'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->sourceType)) $o['sourceType'] = JsonConverters::to('ObjectTypes', $this->sourceType);
        if (isset($this->autoCollectionQuery)) $o['autoCollectionQuery'] = $this->autoCollectionQuery;
        if (isset($this->autoCollectionInterval)) $o['autoCollectionInterval'] = $this->autoCollectionInterval;
        if (isset($this->autoCollectionIntervalUnit)) $o['autoCollectionIntervalUnit'] = JsonConverters::to('IntervalUnits', $this->autoCollectionIntervalUnit);
        if (isset($this->autoCollectionTime)) $o['autoCollectionTime'] = JsonConverters::to('TimeOnly', $this->autoCollectionTime);
        if (isset($this->lastAutoCollected)) $o['lastAutoCollected'] = JsonConverters::to('DateTime', $this->lastAutoCollected);
        if (isset($this->autoCollection)) $o['autoCollection'] = $this->autoCollection;
        if (isset($this->retentionTimeMonths)) $o['retentionTimeMonths'] = $this->retentionTimeMonths;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Returns a timeseries definition by its ID */
// @Api(Description="Returns a timeseries definition by its ID")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.TimeSeries.Reponses.TimeSeriesDefinitionDto)", StatusCode=200)
class GetTimeSeriesDefinition implements IGetSingleRequest, IHasTenantName, IGet, JsonSerializable
{
    public function __construct(
        // @ApiMember(DataType="string", Format="guid", ParameterType="path")
        /** @var string|null */
        public ?string $id=null,

        // @ApiMember(DataType="string", ParameterType="path")
        /** @var string|null */
        public ?string $name=null,

        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName='',

        // @ApiMember(ParameterType="query", Verb="GET")
        /** @var bool|null */
        public ?bool $includeReferencedObjects=null,

        /** @description If true, also soft deleted items will be returned */
        // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
        /** @var bool|null */
        public ?bool $includeDeleted=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
        if (isset($o['includeReferencedObjects'])) $this->includeReferencedObjects = $o['includeReferencedObjects'];
        if (isset($o['includeDeleted'])) $this->includeDeleted = $o['includeDeleted'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
        if (isset($this->includeReferencedObjects)) $o['includeReferencedObjects'] = $this->includeReferencedObjects;
        if (isset($this->includeDeleted)) $o['includeDeleted'] = $this->includeDeleted;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetTimeSeriesDefinition DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /timeseries/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","name":"String","description":"String","sourceType":"None","autoCollectionQuery":"String","autoCollectionInterval":0,"autoCollectionIntervalUnit":"Second","autoCollectionTime":"00:00","lastAutoCollected":"0001-01-01T00:00:00.0000000Z","autoCollection":false,"retentionTimeMonths":0}