SDS P4 API

<back to all web services

Meteringpoints

Get list of metering points

The following routes are available for this service:
GET/api/v5/meteringpoints/Show list of all metering points linked to the provided ApiKey
GET/api/v5/meteringpoints/{Ean}Get detailed information about the requested metering point
<?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 DateTimeFormat : string
{
    case ISO8601 = 'ISO8601';
    case UTC = 'UTC';
    case NL = 'NL';
    case NLOffset = 'NLOffset';
    case IN = 'IN';
    case INOffset = 'INOffset';
    case Unix = 'Unix';
    case UnixMillis = 'UnixMillis';
}

class Generic implements JsonSerializable
{
    public function __construct(
        /** @description 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")
        /** @var string */
        public string $ApiKey='',

        /** @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  */
        // @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")
        /** @var bool|null */
        public ?bool $OnlyPayload=null,

        /** @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  */
        // @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")
        /** @var bool|null */
        public ?bool $ShowRequest=null,

        /** @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 */
        // @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")
        /** @var DateTimeFormat|null */
        public ?DateTimeFormat $DateTimeFormat=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
        if (isset($o['OnlyPayload'])) $this->OnlyPayload = $o['OnlyPayload'];
        if (isset($o['ShowRequest'])) $this->ShowRequest = $o['ShowRequest'];
        if (isset($o['DateTimeFormat'])) $this->DateTimeFormat = JsonConverters::from('DateTimeFormat', $o['DateTimeFormat']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
        if (isset($this->OnlyPayload)) $o['OnlyPayload'] = $this->OnlyPayload;
        if (isset($this->ShowRequest)) $o['ShowRequest'] = $this->ShowRequest;
        if (isset($this->DateTimeFormat)) $o['DateTimeFormat'] = JsonConverters::to('DateTimeFormat', $this->DateTimeFormat);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Get list of metering points */
// @Api(Description="Get list of metering points")
class Meteringpoints extends Generic implements JsonSerializable
{
    /**
     * @param string $ApiKey
     * @param bool|null $OnlyPayload
     * @param bool|null $ShowRequest
     * @param DateTimeFormat|null $DateTimeFormat
     */
    public function __construct(
        string $ApiKey='',
        ?bool $OnlyPayload=null,
        ?bool $ShowRequest=null,
        ?DateTimeFormat $DateTimeFormat=null,
        /** @description Skip the first ... metering points */
        // @ApiMember(DataType="Integer", Description="Skip the first ... metering points", Name="Offset")
        /** @var int */
        public int $Offset=0,

        /** @description Limit response to ... metering points */
        // @ApiMember(DataType="Integer", Description="Limit response to ... metering points", Name="Limit")
        /** @var int */
        public int $Limit=0,

        /** @description Request of details of specific metering point with Ean */
        // @ApiMember(DataType="EAN (18 numbers)", Description="Request of details of specific metering point with Ean", Name="Ean")
        /** @var string|null */
        public ?string $Ean=null,

        /** @description Include metering points with ended contracts (Default: false) */
        // @ApiMember(DataType="Boolean", Description="Include metering points with ended contracts (Default: false)", Name="ShowEnded")
        /** @var bool|null */
        public ?bool $ShowEnded=null,

        /** @description Include additional info about the metering point (Default: false) */
        // @ApiMember(DataType="Boolean", Description="Include additional info about the metering point (Default: false)", Name="AddExtraInfo")
        /** @var bool|null */
        public ?bool $AddExtraInfo=null
    ) {
        parent::__construct($ApiKey,$OnlyPayload,$ShowRequest,$DateTimeFormat);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Offset'])) $this->Offset = $o['Offset'];
        if (isset($o['Limit'])) $this->Limit = $o['Limit'];
        if (isset($o['Ean'])) $this->Ean = $o['Ean'];
        if (isset($o['ShowEnded'])) $this->ShowEnded = $o['ShowEnded'];
        if (isset($o['AddExtraInfo'])) $this->AddExtraInfo = $o['AddExtraInfo'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Offset)) $o['Offset'] = $this->Offset;
        if (isset($this->Limit)) $o['Limit'] = $this->Limit;
        if (isset($this->Ean)) $o['Ean'] = $this->Ean;
        if (isset($this->ShowEnded)) $o['ShowEnded'] = $this->ShowEnded;
        if (isset($this->AddExtraInfo)) $o['AddExtraInfo'] = $this->AddExtraInfo;
        return empty($o) ? new class(){} : $o;
    }
}

PHP Meteringpoints 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 /api/v5/meteringpoints/ HTTP/1.1 
Host: p4v8.smartdatasolutions.nl 
Accept: text/jsv