<back to all web services

ChangeTemplateDto

The following routes are available for this service:
PUT/RestApi/Sitefinity/mobile-formats/templates/change
<?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 MobileFormatTemplateDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Value=null
    ) {
    }

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

class ChangeTemplateInfoDto implements JsonSerializable
{
    public function __construct(
        /** @var MobileFormatTemplateDto|null */
        public ?MobileFormatTemplateDto $SelectedTemplate=null,
        /** @var MobileFormatTemplateDto|null */
        public ?MobileFormatTemplateDto $SelectedLayoutTemplate=null,
        /** @var bool|null */
        public ?bool $UseCustomCanonicalUrl=null,
        /** @var string|null */
        public ?string $CustomCanonicalUrlFormat=null,
        /** @var string|null */
        public ?string $MobileFormatId=null
    ) {
    }

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

class ChangeTemplateDto implements JsonSerializable
{
    public function __construct(
        /** @var array<ChangeTemplateInfoDto>|null */
        public ?array $TemplatesInfo=null,
        /** @var string|null */
        public ?string $SiteId=null,
        /** @var string|null */
        public ?string $ContentTypeId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['TemplatesInfo'])) $this->TemplatesInfo = JsonConverters::fromArray('ChangeTemplateInfoDto', $o['TemplatesInfo']);
        if (isset($o['SiteId'])) $this->SiteId = $o['SiteId'];
        if (isset($o['ContentTypeId'])) $this->ContentTypeId = $o['ContentTypeId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->TemplatesInfo)) $o['TemplatesInfo'] = JsonConverters::toArray('ChangeTemplateInfoDto', $this->TemplatesInfo);
        if (isset($this->SiteId)) $o['SiteId'] = $this->SiteId;
        if (isset($this->ContentTypeId)) $o['ContentTypeId'] = $this->ContentTypeId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ChangeTemplateDto 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.

PUT /RestApi/Sitefinity/mobile-formats/templates/change HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	SiteId: String,
	ContentTypeId: String
}