BazeField Services

<back to all web services

GetAllocation

Allocations API
Requires Authentication
The following routes are available for this service:
GET/allocations/{Id}
import Foundation
import ServiceStack

public class GetAllocation : Codable
{
    public var id:Int

    required public init(){}
}

public class Allocation : Codable
{
    public var id:Int
    public var turbineId:Int
    public var objectId:String
    public var turbineName:String
    public var turbineTitle:String
    public var sourceId:Int
    public var sourceName:String
    public var rootCause:String
    public var triggeredByAlarm:TriggerAlarm
    public var category:AllocationCategoryWithType
    public var categories:[AllocationCategoryWithType]
    public var start:Date
    public var end:Date
    public var start_Local:Date
    public var end_Local:Date
    @TimeSpan public var duration:TimeInterval
    public var lastModified:Date
    public var isUnclassified:Bool
    public var manualOverrideLoss:Bool?
    public var responseTime:Date?
    public var lostProduction:Double?
    public var lostProdutionFiltered:Double?
    public var lostMoney:Double?
    public var lostMoneyFiltered:Double?
    public var properties:[AllocationPropertyValue]
    public var finished:Bool
    public var manual:Bool
    public var overridden:Bool
    public var reallocated:Bool
    public var pending:Bool
    public var changeLog:String
    public var lastComment:Comment
    public var exported:String
    public var labels:[Label]
    public var suspect:Bool?
    public var uncertain:Bool
    public var eventId:Int?
    public var hasEvent:Bool
    public var holdCategory:Bool
    public var approved:Bool
    public var sfId:String
    public var firstAlarmSfId:String
    public var rootCauseAlarmId:Int?

    required public init(){}
}

public class TriggerAlarm : Codable
{
    public var alarm:Alarm
    public var start:Date
    public var end:Date?
    public var logId:Int
    public var sfId:String

    required public init(){}
}

public class Alarm : Codable
{
    public var id:Int
    public var code:Int
    public var alarmCode:AlarmCode
    public var name:String
    public var brakePrg:Int
    public var canTriggerAllocation:Bool
    public var Description:String
    public var remarks:String
    public var resetPrg:String
    public var isOkAlarm:Bool
    public var meta:[String:String]
    public var alarmType:UInt8
    public var type:String

    required public init(){}
}

public class AlarmCode : Codable
{
    public var eventNumber:Int
    public var parameter1:Int?
    public var vendorEventType:String

    required public init(){}
}

public class AllocationCategoryWithType : AllocationCategory
{
    public var allocationType:AllocationType

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case allocationType
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        allocationType = try container.decodeIfPresent(AllocationType.self, forKey: .allocationType)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if allocationType != nil { try container.encode(allocationType, forKey: .allocationType) }
    }
}

public class AllocationCategory : Codable
{
    public var id:Int
    public var name:String
    public var acronym:String
    public var color:String
    public var uncategorized:Bool
    public var available:Bool
    public var typeId:Int
    public var group:String
    public var sortIndex:UInt8
    public var priority:Int
    public var enabled:Bool
    public var performance:UInt8
    public var excluded:Int
    public var parentCategoryId:Int?
    public var parentCategoryName:String
    public var code:String
    public var variantAlias:String
    public var attributes:[String:String]

    required public init(){}
}

public class AllocationType : Codable
{
    public var id:Int
    public var name:String
    public var acronym:String
    public var version:String
    public var Description:String
    public var sortOrder:Int
    public var linkedTypeId:Int?
    public var subType:Bool?
    public var groupName:String
    public var defaultVisible:Bool
    public var domainId:Int?
    public var disabled:Bool
    public var matrix:String
    public var certified:Bool?
    public var allocationTypeClassId:Int
    public var variantOfAbstractTypeId:Int?

    required public init(){}
}

public class AllocationPropertyValue : Codable
{
    public var name:String
    public var displayName:String
    public var value:Double
    public var limitedValue:Double?
    public var unit:String
    public var isOverride:Bool
    public var Description:String

    required public init(){}
}

public class Comment : Codable
{
    public var id:Int
    public var turbineId:Int?
    public var turbineName:String
    public var timeStamp:Date
    public var text:String
    public var createdBy:String
    public var createdById:Double?
    public var lastModified:Date
    public var type:CommentType
    public var external:Bool?
    public var sticky:Bool?
    public var allocationId:Int?
    public var alarmLogId:Int?
    public var alarmId:Int?
    public var commandId:Int?
    public var relatedInfo:String
    public var cleared:Bool
    public var labels:[Label]
    public var objectId:String
    public var relatedStart:Date?
    public var relatedEnd:Date?

