CoreService

<back to all web services

CreateTimeSeriesDefinition

TimeSeries - CRUD

Creates a new time series definition

Requires Authentication
Required roles:TenantReader, TenantAdmin
The following routes are available for this service:
POST/api/timeseries/Creates a new time series definition
POST/timeseries/Creates a new time series definition
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*


/**
* Creates a new time series definition
*/
@Api(Description="Creates a new time series definition")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=TimeSeriesDefinitionDto::class, StatusCode=201)
open class CreateTimeSeriesDefinition : ICreateRequest, IHasTenantName, IPost, ITimeSeriesDefinitionRequest
{
    @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    @Validate(Validator="NotEmpty")
    override var tenantName:String? = null

    /**
    * The unique name of the time series
    */
    @ApiMember(DataType="string", Description="The unique name of the time series", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotEmpty")
    // @Validate(Validator="MaximumLength(100)")
    // @Validate(Validator="RegularExpression(′^[0-9a-z]′)")
    override var name:String? = null

    /**
    * The time series display name
    */
    @ApiMember(DataType="string", Description="The time series display name", ParameterType="body")
    @Validate(Validator="MaximumLength(250)")
    override var displayName:String? = null

    /**
    * A more detailed description for the series
    */
    @ApiMember(DataType="string", Description="A more detailed description for the series", ParameterType="body")
    @Validate(Validator="MaximumLength(8000)")
    override var description:String? = null

    /**
    * The source type of the time series. Only used when AutoCollection is true
    */
    @ApiMember(DataType="string", Description="The source type of the time series. Only used when AutoCollection is true", ParameterType="body")
    @Validate(Validator="MaximumLength(50)")
    override var sourceType:ObjectTypes? = null

    /**
    * The query used to extract datapoints from source table. Only used when AutoCollection is true
    */
    @ApiMember(DataType="string", Description="The query used to extract datapoints from source table. Only used when AutoCollection is true", ParameterType="body")
    @Validate(Validator="MaximumLength(2147483647)")
    override var autoCollectionQuery:String? = null

    /**
    * How often a datapoint will be collected, Only used when AutoCollection is true
    */
    @ApiMember(DataType="int", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")
    override var autoCollectionInterval:Int? = null

    /**
    * The interval unit for auto collection, Only used when AutoCollection is true
    */
    @ApiMember(DataType="int", Description="The interval unit for auto collection, Only used when AutoCollection is true", ParameterType="body")
    override var autoCollectionIntervalUnit:IntervalUnits? = null

    /**
    * The time (UTC), when the query will be executed to collect the datapoints, Only used when AutoCollection is true
    */
    @ApiMember(DataType="string", Description="The time (UTC), when the query will be executed to collect the datapoints, Only used when AutoCollection is true", Format="TimeOnly", ParameterType="body")
    override var autoCollectionTime:TimeSpan? = null

    /**
    * How often a datapoint will be collected, Only used when AutoCollection is true
    */
    @ApiMember(DataType="bool", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")
    override var autoCollection:Boolean? = null

    /**
    * How many months to keep data in the time series before deleting them
    */
    @ApiMember(DataType="double", Description="How many months to keep data in the time series before deleting them", ParameterType="body")
    open var retentionTimeMonths:Double? = null
}

enum class ObjectTypes
{
    None,
    ConfigItem,
    Tenant,
    Collection,
    Resource,
    ComputeNode,
    VirtualMachine,
    PhysicalMachine,
    Disk,
    Subnet,
    IpAddress,
    Job,
    JobEvent,
    FreezePeriod,
    ResourceGroup,
    Deployment,
    ResourceGroupTemplate,
    DeploymentTemplate,
    ResourceProvider,
    GenericResource,
    Role,
    Permission,
    User,
    PatchingWindow,
    Update,
    ReportDefinition,
    TimeSeries,
    DataPoint,
    Action,
    ActionAssignment,
    UserNote,
}

enum class IntervalUnits
{
    Second,
    Minute,
    Hour,
    Day,
    Week,
    Month,
    Year,
}

open class TimeSeriesDefinitionDto
{
    open var id:UUID? = null
    open var name:String? = null
    open var description:String? = null
    open var sourceType:ObjectTypes? = null
    open var autoCollectionQuery:String? = null
    open var autoCollectionInterval:Double? = null
    open var autoCollectionIntervalUnit:IntervalUnits? = null
    open var autoCollectionTime:TimeSpan? = null
    open var lastAutoCollected:Date? = null
    open var autoCollection:Boolean? = null
    open var retentionTimeMonths:Int? = null
}

Kotlin CreateTimeSeriesDefinition 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.

POST /api/timeseries/ HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tenantName":"String","name":"String","displayName":"String","description":"String","sourceType":"None","autoCollectionQuery":"String","autoCollectionInterval":0,"autoCollectionIntervalUnit":"Second","autoCollectionTime":"00:00","autoCollection":false,"retentionTimeMonths":0,"txId":"00000000-0000-0000-0000-000000000000"}
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}