| GET | /document/{erpSystemId}/{documentType}/{documentId}/{relatedDocumentId*} | Get Document file |
|---|
<?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 GetDocument implements JsonSerializable
{
public function __construct(
/** @description ERP system id, e.g. ES100 */
// @ApiMember(Description="ERP system id, e.g. ES100", IsRequired=true)
/** @var string */
public string $erpSystemId='',
/** @description Document Type, e.g. INV, CRN, RAF, RDN, CAD */
// @ApiMember(Description="Document Type, e.g. INV, CRN, RAF, RDN, CAD", IsRequired=true)
/** @var string */
public string $documentType='',
/** @description Unique Document Id, e.g. 12345 */
// @ApiMember(Description="Unique Document Id, e.g. 12345", IsRequired=true)
/** @var int */
public int $documentId=0,
/** @description Unique related Document Id, e.g. 12345 */
// @ApiMember(Description="Unique related Document Id, e.g. 12345")
/** @var int|null */
public ?int $relatedDocumentId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['erpSystemId'])) $this->erpSystemId = $o['erpSystemId'];
if (isset($o['documentType'])) $this->documentType = $o['documentType'];
if (isset($o['documentId'])) $this->documentId = $o['documentId'];
if (isset($o['relatedDocumentId'])) $this->relatedDocumentId = $o['relatedDocumentId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->erpSystemId)) $o['erpSystemId'] = $this->erpSystemId;
if (isset($this->documentType)) $o['documentType'] = $this->documentType;
if (isset($this->documentId)) $o['documentId'] = $this->documentId;
if (isset($this->relatedDocumentId)) $o['relatedDocumentId'] = $this->relatedDocumentId;
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 /document/{erpSystemId}/{documentType}/{documentId}/{relatedDocumentId*} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />