sfgboxapi

<back to all web services

TrackingAdd

Requires Authentication
The following routes are available for this service:
POST/tracking
<?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 TrackingAddResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        /** @var int */
        public int $tenantsId=0,

        // @DataMember(Order=3)
        /** @var int */
        public int $appUserId=0,

        // @DataMember(Order=4)
        /** @var int */
        public int $mediaId=0,

        // @DataMember(Order=5)
        /** @var int|null */
        public ?int $mediaPercentage=null,

        // @DataMember(Order=6)
        /** @var int|null */
        public ?int $score=null,

        // @DataMember(Order=7)
        /** @var string|null */
        public ?string $menuItems=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $entities=null,

        // @DataMember(Order=9)
        /** @var string|null */
        public ?string $ipAddresses=null,

        // @DataMember(Order=10)
        /** @var string|null */
        public ?string $country=null,

        // @DataMember(Order=11)
        /** @var DateTime */
        public DateTime $accessDateTime=new DateTime(),

        // @DataMember(Order=13)
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['tenantsId'])) $this->tenantsId = $o['tenantsId'];
        if (isset($o['appUserId'])) $this->appUserId = $o['appUserId'];
        if (isset($o['mediaId'])) $this->mediaId = $o['mediaId'];
        if (isset($o['mediaPercentage'])) $this->mediaPercentage = $o['mediaPercentage'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['menuItems'])) $this->menuItems = $o['menuItems'];
        if (isset($o['entities'])) $this->entities = $o['entities'];
        if (isset($o['ipAddresses'])) $this->ipAddresses = $o['ipAddresses'];
        if (isset($o['country'])) $this->country = $o['country'];
        if (isset($o['accessDateTime'])) $this->accessDateTime = JsonConverters::from('DateTime', $o['accessDateTime']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->tenantsId)) $o['tenantsId'] = $this->tenantsId;
        if (isset($this->appUserId)) $o['appUserId'] = $this->appUserId;
        if (isset($this->mediaId)) $o['mediaId'] = $this->mediaId;
        if (isset($this->mediaPercentage)) $o['mediaPercentage'] = $this->mediaPercentage;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->menuItems)) $o['menuItems'] = $this->menuItems;
        if (isset($this->entities)) $o['entities'] = $this->entities;
        if (isset($this->ipAddresses)) $o['ipAddresses'] = $this->ipAddresses;
        if (isset($this->country)) $o['country'] = $this->country;
        if (isset($this->accessDateTime)) $o['accessDateTime'] = JsonConverters::to('DateTime', $this->accessDateTime);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class TrackingAdd implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $tenantsId=0,

        // @DataMember(Order=3)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $appUserId=0,

        // @DataMember(Order=4)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $mediaId=0,

        // @DataMember(Order=5)
        /** @var int|null */
        public ?int $mediaPercentage=null,

        // @DataMember(Order=6)
        /** @var int|null */
        public ?int $score=null,

        // @DataMember(Order=7)
        // @Validate(Validator="NotNull")
        /** @var string */
        public string $menuItems='',

        // @DataMember(Order=8)
        // @Validate(Validator="NotNull")
        /** @var string */
        public string $entities='',

        // @DataMember(Order=9)
        /** @var string|null */
        public ?string $ipAddresses=null,

        // @DataMember(Order=10)
        /** @var string|null */
        public ?string $country=null,

        // @DataMember(Order=11)
        // @Validate(Validator="NotNull")
        /** @var DateTime */
        public DateTime $accessDateTime=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['tenantsId'])) $this->tenantsId = $o['tenantsId'];
        if (isset($o['appUserId'])) $this->appUserId = $o['appUserId'];
        if (isset($o['mediaId'])) $this->mediaId = $o['mediaId'];
        if (isset($o['mediaPercentage'])) $this->mediaPercentage = $o['mediaPercentage'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['menuItems'])) $this->menuItems = $o['menuItems'];
        if (isset($o['entities'])) $this->entities = $o['entities'];
        if (isset($o['ipAddresses'])) $this->ipAddresses = $o['ipAddresses'];
        if (isset($o['country'])) $this->country = $o['country'];
        if (isset($o['accessDateTime'])) $this->accessDateTime = JsonConverters::from('DateTime', $o['accessDateTime']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->tenantsId)) $o['tenantsId'] = $this->tenantsId;
        if (isset($this->appUserId)) $o['appUserId'] = $this->appUserId;
        if (isset($this->mediaId)) $o['mediaId'] = $this->mediaId;
        if (isset($this->mediaPercentage)) $o['mediaPercentage'] = $this->mediaPercentage;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->menuItems)) $o['menuItems'] = $this->menuItems;
        if (isset($this->entities)) $o['entities'] = $this->entities;
        if (isset($this->ipAddresses)) $o['ipAddresses'] = $this->ipAddresses;
        if (isset($this->country)) $o['country'] = $this->country;
        if (isset($this->accessDateTime)) $o['accessDateTime'] = JsonConverters::to('DateTime', $this->accessDateTime);
        return empty($o) ? new class(){} : $o;
    }
}

PHP TrackingAdd DTOs

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

HTTP + CSV

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

POST /tracking HTTP/1.1 
Host: sfgboxapi.dev.scadsoftware.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"tenantsId":0,"appUserId":0,"mediaId":0,"mediaPercentage":0,"score":0,"menuItems":"String","entities":"String","ipAddresses":"String","country":"String","accessDateTime":"\/Date(-62135596800000-0000)\/"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"tenantsId":0,"appUserId":0,"mediaId":0,"mediaPercentage":0,"score":0,"menuItems":"String","entities":"String","ipAddresses":"String","country":"String","accessDateTime":"\/Date(-62135596800000-0000)\/","responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}