Server

<back to all web services

GetDeviceList

Devices
Requires Authentication
The following routes are available for this service:
GET/api/v1/devices
<?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};


// @DataContract
class Device implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="Guid")
        /** @var string|null */
        public ?string $Guid=null,

        // @DataMember(Name="Geraetenummer")
        /** @var string|null */
        public ?string $Geraetenummer=null,

        // @DataMember(Name="Bezeichnung")
        /** @var string|null */
        public ?string $Bezeichnung=null,

        // @DataMember(Name="Beschreibung")
        /** @var string|null */
        public ?string $Beschreibung=null,

        // @DataMember(Name="Einbaudatum")
        /** @var DateTime */
        public DateTime $Einbaudatum=new DateTime(),

        // @DataMember(Name="Ausbaudatum")
        /** @var DateTime|null */
        public ?DateTime $Ausbaudatum=null,

        // @DataMember(Name="Eichdatum")
        /** @var DateTime|null */
        public ?DateTime $Eichdatum=null,

        // @DataMember(Name="Einheit")
        /** @var string|null */
        public ?string $Einheit=null,

        // @DataMember(Name="Memo")
        /** @var string|null */
        public ?string $Memo=null,

        // @DataMember(Name="DeviceCatalogGuid")
        /** @var string|null */
        public ?string $DeviceCatalogGuid=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Guid'])) $this->Guid = $o['Guid'];
        if (isset($o['Geraetenummer'])) $this->Geraetenummer = $o['Geraetenummer'];
        if (isset($o['Bezeichnung'])) $this->Bezeichnung = $o['Bezeichnung'];
        if (isset($o['Beschreibung'])) $this->Beschreibung = $o['Beschreibung'];
        if (isset($o['Einbaudatum'])) $this->Einbaudatum = JsonConverters::from('DateTime', $o['Einbaudatum']);
        if (isset($o['Ausbaudatum'])) $this->Ausbaudatum = JsonConverters::from('DateTime', $o['Ausbaudatum']);
        if (isset($o['Eichdatum'])) $this->Eichdatum = JsonConverters::from('DateTime', $o['Eichdatum']);
        if (isset($o['Einheit'])) $this->Einheit = $o['Einheit'];
        if (isset($o['Memo'])) $this->Memo = $o['Memo'];
        if (isset($o['DeviceCatalogGuid'])) $this->DeviceCatalogGuid = $o['DeviceCatalogGuid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Guid)) $o['Guid'] = $this->Guid;
        if (isset($this->Geraetenummer)) $o['Geraetenummer'] = $this->Geraetenummer;
        if (isset($this->Bezeichnung)) $o['Bezeichnung'] = $this->Bezeichnung;
        if (isset($this->Beschreibung)) $o['Beschreibung'] = $this->Beschreibung;
        if (isset($this->Einbaudatum)) $o['Einbaudatum'] = JsonConverters::to('DateTime', $this->Einbaudatum);
        if (isset($this->Ausbaudatum)) $o['Ausbaudatum'] = JsonConverters::to('DateTime', $this->Ausbaudatum);
        if (isset($this->Eichdatum)) $o['Eichdatum'] = JsonConverters::to('DateTime', $this->Eichdatum);
        if (isset($this->Einheit)) $o['Einheit'] = $this->Einheit;
        if (isset($this->Memo)) $o['Memo'] = $this->Memo;
        if (isset($this->DeviceCatalogGuid)) $o['DeviceCatalogGuid'] = $this->DeviceCatalogGuid;
        return empty($o) ? new class(){} : $o;
    }
}

class GetDeviceListResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<Device>|null */
        public ?array $deviceList=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['deviceList'])) $this->deviceList = JsonConverters::fromArray('Device', $o['deviceList']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->deviceList)) $o['deviceList'] = JsonConverters::toArray('Device', $this->deviceList);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class GetDeviceList implements IHasBearerToken, JsonSerializable
{
    public function __construct(
        // @ApiMember(IsRequired=true, ParameterType="query")
        /** @var string */
        public string $bearerToken='',

        /** @description Optional! Follow the format : /api/v1/devices?filter[ObjektGuid]=* */
        // @DataMember(Name="filter[ObjektGuid]")
        // @ApiMember(Description="Optional! Follow the format : /api/v1/devices?filter[ObjektGuid]=*", ParameterType="query")
        /** @var string|null */
        public ?string $filter_ObjektGuid_=null,

        /** @description Optional! Follow the format : /api/v1/devices?filter[NutzerGuid]=* */
        // @DataMember(Name="filter[NutzerGuid]")
        // @ApiMember(Description="Optional! Follow the format : /api/v1/devices?filter[NutzerGuid]=*", ParameterType="query")
        /** @var string|null */
        public ?string $filter_NutzerGuid_=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['bearerToken'])) $this->bearerToken = $o['bearerToken'];
        if (isset($o['filter_ObjektGuid_'])) $this->filter_ObjektGuid_ = $o['filter_ObjektGuid_'];
        if (isset($o['filter_NutzerGuid_'])) $this->filter_NutzerGuid_ = $o['filter_NutzerGuid_'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->bearerToken)) $o['bearerToken'] = $this->bearerToken;
        if (isset($this->filter_ObjektGuid_)) $o['filter_ObjektGuid_'] = $this->filter_ObjektGuid_;
        if (isset($this->filter_NutzerGuid_)) $o['filter_NutzerGuid_'] = $this->filter_NutzerGuid_;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetDeviceList 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/v1/devices HTTP/1.1 
Host: messtechnik-horb-servdesk.eras-online.de 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}