<back to all web services

CreateService

The following routes are available for this service:
POST/RestApi/apiservice/createService
<?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 PropertiesProxy implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $PropertyType=null,
        /** @var bool|null */
        public ?bool $IsPersistent=null,
        /** @var bool|null */
        public ?bool $AllowSort=null,
        /** @var bool|null */
        public ?bool $AllowFilter=null,
        /** @var bool|null */
        public ?bool $IsKey=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['PropertyType'])) $this->PropertyType = $o['PropertyType'];
        if (isset($o['IsPersistent'])) $this->IsPersistent = $o['IsPersistent'];
        if (isset($o['AllowSort'])) $this->AllowSort = $o['AllowSort'];
        if (isset($o['AllowFilter'])) $this->AllowFilter = $o['AllowFilter'];
        if (isset($o['IsKey'])) $this->IsKey = $o['IsKey'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->PropertyType)) $o['PropertyType'] = $this->PropertyType;
        if (isset($this->IsPersistent)) $o['IsPersistent'] = $this->IsPersistent;
        if (isset($this->AllowSort)) $o['AllowSort'] = $this->AllowSort;
        if (isset($this->AllowFilter)) $o['AllowFilter'] = $this->AllowFilter;
        if (isset($this->IsKey)) $o['IsKey'] = $this->IsKey;
        return empty($o) ? new class(){} : $o;
    }
}

class ContentsProxy implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var bool|null */
        public ?bool $ReadOnly=null,
        /** @var string|null */
        public ?string $UrlKey=null,
        /** @var string|null */
        public ?string $ClrType=null,
        /** @var string|null */
        public ?string $Access=null,
        /** @var array<PropertiesProxy>|null */
        public ?array $Properties=null,
        /** @var array<ContentsProxy>|null */
        public ?array $Children=null,
        /** @var bool|null */
        public ?bool $AutogenerateProperties=null,
        /** @var string|null */
        public ?string $parentId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['ReadOnly'])) $this->ReadOnly = $o['ReadOnly'];
        if (isset($o['UrlKey'])) $this->UrlKey = $o['UrlKey'];
        if (isset($o['ClrType'])) $this->ClrType = $o['ClrType'];
        if (isset($o['Access'])) $this->Access = $o['Access'];
        if (isset($o['Properties'])) $this->Properties = JsonConverters::fromArray('PropertiesProxy', $o['Properties']);
        if (isset($o['Children'])) $this->Children = JsonConverters::fromArray('ContentsProxy', $o['Children']);
        if (isset($o['AutogenerateProperties'])) $this->AutogenerateProperties = $o['AutogenerateProperties'];
        if (isset($o['parentId'])) $this->parentId = $o['parentId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->ReadOnly)) $o['ReadOnly'] = $this->ReadOnly;
        if (isset($this->UrlKey)) $o['UrlKey'] = $this->UrlKey;
        if (isset($this->ClrType)) $o['ClrType'] = $this->ClrType;
        if (isset($this->Access)) $o['Access'] = $this->Access;
        if (isset($this->Properties)) $o['Properties'] = JsonConverters::toArray('PropertiesProxy', $this->Properties);
        if (isset($this->Children)) $o['Children'] = JsonConverters::toArray('ContentsProxy', $this->Children);
        if (isset($this->AutogenerateProperties)) $o['AutogenerateProperties'] = $this->AutogenerateProperties;
        if (isset($this->parentId)) $o['parentId'] = $this->parentId;
        return empty($o) ? new class(){} : $o;
    }
}

class ServiceBaseRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Route=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $UrlName=null,
        /** @var bool|null */
        public ?bool $Enabled=null,
        /** @var string|null */
        public ?string $ApiKey=null,
        /** @var string|null */
        public ?string $AccessControlAllowOrigin=null,
        /** @var bool|null */
        public ?bool $AutogenerateTypes=null,
        /** @var string|null */
        public ?string $Access=null,
        /** @var array<ContentsProxy>|null */
        public ?array $Types=null,
        /** @var string|null */
        public ?string $Protocol=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Route'])) $this->Route = $o['Route'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['UrlName'])) $this->UrlName = $o['UrlName'];
        if (isset($o['Enabled'])) $this->Enabled = $o['Enabled'];
        if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
        if (isset($o['AccessControlAllowOrigin'])) $this->AccessControlAllowOrigin = $o['AccessControlAllowOrigin'];
        if (isset($o['AutogenerateTypes'])) $this->AutogenerateTypes = $o['AutogenerateTypes'];
        if (isset($o['Access'])) $this->Access = $o['Access'];
        if (isset($o['Types'])) $this->Types = JsonConverters::fromArray('ContentsProxy', $o['Types']);
        if (isset($o['Protocol'])) $this->Protocol = $o['Protocol'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Route)) $o['Route'] = $this->Route;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->UrlName)) $o['UrlName'] = $this->UrlName;
        if (isset($this->Enabled)) $o['Enabled'] = $this->Enabled;
        if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
        if (isset($this->AccessControlAllowOrigin)) $o['AccessControlAllowOrigin'] = $this->AccessControlAllowOrigin;
        if (isset($this->AutogenerateTypes)) $o['AutogenerateTypes'] = $this->AutogenerateTypes;
        if (isset($this->Access)) $o['Access'] = $this->Access;
        if (isset($this->Types)) $o['Types'] = JsonConverters::toArray('ContentsProxy', $this->Types);
        if (isset($this->Protocol)) $o['Protocol'] = $this->Protocol;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateService extends ServiceBaseRequest implements JsonSerializable
{
    /**
     * @param string|null $Route
     * @param string|null $Name
     * @param string|null $UrlName
     * @param bool|null $Enabled
     * @param string|null $ApiKey
     * @param string|null $AccessControlAllowOrigin
     * @param bool|null $AutogenerateTypes
     * @param string|null $Access
     * @param array<ContentsProxy>|null $Types
     * @param string|null $Protocol
     */
    public function __construct(
        ?string $Route=null,
        ?string $Name=null,
        ?string $UrlName=null,
        ?bool $Enabled=null,
        ?string $ApiKey=null,
        ?string $AccessControlAllowOrigin=null,
        ?bool $AutogenerateTypes=null,
        ?string $Access=null,
        ?array $Types=null,
        ?string $Protocol=null
    ) {
        parent::__construct($Route,$Name,$UrlName,$Enabled,$ApiKey,$AccessControlAllowOrigin,$AutogenerateTypes,$Access,$Types,$Protocol);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateService DTOs

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

HTTP + OTHER

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

POST /RestApi/apiservice/createService HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Route":"String","Name":"String","UrlName":"String","Enabled":false,"ApiKey":"String","AccessControlAllowOrigin":"String","AutogenerateTypes":false,"Access":"String","Protocol":"String"}