DigiOffice API Services Services

<back to all web services

GetDocumentByNumber

Get the details of a document by reference number

Requires Authentication
The following routes are available for this service:
POST/api/documents/number
<?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 Document implements ICustomProperties, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ID='',
        /** @var string */
        public string $RootDocumentID='',
        /** @var string */
        public string $RegistrationprofileID='',
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $FullTitle=null,
        /** @var string|null */
        public ?string $Number=null,
        /** @var string|null */
        public ?string $Version=null,
        /** @var string|null */
        public ?string $ExternalNumber=null,
        /** @var string|null */
        public ?string $ExternalVersion=null,
        /** @var string|null */
        public ?string $InternalNumber=null,
        /** @var string|null */
        public ?string $InternalInvoiceNumber=null,
        /** @var int */
        public int $PersonID=0,
        /** @var int */
        public int $RelationID=0,
        /** @var string|null */
        public ?string $RelationTitle=null,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectTitle=null,
        /** @var string|null */
        public ?string $Extension=null,
        /** @var DateTime|null */
        public ?DateTime $Date=null,
        /** @var int */
        public int $CommentsCount=0,
        /** @var bool|null */
        public ?bool $HasComments=null,
        /** @var bool|null */
        public ?bool $HasPreview=null,
        /** @var string|null */
        public ?string $ExtraField=null,
        /** @var bool|null */
        public ?bool $IsFavorite=null,
        /** @var string|null */
        public ?string $DocumentcategoryText=null,
        /** @var int|null */
        public ?int $FileSize=null,
        /** @var DateTime|null */
        public ?DateTime $FileDate=null,
        /** @var string|null */
        public ?string $Hash=null,
        /** @var string|null */
        public ?string $HashType=null,
        /** @var string|null */
        public ?string $FileUrl=null,
        /** @var string|null */
        public ?string $StandardDocumentUrl=null,
        /** @var bool|null */
        public ?bool $IsCorporateIdentity=null,
        /** @var string|null */
        public ?string $UserTitle=null,
        /** @var bool|null */
        public ?bool $IsFrozen=null,
        /** @var int */
        public int $InternalCompanyID=0,
        /** @var int|null */
        public ?int $InternalLocationID=null,
        /** @var int|null */
        public ?int $LanguageID=null,
        /** @var string|null */
        public ?string $DirectUrl=null,
        /** @var bool|null */
        public ?bool $AllowDigitalSigningOnlyOnPrimaryVersions=null,
        /** @var bool|null */
        public ?bool $IsPrimaryVersion=null,
        /** @var string|null */
        public ?string $FileExtension=null,
        /** @var array<string,Object>|null */
        public ?array $CustomProperties=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['RootDocumentID'])) $this->RootDocumentID = $o['RootDocumentID'];
        if (isset($o['RegistrationprofileID'])) $this->RegistrationprofileID = $o['RegistrationprofileID'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['FullTitle'])) $this->FullTitle = $o['FullTitle'];
        if (isset($o['Number'])) $this->Number = $o['Number'];
        if (isset($o['Version'])) $this->Version = $o['Version'];
        if (isset($o['ExternalNumber'])) $this->ExternalNumber = $o['ExternalNumber'];
        if (isset($o['ExternalVersion'])) $this->ExternalVersion = $o['ExternalVersion'];
        if (isset($o['InternalNumber'])) $this->InternalNumber = $o['InternalNumber'];
        if (isset($o['InternalInvoiceNumber'])) $this->InternalInvoiceNumber = $o['InternalInvoiceNumber'];
        if (isset($o['PersonID'])) $this->PersonID = $o['PersonID'];
        if (isset($o['RelationID'])) $this->RelationID = $o['RelationID'];
        if (isset($o['RelationTitle'])) $this->RelationTitle = $o['RelationTitle'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectTitle'])) $this->ProjectTitle = $o['ProjectTitle'];
        if (isset($o['Extension'])) $this->Extension = $o['Extension'];
        if (isset($o['Date'])) $this->Date = JsonConverters::from('DateTime', $o['Date']);
        if (isset($o['CommentsCount'])) $this->CommentsCount = $o['CommentsCount'];
        if (isset($o['HasComments'])) $this->HasComments = $o['HasComments'];
        if (isset($o['HasPreview'])) $this->HasPreview = $o['HasPreview'];
        if (isset($o['ExtraField'])) $this->ExtraField = $o['ExtraField'];
        if (isset($o['IsFavorite'])) $this->IsFavorite = $o['IsFavorite'];
        if (isset($o['DocumentcategoryText'])) $this->DocumentcategoryText = $o['DocumentcategoryText'];
        if (isset($o['FileSize'])) $this->FileSize = $o['FileSize'];
        if (isset($o['FileDate'])) $this->FileDate = JsonConverters::from('DateTime', $o['FileDate']);
        if (isset($o['Hash'])) $this->Hash = $o['Hash'];
        if (isset($o['HashType'])) $this->HashType = $o['HashType'];
        if (isset($o['FileUrl'])) $this->FileUrl = $o['FileUrl'];
        if (isset($o['StandardDocumentUrl'])) $this->StandardDocumentUrl = $o['StandardDocumentUrl'];
        if (isset($o['IsCorporateIdentity'])) $this->IsCorporateIdentity = $o['IsCorporateIdentity'];
        if (isset($o['UserTitle'])) $this->UserTitle = $o['UserTitle'];
        if (isset($o['IsFrozen'])) $this->IsFrozen = $o['IsFrozen'];
        if (isset($o['InternalCompanyID'])) $this->InternalCompanyID = $o['InternalCompanyID'];
        if (isset($o['InternalLocationID'])) $this->InternalLocationID = $o['InternalLocationID'];
        if (isset($o['LanguageID'])) $this->LanguageID = $o['LanguageID'];
        if (isset($o['DirectUrl'])) $this->DirectUrl = $o['DirectUrl'];
        if (isset($o['AllowDigitalSigningOnlyOnPrimaryVersions'])) $this->AllowDigitalSigningOnlyOnPrimaryVersions = $o['AllowDigitalSigningOnlyOnPrimaryVersions'];
        if (isset($o['IsPrimaryVersion'])) $this->IsPrimaryVersion = $o['IsPrimaryVersion'];
        if (isset($o['FileExtension'])) $this->FileExtension = $o['FileExtension'];
        if (isset($o['CustomProperties'])) $this->CustomProperties = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['CustomProperties']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->RootDocumentID)) $o['RootDocumentID'] = $this->RootDocumentID;
        if (isset($this->RegistrationprofileID)) $o['RegistrationprofileID'] = $this->RegistrationprofileID;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->FullTitle)) $o['FullTitle'] = $this->FullTitle;
        if (isset($this->Number)) $o['Number'] = $this->Number;
        if (isset($this->Version)) $o['Version'] = $this->Version;
        if (isset($this->ExternalNumber)) $o['ExternalNumber'] = $this->ExternalNumber;
        if (isset($this->ExternalVersion)) $o['ExternalVersion'] = $this->ExternalVersion;
        if (isset($this->InternalNumber)) $o['InternalNumber'] = $this->InternalNumber;
        if (isset($this->InternalInvoiceNumber)) $o['InternalInvoiceNumber'] = $this->InternalInvoiceNumber;
        if (isset($this->PersonID)) $o['PersonID'] = $this->PersonID;
        if (isset($this->RelationID)) $o['RelationID'] = $this->RelationID;
        if (isset($this->RelationTitle)) $o['RelationTitle'] = $this->RelationTitle;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectTitle)) $o['ProjectTitle'] = $this->ProjectTitle;
        if (isset($this->Extension)) $o['Extension'] = $this->Extension;
        if (isset($this->Date)) $o['Date'] = JsonConverters::to('DateTime', $this->Date);
        if (isset($this->CommentsCount)) $o['CommentsCount'] = $this->CommentsCount;
        if (isset($this->HasComments)) $o['HasComments'] = $this->HasComments;
        if (isset($this->HasPreview)) $o['HasPreview'] = $this->HasPreview;
        if (isset($this->ExtraField)) $o['ExtraField'] = $this->ExtraField;
        if (isset($this->IsFavorite)) $o['IsFavorite'] = $this->IsFavorite;
        if (isset($this->DocumentcategoryText)) $o['DocumentcategoryText'] = $this->DocumentcategoryText;
        if (isset($this->FileSize)) $o['FileSize'] = $this->FileSize;
        if (isset($this->FileDate)) $o['FileDate'] = JsonConverters::to('DateTime', $this->FileDate);
        if (isset($this->Hash)) $o['Hash'] = $this->Hash;
        if (isset($this->HashType)) $o['HashType'] = $this->HashType;
        if (isset($this->FileUrl)) $o['FileUrl'] = $this->FileUrl;
        if (isset($this->StandardDocumentUrl)) $o['StandardDocumentUrl'] = $this->StandardDocumentUrl;
        if (isset($this->IsCorporateIdentity)) $o['IsCorporateIdentity'] = $this->IsCorporateIdentity;
        if (isset($this->UserTitle)) $o['UserTitle'] = $this->UserTitle;
        if (isset($this->IsFrozen)) $o['IsFrozen'] = $this->IsFrozen;
        if (isset($this->InternalCompanyID)) $o['InternalCompanyID'] = $this->InternalCompanyID;
        if (isset($this->InternalLocationID)) $o['InternalLocationID'] = $this->InternalLocationID;
        if (isset($this->LanguageID)) $o['LanguageID'] = $this->LanguageID;
        if (isset($this->DirectUrl)) $o['DirectUrl'] = $this->DirectUrl;
        if (isset($this->AllowDigitalSigningOnlyOnPrimaryVersions)) $o['AllowDigitalSigningOnlyOnPrimaryVersions'] = $this->AllowDigitalSigningOnlyOnPrimaryVersions;
        if (isset($this->IsPrimaryVersion)) $o['IsPrimaryVersion'] = $this->IsPrimaryVersion;
        if (isset($this->FileExtension)) $o['FileExtension'] = $this->FileExtension;
        if (isset($this->CustomProperties)) $o['CustomProperties'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->CustomProperties);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Get the details of a document by reference number */
