<back to all web services

GetABTest

The following routes are available for this service:
GET/RestApi/ab-testing/{id}
<?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 GetABTest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id=''
    ) {
    }

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

class VariationViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var int */
        public int $Distribution=0,
        /** @var bool|null */
        public ?bool $IsOriginal=null,
        /** @var int */
        public int $Ordinal=0,
        /** @var string|null */
        public ?string $PageDataId=null,
        /** @var bool|null */
        public ?bool $IsWinner=null
    ) {
    }

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

enum GoalType : string
{
    case NextPageView = 'NextPageView';
    case FormSubmission = 'FormSubmission';
    case DecConversion = 'DecConversion';
}

class GoalViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var GoalType|null */
        public ?GoalType $GoalType=null,
        /** @var string|null */
        public ?string $GoalNameResourceKey=null,
        /** @var string|null */
        public ?string $PredicateOperator=null,
        /** @var string|null */
        public ?string $ObjectId=null,
        /** @var string|null */
        public ?string $ObjectName=null,
        /** @var string|null */
        public ?string $ObjectCulture=null,
        /** @var bool|null */
        public ?bool $IsPrimary=null,
        /** @var int */
        public int $Ordinal=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['GoalType'])) $this->GoalType = JsonConverters::from('GoalType', $o['GoalType']);
        if (isset($o['GoalNameResourceKey'])) $this->GoalNameResourceKey = $o['GoalNameResourceKey'];
        if (isset($o['PredicateOperator'])) $this->PredicateOperator = $o['PredicateOperator'];
        if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
        if (isset($o['ObjectName'])) $this->ObjectName = $o['ObjectName'];
        if (isset($o['ObjectCulture'])) $this->ObjectCulture = $o['ObjectCulture'];
        if (isset($o['IsPrimary'])) $this->IsPrimary = $o['IsPrimary'];
        if (isset($o['Ordinal'])) $this->Ordinal = $o['Ordinal'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->GoalType)) $o['GoalType'] = JsonConverters::to('GoalType', $this->GoalType);
        if (isset($this->GoalNameResourceKey)) $o['GoalNameResourceKey'] = $this->GoalNameResourceKey;
        if (isset($this->PredicateOperator)) $o['PredicateOperator'] = $this->PredicateOperator;
        if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
        if (isset($this->ObjectName)) $o['ObjectName'] = $this->ObjectName;
        if (isset($this->ObjectCulture)) $o['ObjectCulture'] = $this->ObjectCulture;
        if (isset($this->IsPrimary)) $o['IsPrimary'] = $this->IsPrimary;
        if (isset($this->Ordinal)) $o['Ordinal'] = $this->Ordinal;
        return empty($o) ? new class(){} : $o;
    }
}

enum ABTestStatus : string
{
    case NotStarted = 'NotStarted';
    case Scheduled = 'Scheduled';
    case Active = 'Active';
    case Stopped = 'Stopped';
    case Ended = 'Ended';
}

class ABTestViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var DateTime|null */
        public ?DateTime $StartDate=null,
        /** @var DateTime|null */
        public ?DateTime $StopDate=null,
        /** @var string */
        public string $Page='',
        /** @var string */
        public string $SiteId='',
        /** @var string|null */
        public ?string $Culture=null,
        /** @var array<VariationViewModel>|null */
        public ?array $Variations=null,
        /** @var array<GoalViewModel>|null */
        public ?array $Goals=null,
        /** @var string|null */
        public ?string $ReportUrl=null,
        /** @var DateTime */
        public DateTime $LastModified=new DateTime(),
        /** @var ABTestStatus|null */
        public ?ABTestStatus $Status=null,
        /** @var string|null */
        public ?string $Owner=null,
        /** @var string|null */
        public ?string $WinnerVariationId=null,
        /** @var string|null */
        public ?string $SelectedVariationId=null,
        /** @var string|null */
        public ?string $PageNodeErrorMessage=null,
        /** @var string|null */
        public ?string $WarningMessage=null,
        /** @var string|null */
        public ?string $ApiKey=null,
        /** @var string|null */
        public ?string $UserSegmentId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
        if (isset($o['StopDate'])) $this->StopDate = JsonConverters::from('DateTime', $o['StopDate']);
        if (isset($o['Page'])) $this->Page = $o['Page'];
        if (isset($o['SiteId'])) $this->SiteId = $o['SiteId'];
        if (isset($o['Culture'])) $this->Culture = $o['Culture'];
        if (isset($o['Variations'])) $this->Variations = JsonConverters::fromArray('VariationViewModel', $o['Variations']);
        if (isset($o['Goals'])) $this->Goals = JsonConverters::fromArray('GoalViewModel', $o['Goals']);
        if (isset($o['ReportUrl'])) $this->ReportUrl = $o['ReportUrl'];
        if (isset($o['LastModified'])) $this->LastModified = JsonConverters::from('DateTime', $o['LastModified']);
        if (isset($o['Status'])) $this->Status = JsonConverters::from('ABTestStatus', $o['Status']);
        if (isset($o['Owner'])) $this->Owner = $o['Owner'];
        if (isset($o['WinnerVariationId'])) $this->WinnerVariationId = $o['WinnerVariationId'];
        if (isset($o['SelectedVariationId'])) $this->SelectedVariationId = $o['SelectedVariationId'];
        if (isset($o['PageNodeErrorMessage'])) $this->PageNodeErrorMessage = $o['PageNodeErrorMessage'];
        if (isset($o['WarningMessage'])) $this->WarningMessage = $o['WarningMessage'];
        if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
        if (isset($o['UserSegmentId'])) $this->UserSegmentId = $o['UserSegmentId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
        if (isset($this->StopDate)) $o['StopDate'] = JsonConverters::to('DateTime', $this->StopDate);
        if (isset($this->Page)) $o['Page'] = $this->Page;
        if (isset($this->SiteId)) $o['SiteId'] = $this->SiteId;
        if (isset($this->Culture)) $o['Culture'] = $this->Culture;
        if (isset($this->Variations)) $o['Variations'] = JsonConverters::toArray('VariationViewModel', $this->Variations);
        if (isset($this->Goals)) $o['Goals'] = JsonConverters::toArray('GoalViewModel', $this->Goals);
        if (isset($this->ReportUrl)) $o['ReportUrl'] = $this->ReportUrl;
        if (isset($this->LastModified)) $o['LastModified'] = JsonConverters::to('DateTime', $this->LastModified);
        if (isset($this->Status)) $o['Status'] = JsonConverters::to('ABTestStatus', $this->Status);
        if (isset($this->Owner)) $o['Owner'] = $this->Owner;
        if (isset($this->WinnerVariationId)) $o['WinnerVariationId'] = $this->WinnerVariationId;
        if (isset($this->SelectedVariationId)) $o['SelectedVariationId'] = $this->SelectedVariationId;
        if (isset($this->PageNodeErrorMessage)) $o['PageNodeErrorMessage'] = $this->PageNodeErrorMessage;
        if (isset($this->WarningMessage)) $o['WarningMessage'] = $this->WarningMessage;
        if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
        if (isset($this->UserSegmentId)) $o['UserSegmentId'] = $this->UserSegmentId;
        return empty($o) ? new class(){} : $o;
    }
}

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

GET /RestApi/ab-testing/{id} HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Title":"String","Description":"String","StartDate":"\/Date(-62135596800000)\/","StopDate":"\/Date(-62135596800000)\/","Culture":"String","ReportUrl":"String","LastModified":"\/Date(-62135596800000-0000)\/","Status":"NotStarted","Owner":"String","WinnerVariationId":"00000000-0000-0000-0000-000000000000","SelectedVariationId":"00000000-0000-0000-0000-000000000000","PageNodeErrorMessage":"String","WarningMessage":"String","ApiKey":"String","UserSegmentId":"00000000-0000-0000-0000-000000000000"}