| POST | /v1/provision |
|---|
<?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 ProvisionResult implements JsonSerializable
{
public function __construct(
/** @var string */
public string $TenantId='',
/** @var string|null */
public ?string $TenantName=null,
/** @var string|null */
public ?string $Slug=null,
/** @var string|null */
public ?string $PackCode=null,
/** @var string */
public string $BranchId='',
/** @var string|null */
public ?string $BranchName=null,
/** @var array<string>|null */
public ?array $RolesCreated=null,
/** @var int */
public int $CatalogItemsSeeded=0,
/** @var bool|null */
public ?bool $OwnerAssigned=null,
/** @var string|null */
public ?string $OwnerEmail=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TenantId'])) $this->TenantId = $o['TenantId'];
if (isset($o['TenantName'])) $this->TenantName = $o['TenantName'];
if (isset($o['Slug'])) $this->Slug = $o['Slug'];
if (isset($o['PackCode'])) $this->PackCode = $o['PackCode'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
if (isset($o['RolesCreated'])) $this->RolesCreated = JsonConverters::fromArray('string', $o['RolesCreated']);
if (isset($o['CatalogItemsSeeded'])) $this->CatalogItemsSeeded = $o['CatalogItemsSeeded'];
if (isset($o['OwnerAssigned'])) $this->OwnerAssigned = $o['OwnerAssigned'];
if (isset($o['OwnerEmail'])) $this->OwnerEmail = $o['OwnerEmail'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TenantId)) $o['TenantId'] = $this->TenantId;
if (isset($this->TenantName)) $o['TenantName'] = $this->TenantName;
if (isset($this->Slug)) $o['Slug'] = $this->Slug;
if (isset($this->PackCode)) $o['PackCode'] = $this->PackCode;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
if (isset($this->RolesCreated)) $o['RolesCreated'] = JsonConverters::toArray('string', $this->RolesCreated);
if (isset($this->CatalogItemsSeeded)) $o['CatalogItemsSeeded'] = $this->CatalogItemsSeeded;
if (isset($this->OwnerAssigned)) $o['OwnerAssigned'] = $this->OwnerAssigned;
if (isset($this->OwnerEmail)) $o['OwnerEmail'] = $this->OwnerEmail;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class ProvisionTenantRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Slug=null,
/** @var string|null */
public ?string $PackCode=null,
/** @var string|null */
public ?string $BranchName=null,
/** @var string|null */
public ?string $TimeZoneId=null,
/** @var bool|null */
public ?bool $SeedCatalog=null,
/** @var bool|null */
public ?bool $AssignMeAsOwner=null,
/** @var string|null */
public ?string $OwnerEmail=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Slug'])) $this->Slug = $o['Slug'];
if (isset($o['PackCode'])) $this->PackCode = $o['PackCode'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
if (isset($o['TimeZoneId'])) $this->TimeZoneId = $o['TimeZoneId'];
if (isset($o['SeedCatalog'])) $this->SeedCatalog = $o['SeedCatalog'];
if (isset($o['AssignMeAsOwner'])) $this->AssignMeAsOwner = $o['AssignMeAsOwner'];
if (isset($o['OwnerEmail'])) $this->OwnerEmail = $o['OwnerEmail'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Slug)) $o['Slug'] = $this->Slug;
if (isset($this->PackCode)) $o['PackCode'] = $this->PackCode;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
if (isset($this->TimeZoneId)) $o['TimeZoneId'] = $this->TimeZoneId;
if (isset($this->SeedCatalog)) $o['SeedCatalog'] = $this->SeedCatalog;
if (isset($this->AssignMeAsOwner)) $o['AssignMeAsOwner'] = $this->AssignMeAsOwner;
if (isset($this->OwnerEmail)) $o['OwnerEmail'] = $this->OwnerEmail;
return empty($o) ? new class(){} : $o;
}
}
PHP ProvisionTenantRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/provision HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ProvisionTenantRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<AssignMeAsOwner>false</AssignMeAsOwner>
<BranchName>String</BranchName>
<Name>String</Name>
<OwnerEmail>String</OwnerEmail>
<PackCode>String</PackCode>
<SeedCatalog>false</SeedCatalog>
<Slug>String</Slug>
<TimeZoneId>String</TimeZoneId>
</ProvisionTenantRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ProvisionResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<BranchId>00000000-0000-0000-0000-000000000000</BranchId>
<BranchName>String</BranchName>
<CatalogItemsSeeded>0</CatalogItemsSeeded>
<OwnerAssigned>false</OwnerAssigned>
<OwnerEmail>String</OwnerEmail>
<PackCode>String</PackCode>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<RolesCreated xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</RolesCreated>
<Slug>String</Slug>
<TenantId>00000000-0000-0000-0000-000000000000</TenantId>
<TenantName>String</TenantName>
</ProvisionResult>