// @Api(Description="Get the details of a document by reference number")
class GetDocumentByNumber implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Number=null,
        /** @var string|null */
        public ?string $Version=null
    ) {
    }

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

PHP GetDocumentByNumber DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/documents/number HTTP/1.1 
Host: test-do-services.klokgroep.nl 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Number":"String","Version":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ID":"00000000-0000-0000-0000-000000000000","RootDocumentID":"00000000-0000-0000-0000-000000000000","RegistrationprofileID":"00000000-0000-0000-0000-000000000000","Title":"String","FullTitle":"String","Number":"String","Version":"String","ExternalNumber":"String","ExternalVersion":"String","InternalNumber":"String","InternalInvoiceNumber":"String","PersonID":0,"RelationID":0,"RelationTitle":"String","ProjectID":0,"ProjectTitle":"String","Extension":"String","Date":"0001-01-01T00:00:00.0000000","CommentsCount":0,"HasComments":false,"HasPreview":false,"ExtraField":"String","IsFavorite":false,"DocumentcategoryText":"String","FileSize":0,"FileDate":"0001-01-01T00:00:00.0000000","Hash":"String","HashType":"String","FileUrl":"String","StandardDocumentUrl":"String","IsCorporateIdentity":false,"UserTitle":"String","IsFrozen":false,"InternalCompanyID":0,"InternalLocationID":0,"LanguageID":0,"DirectUrl":"String","AllowDigitalSigningOnlyOnPrimaryVersions":false,"IsPrimaryVersion":false,"FileExtension":"String","CustomProperties":{"String":{}}}