<back to all web services

GetAnalyticsAccountsMessage

The following routes are available for this service:
All Verbs/RestApi/Sitefinity/Analytics/GetAnalyticsAccounts
All Verbs/RestApi/GetAnalyticsAccounts
<?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 GetAnalyticsAccountsMessage implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $SiteId=''
    ) {
    }

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

// @DataContract
class AnalyticsAccountInfo implements IGoogleAnalyticsProviderConfiguration, JsonSerializable
{
    public function __construct(
        // @DataMember(Name="id")
        /** @var string|null */
        public ?string $id=null,

        // @DataMember(Name="accountId")
        /** @var string|null */
        public ?string $accountId=null,

        // @DataMember(Name="name")
        /** @var string|null */
        public ?string $name=null,

        // @DataMember(Name="webPropertyId")
        /** @var string|null */
        public ?string $webPropertyId=null
    ) {
    }

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

class GetAnalyticsAccountsData implements JsonSerializable
{
    public function __construct(
        /** @var array<AnalyticsAccountInfo>|null */
        public ?array $Accounts=null,
        /** @var string|null */
        public ?string $SelectedAccount=null,
        /** @var string|null */
        public ?string $SelectedProfileId=null
    ) {
    }

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

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

POST /RestApi/Sitefinity/Analytics/GetAnalyticsAccounts HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Accounts: 
	[
		{
			id: String,
			accountId: String,
			name: String,
			webPropertyId: String
		}
	],
	SelectedAccount: String,
	SelectedProfileId: String
}