| Requires any of the roles: | Agent, Administrator |
| POST | /v1/project/rfp/attachment |
|---|
<?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 UploadAttachmentResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var string|null */
public ?string $AttachmentId=null,
/** @var int */
public int $ProjectId=0,
/** @var string|null */
public ?string $FileType=null,
/** @var string|null */
public ?string $FileName=null,
/** @var string|null */
public ?string $ContentType=null,
/** @var int */
public int $ContentLength=0,
/** @var DateTime */
public DateTime $CreatedUtc=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
if (isset($o['ProjectId'])) $this->ProjectId = $o['ProjectId'];
if (isset($o['FileType'])) $this->FileType = $o['FileType'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['ContentType'])) $this->ContentType = $o['ContentType'];
if (isset($o['ContentLength'])) $this->ContentLength = $o['ContentLength'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
if (isset($this->ProjectId)) $o['ProjectId'] = $this->ProjectId;
if (isset($this->FileType)) $o['FileType'] = $this->FileType;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->ContentType)) $o['ContentType'] = $this->ContentType;
if (isset($this->ContentLength)) $o['ContentLength'] = $this->ContentLength;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
return empty($o) ? new class(){} : $o;
}
}
class HttpFile implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Name='',
/** @var string */
public string $FileName='',
/** @var int */
public int $ContentLength=0,
/** @var string */
public string $ContentType='',
/** @var ByteArray|null */
public ?ByteArray $InputStream=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['ContentLength'])) $this->ContentLength = $o['ContentLength'];
if (isset($o['ContentType'])) $this->ContentType = $o['ContentType'];
if (isset($o['InputStream'])) $this->InputStream = JsonConverters::from('ByteArray', $o['InputStream']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->ContentLength)) $o['ContentLength'] = $this->ContentLength;
if (isset($this->ContentType)) $o['ContentType'] = $this->ContentType;
if (isset($this->InputStream)) $o['InputStream'] = JsonConverters::to('ByteArray', $this->InputStream);
return empty($o) ? new class(){} : $o;
}
}
class UploadRfpAttachment implements JsonSerializable
{
public function __construct(
/** @var HttpFile|null */
public ?HttpFile $File=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['File'])) $this->File = JsonConverters::from('HttpFile', $o['File']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->File)) $o['File'] = JsonConverters::to('HttpFile', $this->File);
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.
POST /v1/project/rfp/attachment HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UploadRfpAttachment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<File xmlns:d2p1="http://schemas.datacontract.org/2004/07/ServiceStack.Host">
<d2p1:ContentLength>0</d2p1:ContentLength>
<d2p1:ContentType>String</d2p1:ContentType>
<d2p1:FileName>String</d2p1:FileName>
<d2p1:InputStream xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.IO" i:nil="true" />
<d2p1:Name>String</d2p1:Name>
</File>
</UploadRfpAttachment>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<UploadAttachmentResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<AttachmentId>String</AttachmentId>
<ContentLength>0</ContentLength>
<ContentType>String</ContentType>
<CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
<FileName>String</FileName>
<FileType>String</FileType>
<ProjectId>0</ProjectId>
<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>
</UploadAttachmentResponse>