| GET | /v8/readings-bulk | ||
|---|---|---|---|
| GET | /v8/readings-bulk/{from} |
import Foundation
import ServiceStack
public class ReadingsBulk : Generic, IGet
{
/**
* If not given, the first object is given after the last request, otherwise gives the first ... data objects received from EDSN/Grid operator received after the given time stamp. Keep in mind, the time stamp is related to when SDS received the data from EDSN, not the date of the data itself!
*/
// @ApiMember(DataType="Time stamp with format: yyyyMMdd-HHmmss-ffffff", Description="If not given, the first object is given after the last request, otherwise gives the first ... data objects received from EDSN/Grid operator received after the given time stamp. Keep in mind, the time stamp is related to when SDS received the data from EDSN, not the date of the data itself!", Name="From")
public var from:String
/**
* Include received interval objects in the result
*/
// @ApiMember(DataType="Boolean, default: true", Description="Include received interval objects in the result", Name="IncludeIntervalObjects")
public var includeIntervalObjects:Bool
/**
* Include received day objects in the result
*/
// @ApiMember(DataType="Boolean, default: false", Description="Include received day objects in the result", Name="IncludeDayObjects")
public var includeDayObjects:Bool
/**
* Gives option to filter return objects, for example to get always only hour records or day records
*/
// @ApiMember(DataType="Enum: None, Hour, Day, LastDayOnly, Month", Description="Gives option to filter return objects, for example to get always only hour records or day records", Name="ObjectFilter")
public var objectFilter:Filter
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case from
case includeIntervalObjects
case includeDayObjects
case objectFilter
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
from = try container.decodeIfPresent(String.self, forKey: .from)
includeIntervalObjects = try container.decodeIfPresent(Bool.self, forKey: .includeIntervalObjects)
includeDayObjects = try container.decodeIfPresent(Bool.self, forKey: .includeDayObjects)
objectFilter = try container.decodeIfPresent(Filter.self, forKey: .objectFilter)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if from != nil { try container.encode(from, forKey: .from) }
if includeIntervalObjects != nil { try container.encode(includeIntervalObjects, forKey: .includeIntervalObjects) }
if includeDayObjects != nil { try container.encode(includeDayObjects, forKey: .includeDayObjects) }
if objectFilter != nil { try container.encode(objectFilter, forKey: .objectFilter) }
}
}
public class Generic : Codable
{
/**
* Api-key. Used to provide credentials to the api. Can also be provided through the request headers with key: X-API-KEY
*/
// @ApiMember(DataType="String", Description="Api-key. Used to provide credentials to the api. Can also be provided through the request headers with key: X-API-KEY", IsRequired=true, Name="ApiKey")
public var apiKey:String
required public init(){}
}
public enum Filter : String, Codable
{
case None
case Hour
case Day
case LastDayOnly
case Month
}
public class P4ReadingsBulk : Codable
{
public var message:String
public var timeStamp:String
public var dayObjectCount:Int?
public var intervalObjectCount:Int?
public var rejectionObjectCount:Int?
public var dayObjects:[P4ReadingDay]
public var intervalObjects:[P4ReadingInterval]
public var rejectionObjects:[P4Rejection]
required public init(){}
}
public class P4ReadingDay : Codable
{
public var ean:String
public var meterId:String
public var queryDate:Date
public var measureUnit:String
public var r180:Double?
public var r181:Double?
public var r182:Double?
public var r280:Double?
public var r281:Double?
public var r282:Double?
required public init(){}
}
public class P4ReadingInterval : Codable
{
public var ean:String
public var meterId:String
public var queryDate:Date
public var measureUnit:String
public var items:[P4ReadingIntervalItem]
required public init(){}
}
public class P4ReadingIntervalItem : Codable
{
public var dateTimeOffset:Date
public var r180:Double
public var r280:Double?
required public init(){}
}
public class P4Rejection : Codable
{
public var ean:String
public var queryDate:Date
public var queryReason:String
public var rejectionCode:String
public var rejectionText:String
required public init(){}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v8/readings-bulk HTTP/1.1 Host: p4.smartdatasolutions.eu Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"message":"String","timeStamp":"String","dayObjectCount":0,"intervalObjectCount":0,"rejectionObjectCount":0,"dayObjects":[{"ean":"String","meterId":"String","queryDate":"0001-01-01","measureUnit":"String","r180":0,"r181":0,"r182":0,"r280":0,"r281":0,"r282":0}],"intervalObjects":[{"ean":"String","meterId":"String","queryDate":"0001-01-01","measureUnit":"String","items":[{"dateTimeOffset":"0001-01-01T00:00:00+00:00","r180":0,"r280":0}]}],"rejectionObjects":[{"ean":"String","queryDate":"0001-01-01","queryReason":"String","rejectionCode":"String","rejectionText":"String"}]}