Trackunit API

<back to all web services

GetReportUnitActiveFaults

The following routes are available for this service:
GET POST/report/unitActiveFaults
<?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 ReportUnitActiveFaults implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var DateTime */
        public DateTime $time=new DateTime(),

        // @DataMember
        /** @var int */
        public int $spn=0,

        // @DataMember
        /** @var int */
        public int $fmi=0,

        // @DataMember
        /** @var int */
        public int $occurrenceCount=0,

        // @DataMember
        /** @var string|null */
        public ?string $name=null,

        // @DataMember
        /** @var string|null */
        public ?string $description=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['time'])) $this->time = JsonConverters::from('DateTime', $o['time']);
        if (isset($o['spn'])) $this->spn = $o['spn'];
        if (isset($o['fmi'])) $this->fmi = $o['fmi'];
        if (isset($o['occurrenceCount'])) $this->occurrenceCount = $o['occurrenceCount'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->time)) $o['time'] = JsonConverters::to('DateTime', $this->time);
        if (isset($this->spn)) $o['spn'] = $this->spn;
        if (isset($this->fmi)) $o['fmi'] = $this->fmi;
        if (isset($this->occurrenceCount)) $o['occurrenceCount'] = $this->occurrenceCount;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class GetReportUnitActiveFaultsResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var array<ReportUnitActiveFaults>|null */
        public ?array $list=null,

        // @DataMember
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

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

// @DataContract
class GetReportUnitActiveFaults implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string|null */
        public ?string $id=null,

        // @DataMember
        /** @var DateTime|null */
        public ?DateTime $from=null,

        // @DataMember
        /** @var DateTime|null */
        public ?DateTime $to=null
    ) {
    }

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

PHP GetReportUnitActiveFaults DTOs

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

HTTP + JSON

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

POST /report/unitActiveFaults HTTP/1.1 
Host: api.trackunit.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"id":"String","from":"0001-01-01T00:00:00.0000000Z","to":"0001-01-01T00:00:00.0000000Z"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"list":[{"time":"0001-01-01T00:00:00.0000000Z","spn":0,"fmi":0,"occurrenceCount":0,"name":"String","description":"String"}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}