| Requires any of the roles: | Agent, Administrator |
| GET | /v1/Ticket/{TicketId} |
|---|
<?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 Ticket implements JsonSerializable
{
public function __construct(
/** @var int */
public int $TicketId=0,
/** @var DateTime */
public DateTime $CreatedDate=new DateTime(),
/** @var string */
public string $CreatedBy='',
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Resolution=null,
/** @var bool|null */
public ?bool $IsClosed=null,
/** @var bool|null */
public ?bool $IsFollowup=null,
/** @var int */
public int $TicketTypeId=0,
/** @var DateTime */
public DateTime $ModifiedDate=new DateTime(),
/** @var string|null */
public ?string $ModifiedBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Resolution'])) $this->Resolution = $o['Resolution'];
if (isset($o['IsClosed'])) $this->IsClosed = $o['IsClosed'];
if (isset($o['IsFollowup'])) $this->IsFollowup = $o['IsFollowup'];
if (isset($o['TicketTypeId'])) $this->TicketTypeId = $o['TicketTypeId'];
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTime', $o['ModifiedDate']);
if (isset($o['ModifiedBy'])) $this->ModifiedBy = $o['ModifiedBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Resolution)) $o['Resolution'] = $this->Resolution;
if (isset($this->IsClosed)) $o['IsClosed'] = $this->IsClosed;
if (isset($this->IsFollowup)) $o['IsFollowup'] = $this->IsFollowup;
if (isset($this->TicketTypeId)) $o['TicketTypeId'] = $this->TicketTypeId;
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTime', $this->ModifiedDate);
if (isset($this->ModifiedBy)) $o['ModifiedBy'] = $this->ModifiedBy;
return empty($o) ? new class(){} : $o;
}
}
class TicketExtended extends Ticket implements JsonSerializable
{
/**
* @param int $TicketId
* @param DateTime $CreatedDate
* @param string $CreatedBy
* @param string|null $Description
* @param string|null $Resolution
* @param bool|null $IsClosed
* @param bool|null $IsFollowup
* @param int $TicketTypeId
* @param DateTime $ModifiedDate
* @param string|null $ModifiedBy
*/
public function __construct(
int $TicketId=0,
DateTime $CreatedDate=new DateTime(),
string $CreatedBy='',
?string $Description=null,
?string $Resolution=null,
?bool $IsClosed=null,
?bool $IsFollowup=null,
int $TicketTypeId=0,
DateTime $ModifiedDate=new DateTime(),
?string $ModifiedBy=null,
/** @var string|null */
public ?string $AgentName=null,
/** @var string|null */
public ?string $TicketType=null,
/** @var bool|null */
public ?bool $AgentHasRead=null,
/** @var bool|null */
public ?bool $AdminHasRead=null
) {
parent::__construct($TicketId,$CreatedDate,$CreatedBy,$Description,$Resolution,$IsClosed,$IsFollowup,$TicketTypeId,$ModifiedDate,$ModifiedBy);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
if (isset($o['TicketType'])) $this->TicketType = $o['TicketType'];
if (isset($o['AgentHasRead'])) $this->AgentHasRead = $o['AgentHasRead'];
if (isset($o['AdminHasRead'])) $this->AdminHasRead = $o['AdminHasRead'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
if (isset($this->TicketType)) $o['TicketType'] = $this->TicketType;
if (isset($this->AgentHasRead)) $o['AgentHasRead'] = $this->AgentHasRead;
if (isset($this->AdminHasRead)) $o['AdminHasRead'] = $this->AdminHasRead;
return empty($o) ? new class(){} : $o;
}
}
class SingleTicketResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var TicketExtended|null */
public ?TicketExtended $Ticket=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Ticket'])) $this->Ticket = JsonConverters::from('TicketExtended', $o['Ticket']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Ticket)) $o['Ticket'] = JsonConverters::to('TicketExtended', $this->Ticket);
return empty($o) ? new class(){} : $o;
}
}
class SingleTicketRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $TicketId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
return empty($o) ? new class(){} : $o;
}
}
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.
GET /v1/Ticket/{TicketId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<SingleTicketResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<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>
<Ticket>
<CreatedBy>00000000-0000-0000-0000-000000000000</CreatedBy>
<CreatedDate>0001-01-01T00:00:00</CreatedDate>
<Description>String</Description>
<IsClosed>false</IsClosed>
<IsFollowup>false</IsFollowup>
<ModifiedBy>String</ModifiedBy>
<ModifiedDate>0001-01-01T00:00:00</ModifiedDate>
<Resolution>String</Resolution>
<TicketId>0</TicketId>
<TicketTypeId>0</TicketTypeId>
<AdminHasRead>false</AdminHasRead>
<AgentHasRead>false</AgentHasRead>
<AgentName>String</AgentName>
<TicketType>String</TicketType>
</Ticket>
</SingleTicketResponse>