    required public init(){}
}

public enum CommentType : String, Codable
{
    case Turbine
    case Allocation
    case Alarm
}

public class Label : Codable
{
    public var id:Int
    public var name:String
    public var color:String
    public var type:LabelType?

    required public init(){}
}

public enum LabelType : Int, Codable
{
    case Allocation = 1
    case Other = 2
    case Alarm = 3
    case Case = 4
}


Swift GetAllocation DTOs

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

HTTP + JSV

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

GET /allocations/{Id} HTTP/1.1 
Host: monitoring.ox2.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	turbineId: 0,
	objectId: String,
	turbineName: String,
	turbineTitle: String,
	sourceId: 0,
	sourceName: String,
	rootCause: String,
	triggeredByAlarm: 
	{
		alarm: 
		{
			id: 0,
			code: 0,
			name: String,
			brakePrg: 0,
			canTriggerAllocation: False,
			description: String,
			remarks: String,
			resetPrg: ,
			isOkAlarm: False,
			meta: 
			{
				String: String
			},
			alarmType: 0,
			type: Warning
		},
		start: 0001-01-01,
		end: 0001-01-01,
		logId: 0,
		sfId: String
	},
	category: 
	{
		allocationType: 
		{
			id: 0,
			name: String,
			acronym: String,
			version: String,
			description: String,
			sortOrder: 0,
			linkedTypeId: 0,
			subType: False,
			groupName: String,
			defaultVisible: False,
			domainId: 0,
			disabled: False,
			matrix: String,
			certified: False,
			allocationTypeClassId: 0,
			variantOfAbstractTypeId: 0
		},
		id: 0,
		name: String,
		acronym: String,
		color: String,
		uncategorized: False,
		available: False,
		typeId: 0,
		group: String,
		sortIndex: 0,
		priority: 0,
		enabled: False,
		performance: 0,
		excluded: 0,
		parentCategoryId: 0,
		parentCategoryName: String,
		code: String,
		variantAlias: String,
		attributes: 
		{
			String: String
		}
	},
	categories: 
	[
		{
			allocationType: 
			{
				id: 0,
				name: String,
				acronym: String,
				version: String,
				description: String,
				sortOrder: 0,
				linkedTypeId: 0,
				subType: False,
				groupName: String,
				defaultVisible: False,
				domainId: 0,
				disabled: False,
				matrix: String,
				certified: False,
				allocationTypeClassId: 0,
				variantOfAbstractTypeId: 0
			},
			id: 0,
			name: String,
			acronym: String,
			color: String,
			uncategorized: False,
			available: False,
			typeId: 0,
			group: String,
			sortIndex: 0,
			priority: 0,
			enabled: False,
			performance: 0,
			excluded: 0,
			parentCategoryId: 0,
			parentCategoryName: String,
			code: String,
			variantAlias: String,
			attributes: 
			{
				String: String
			}
		}
	],
	start: 0001-01-01,
	end: 0001-01-01,
	start_Local: 0001-01-01T00:00:00.0000000+00:00,
	end_Local: 0001-01-01T00:00:00.0000000+00:00,
	duration: P739710DT15H28M48.9321442S,
	lastModified: 0001-01-01,
	isUnclassified: False,
	manualOverrideLoss: False,
	responseTime: 0001-01-01,
	lostProduction: 0,
	lostProdutionFiltered: 0,
	lostMoney: 0,
	lostMoneyFiltered: 0,
	properties: 
	[
		{
			
		}
	],
	finished: False,
	manual: False,
	overridden: False,
	reallocated: False,
	pending: False,
	changeLog: String,
	lastComment: 
	{
		id: 0,
		turbineId: 0,
		turbineName: String,
		timeStamp: 0001-01-01,
		text: String,
		createdBy: String,
		createdById: 0,
		lastModified: 0001-01-01,
		type: Turbine,
		external: False,
		sticky: False,
		allocationId: 0,
		alarmLogId: 0,
		alarmId: 0,
		commandId: 0,
		relatedInfo: String,
		cleared: False,
		labels: 
		[
			{
				id: 0,
				name: String,
				color: String,
				type: 0
			}
		],
		objectId: String,
		relatedStart: 0001-01-01,
		relatedEnd: 0001-01-01
	},
	exported: String,
	labels: 
	[
		{
			id: 0,
			name: String,
			color: String,
			type: 0
		}
	],
	suspect: False,
	uncertain: False,
	eventId: 0,
	hasEvent: False,
	holdCategory: False,
	approved: False,
	sfId: String,
	firstAlarmSfId: String,
	rootCauseAlarmId: 0
}