SDS P4 API

<back to all web services

UsageReading

Get usagereading

The following routes are available for this service:
GET/api/v5/meteringpoints/{Ean}/usagereading/{Aggregation}/{DateFrom}Get usage/reading of a single asset with the selected aggregation starting from DateFrom
GET/api/v5/meteringpoints/{Ean}/usagereading/{Aggregation}/{DateFrom}/{DateTo}Get usage/reading of a single asset with the selected aggregation and period
import 'package:servicestack/servicestack.dart';

enum DateTimeFormat
{
    ISO8601,
    UTC,
    NL,
    NLOffset,
    IN,
    INOffset,
    Unix,
    UnixMillis,
}

class Generic implements IConvertible
{
    /**
    * 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")
    String? ApiKey;

    /**
    * Normally the result of the request is put inside a resultobject with some status information about the request. If you want the output as csv this outer object can be irritating. Default value: FALSE 
    */
    // @ApiMember(DataType="Boolean", Description="Normally the result of the request is put inside a resultobject with some status information about the request. If you want the output as csv this outer object can be irritating. Default value: FALSE ", Name="OnlyPayload")
    bool? OnlyPayload;

    /**
    * Show the request as interpreted by the api. Useful to see how filters / dates are parsed. If no value us provided, the default value is: FALSE 
    */
    // @ApiMember(DataType="Boolean", Description="Show the request as interpreted by the api. Useful to see how filters / dates are parsed. If no value us provided, the default value is: FALSE ", Name="ShowRequest")
    bool? ShowRequest;

    /**
    * Format all DateTime in the response object. If used in browser, sometimes ISO8601 is not correctly transformed. Enum options: ISO8601 (DEFAULT), UTC, NL, NLOffset, Unix, UnixMillis
    */
    // @ApiMember(DataType="Enum", Description="Format all DateTime in the response object. If used in browser, sometimes ISO8601 is not correctly transformed. Enum options: ISO8601 (DEFAULT), UTC, NL, NLOffset, Unix, UnixMillis", Name="DateTimeFormat")
    DateTimeFormat? DateTimeFormat;

    Generic({this.ApiKey,this.OnlyPayload,this.ShowRequest,this.DateTimeFormat});
    Generic.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ApiKey = json['ApiKey'];
        OnlyPayload = json['OnlyPayload'];
        ShowRequest = json['ShowRequest'];
        DateTimeFormat = JsonConverters.fromJson(json['DateTimeFormat'],'DateTimeFormat',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ApiKey': ApiKey,
        'OnlyPayload': OnlyPayload,
        'ShowRequest': ShowRequest,
        'DateTimeFormat': JsonConverters.toJson(DateTimeFormat,'DateTimeFormat',context!)
    };

    getTypeName() => "Generic";
    TypeContext? context = _ctx;
}

enum AggregationForAPI
{
    None,
    Hour,
    Day,
    Week,
    Month,
    Year,
}

enum PayloadFormat
{
    UsageReturnCombined,
    UsageReturn,
    UsageReturnAndTariff,
}

enum MeasurementSource
{
    Detail,
    Day,
    Month,
    Unknown,
}

/**
* Get usagereading
*/
// @Api(Description="Get usagereading")
class UsageReading extends Generic implements IConvertible
{
    /**
    * Request of details of specific meteringpoint with Ean
    */
    // @ApiMember(DataType="EAN (18 numbers)", Description="Request of details of specific meteringpoint with Ean", Name="Ean")
    String? Ean;

    /**
    * Aggregation level. The None-'level' will give the most detailed level available for the requested asset. If a level is requested that is not available or can be calculate, no data is returned. Enum options: None, Hour
    */
    // @ApiMember(DataType="Enum", Description="Aggregation level. The None-'level' will give the most detailed level available for the requested asset. If a level is requested that is not available or can be calculate, no data is returned. Enum options: None, Hour", IsRequired=true, Name="Aggregation")
    AggregationForAPI? Aggregation;

    /**
    * Start date the usages are requested for
    */
    // @ApiMember(DataType="Date: yyyy-mm-dd", Description="Start date the usages are requested for", IsRequired=true, Name="DateFrom")
    DateTime? DateFrom;

    /**
    * End date the usages are requested for (this is included in the response). If no date is provided the DateTo will seven days from the DateFrom. 
    */
    // @ApiMember(DataType="Date: yyyy-mm-dd", Description="End date the usages are requested for (this is included in the response). If no date is provided the DateTo will seven days from the DateFrom. ", Name="DateTo")
    DateTime? DateTo;

    /**
    * The output can be generated in a few formats. UsageReturnCombined: return values will be subtracted from the usage, UsageReturn: separate columns form usage and return (if available) and UsageReturnAndTariff: for both usage and return a column for tariff1 and tariff2. Default value: UsageReturnCombined
    */
    // @ApiMember(DataType="Enum", Description="The output can be generated in a few formats. UsageReturnCombined: return values will be subtracted from the usage, UsageReturn: separate columns form usage and return (if available) and UsageReturnAndTariff: for both usage and return a column for tariff1 and tariff2. Default value: UsageReturnCombined", Name="PayloadFormat")
    PayloadFormat? PayloadFormat;

