DigiOffice Gateway Web Services

<back to all web services

AddStatistic

Add a statistic entity.

Requires Authentication
The following routes are available for this service:
POST/api/statistics
<?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};


enum ProgramName : string
{
    case DO4Outlook = 'DO4Outlook';
    case DO4Word = 'DO4Word';
    case DO4Excel = 'DO4Excel';
    case DO4PowerPoint = 'DO4PowerPoint';
    case ITS = 'ITS';
    case Other = 'Other';
    case DigiOfficeMobile = 'DigiOfficeMobile';
}

enum Action : string
{
    case Start = 'Start';
    case Command = 'Command';
    case NewDoc = 'NewDoc';
    case ChangeDoc = 'ChangeDoc';
    case NewVersion = 'NewVersion';
    case Send = 'Send';
    case Other = 'Other';
}

/** @description Add a statistic entity. */
// @Api(Description="Add a statistic entity.")
class AddStatistic implements JsonSerializable
{
    public function __construct(
        /** @description Computername */
        // @ApiMember(Description="Computername", IsRequired=true)
        /** @var string */
        public string $Computer='',

        /** @description Program for the statistic entry */
        // @ApiMember(Description="Program for the statistic entry", IsRequired=true)
        /** @var ProgramName|null */
        public ?ProgramName $ProgramName=null,

        /** @description Version of the program */
        // @ApiMember(Description="Version of the program")
        /** @var string|null */
        public ?string $ProgramVersion=null,

        /** @description Action of statistic */
        // @ApiMember(Description="Action of statistic", IsRequired=true)
        /** @var Action|null */
        public ?Action $Action=null,

        /** @description First parameter */
        // @ApiMember(Description="First parameter", IsRequired=true)
        /** @var string */
        public string $Param1='',

        /** @description Second parameter */
        // @ApiMember(Description="Second parameter")
        /** @var string|null */
        public ?string $Param2=null,

        /** @description Duration of action */
        // @ApiMember(Description="Duration of action")
        /** @var int|null */
        public ?int $Duration=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Computer'])) $this->Computer = $o['Computer'];
        if (isset($o['ProgramName'])) $this->ProgramName = JsonConverters::from('ProgramName', $o['ProgramName']);
        if (isset($o['ProgramVersion'])) $this->ProgramVersion = $o['ProgramVersion'];
        if (isset($o['Action'])) $this->Action = JsonConverters::from('Action', $o['Action']);
        if (isset($o['Param1'])) $this->Param1 = $o['Param1'];
        if (isset($o['Param2'])) $this->Param2 = $o['Param2'];
        if (isset($o['Duration'])) $this->Duration = $o['Duration'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Computer)) $o['Computer'] = $this->Computer;
        if (isset($this->ProgramName)) $o['ProgramName'] = JsonConverters::to('ProgramName', $this->ProgramName);
        if (isset($this->ProgramVersion)) $o['ProgramVersion'] = $this->ProgramVersion;
        if (isset($this->Action)) $o['Action'] = JsonConverters::to('Action', $this->Action);
        if (isset($this->Param1)) $o['Param1'] = $this->Param1;
        if (isset($this->Param2)) $o['Param2'] = $this->Param2;
        if (isset($this->Duration)) $o['Duration'] = $this->Duration;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AddStatistic DTOs

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

HTTP + XML

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

POST /api/statistics HTTP/1.1 
Host: test-dogw.klokgroep.nl 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<AddStatistic xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/IDB.API.DTO.Statistics.Operations">
  <Action>Start</Action>
  <Computer>String</Computer>
  <Duration>0</Duration>
  <Param1>String</Param1>
  <Param2>String</Param2>
  <ProgramName>DO4Outlook</ProgramName>
  <ProgramVersion>String</ProgramVersion>
</AddStatistic>