BokaMera.API.Host

<back to all web services

CreateError

The following routes are available for this service:
POST/errors/Save error to log
<?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};


class ErrorQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CompanyId='',
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $ExceptionName=null,
        /** @var string|null */
        public ?string $ExceptionMessage=null,
        /** @var string|null */
        public ?string $ExceptionSource=null,
        /** @var string|null */
        public ?string $InnerExceptionName=null,
        /** @var string|null */
        public ?string $StackTrace=null,
        /** @var string|null */
        public ?string $URL=null,
        /** @var string|null */
        public ?string $LoggedInUser=null,
        /** @var bool|null */
        public ?bool $Visible=null,
        /** @var string|null */
        public ?string $IPAddress=null,
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var string|null */
        public ?string $Request=null,
        /** @var string|null */
        public ?string $Session=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['ExceptionName'])) $this->ExceptionName = $o['ExceptionName'];
        if (isset($o['ExceptionMessage'])) $this->ExceptionMessage = $o['ExceptionMessage'];
        if (isset($o['ExceptionSource'])) $this->ExceptionSource = $o['ExceptionSource'];
        if (isset($o['InnerExceptionName'])) $this->InnerExceptionName = $o['InnerExceptionName'];
        if (isset($o['StackTrace'])) $this->StackTrace = $o['StackTrace'];
        if (isset($o['URL'])) $this->URL = $o['URL'];
        if (isset($o['LoggedInUser'])) $this->LoggedInUser = $o['LoggedInUser'];
        if (isset($o['Visible'])) $this->Visible = $o['Visible'];
        if (isset($o['IPAddress'])) $this->IPAddress = $o['IPAddress'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['Request'])) $this->Request = $o['Request'];
        if (isset($o['Session'])) $this->Session = $o['Session'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->ExceptionName)) $o['ExceptionName'] = $this->ExceptionName;
        if (isset($this->ExceptionMessage)) $o['ExceptionMessage'] = $this->ExceptionMessage;
        if (isset($this->ExceptionSource)) $o['ExceptionSource'] = $this->ExceptionSource;
        if (isset($this->InnerExceptionName)) $o['InnerExceptionName'] = $this->InnerExceptionName;
        if (isset($this->StackTrace)) $o['StackTrace'] = $this->StackTrace;
        if (isset($this->URL)) $o['URL'] = $this->URL;
        if (isset($this->LoggedInUser)) $o['LoggedInUser'] = $this->LoggedInUser;
        if (isset($this->Visible)) $o['Visible'] = $this->Visible;
        if (isset($this->IPAddress)) $o['IPAddress'] = $this->IPAddress;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->Request)) $o['Request'] = $this->Request;
        if (isset($this->Session)) $o['Session'] = $this->Session;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateError implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The company id, if empty will use the company id for the user you are logged in with. */
        // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var string */
        public string $ExceptionName='',

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var string */
        public string $ExceptionMessage='',

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $ExceptionSource=null,

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var string */
        public string $InnerExceptionName='',

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var string */
        public string $StackTrace='',

        /** @description  */
        // @ApiMember(Description="", IsRequired=true)
        /** @var string */
        public string $URL='',

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $LoggedInUser=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $IPAddress=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $Request=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $Session=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ExceptionName'])) $this->ExceptionName = $o['ExceptionName'];
        if (isset($o['ExceptionMessage'])) $this->ExceptionMessage = $o['ExceptionMessage'];
        if (isset($o['ExceptionSource'])) $this->ExceptionSource = $o['ExceptionSource'];
        if (isset($o['InnerExceptionName'])) $this->InnerExceptionName = $o['InnerExceptionName'];
        if (isset($o['StackTrace'])) $this->StackTrace = $o['StackTrace'];
        if (isset($o['URL'])) $this->URL = $o['URL'];
        if (isset($o['LoggedInUser'])) $this->LoggedInUser = $o['LoggedInUser'];
        if (isset($o['IPAddress'])) $this->IPAddress = $o['IPAddress'];
        if (isset($o['Request'])) $this->Request = $o['Request'];
        if (isset($o['Session'])) $this->Session = $o['Session'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ExceptionName)) $o['ExceptionName'] = $this->ExceptionName;
        if (isset($this->ExceptionMessage)) $o['ExceptionMessage'] = $this->ExceptionMessage;
        if (isset($this->ExceptionSource)) $o['ExceptionSource'] = $this->ExceptionSource;
        if (isset($this->InnerExceptionName)) $o['InnerExceptionName'] = $this->InnerExceptionName;
        if (isset($this->StackTrace)) $o['StackTrace'] = $this->StackTrace;
        if (isset($this->URL)) $o['URL'] = $this->URL;
        if (isset($this->LoggedInUser)) $o['LoggedInUser'] = $this->LoggedInUser;
        if (isset($this->IPAddress)) $o['IPAddress'] = $this->IPAddress;
        if (isset($this->Request)) $o['Request'] = $this->Request;
        if (isset($this->Session)) $o['Session'] = $this->Session;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateError 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 /errors/ HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","ExceptionName":"String","ExceptionMessage":"String","ExceptionSource":"String","InnerExceptionName":"String","StackTrace":"String","URL":"String","LoggedInUser":"String","IPAddress":"String","Request":"String","Session":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Id":0,"ExceptionName":"String","ExceptionMessage":"String","ExceptionSource":"String","InnerExceptionName":"String","StackTrace":"String","URL":"String","LoggedInUser":"String","Visible":false,"IPAddress":"String","Request":"String","Session":"String"}