    /**
    * See filter. Usages are available from the Detail channel. Default value: Detail
    */
    // @ApiMember(DataType="Enum", Description="See filter. Usages are available from the Detail channel. Default value: Detail", Name="Source")
    MeasurementSource? Source;

    /**
    * Add column with Dutch day (Default: false)
    */
    // @ApiMember(DataType="Boolean", Description="Add column with Dutch day (Default: false)", Name="AddDateNL")
    bool? AddDateNL;

    /**
    * Add columns with CreatedOn and LastUpdated (Default: false)
    */
    // @ApiMember(DataType="Boolean", Description="Add columns with CreatedOn and LastUpdated (Default: false)", Name="AddTimestamps")
    bool? AddTimestamps;

    /**
    * Add column with ean (Default: false)
    */
    // @ApiMember(DataType="Boolean", Description="Add column with ean (Default: false)", Name="AddEan")
    bool? AddEan;

    /**
    * Create a row for each register instead of a column/field for each register (Default: false)
    */
    // @ApiMember(DataType="Boolean", Description="Create a row for each register instead of a column/field for each register (Default: false)", Name="RegistersInRows")
    bool? RegistersInRows;

    /**
    * Gridoperator doesn't provided tariff information for the detail channel, but this can be calculated (Default: false)
    */
    // @ApiMember(DataType="Boolean", Description="Gridoperator doesn't provided tariff information for the detail channel, but this can be calculated (Default: false)", Name="CalculateDetailTariff")
    bool? CalculateDetailTariff;

    /**
    * If want to get the reading as well with the usages
    */
    // @ApiMember(DataType="Boolean", Description="If want to get the reading as well with the usages", Name="AlsoReading")
    bool? AlsoReading;

    /**
    * CacheKey used for Internal logic
    */
    // @ApiMember(Description="CacheKey used for Internal logic", Name="CacheKey")
    String? CacheKey;

    UsageReading({this.Ean,this.Aggregation,this.DateFrom,this.DateTo,this.PayloadFormat,this.Source,this.AddDateNL,this.AddTimestamps,this.AddEan,this.RegistersInRows,this.CalculateDetailTariff,this.AlsoReading,this.CacheKey});
    UsageReading.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Ean = json['Ean'];
        Aggregation = JsonConverters.fromJson(json['Aggregation'],'AggregationForAPI',context!);
        DateFrom = JsonConverters.fromJson(json['DateFrom'],'DateTime',context!);
        DateTo = JsonConverters.fromJson(json['DateTo'],'DateTime',context!);
        PayloadFormat = JsonConverters.fromJson(json['PayloadFormat'],'PayloadFormat',context!);
        Source = JsonConverters.fromJson(json['Source'],'MeasurementSource',context!);
        AddDateNL = json['AddDateNL'];
        AddTimestamps = json['AddTimestamps'];
        AddEan = json['AddEan'];
        RegistersInRows = json['RegistersInRows'];
        CalculateDetailTariff = json['CalculateDetailTariff'];
        AlsoReading = json['AlsoReading'];
        CacheKey = json['CacheKey'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Ean': Ean,
        'Aggregation': JsonConverters.toJson(Aggregation,'AggregationForAPI',context!),
        'DateFrom': JsonConverters.toJson(DateFrom,'DateTime',context!),
        'DateTo': JsonConverters.toJson(DateTo,'DateTime',context!),
        'PayloadFormat': JsonConverters.toJson(PayloadFormat,'PayloadFormat',context!),
        'Source': JsonConverters.toJson(Source,'MeasurementSource',context!),
        'AddDateNL': AddDateNL,
        'AddTimestamps': AddTimestamps,
        'AddEan': AddEan,
        'RegistersInRows': RegistersInRows,
        'CalculateDetailTariff': CalculateDetailTariff,
        'AlsoReading': AlsoReading,
        'CacheKey': CacheKey
    });

    getTypeName() => "UsageReading";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'p4v8.smartdatasolutions.nl', types: <String, TypeInfo> {
    'DateTimeFormat': TypeInfo(TypeOf.Enum, enumValues:DateTimeFormat.values),
    'Generic': TypeInfo(TypeOf.Class, create:() => Generic()),
    'AggregationForAPI': TypeInfo(TypeOf.Enum, enumValues:AggregationForAPI.values),
    'PayloadFormat': TypeInfo(TypeOf.Enum, enumValues:PayloadFormat.values),
    'MeasurementSource': TypeInfo(TypeOf.Enum, enumValues:MeasurementSource.values),
    'UsageReading': TypeInfo(TypeOf.Class, create:() => UsageReading()),
});

Dart UsageReading DTOs

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

HTTP + XML

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

GET /api/v5/meteringpoints/{Ean}/usagereading/{Aggregation}/{DateFrom} HTTP/1.1 
Host: p4v8.smartdatasolutions.nl 
Accept: application/xml