ShortlinksAPI

<back to all web services

GetShortLinkMetadataRequest

Requires Authentication
The following routes are available for this service:
GET/v4/links/metadata/{baseCode}
<?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};


// @DataContract
class ShortUrlAlias implements IShortUrlAlias, JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string|null */
        public ?string $code=null,

        // @DataMember
        /** @var string|null */
        public ?string $domain=null,

        // @DataMember
        /** @var string|null */
        public ?string $baseCode=null,

        // @DataMember
        /** @var DateTime */
        public DateTime $lastUpdatedUtc=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['domain'])) $this->domain = $o['domain'];
        if (isset($o['baseCode'])) $this->baseCode = $o['baseCode'];
        if (isset($o['lastUpdatedUtc'])) $this->lastUpdatedUtc = JsonConverters::from('DateTime', $o['lastUpdatedUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->domain)) $o['domain'] = $this->domain;
        if (isset($this->baseCode)) $o['baseCode'] = $this->baseCode;
        if (isset($this->lastUpdatedUtc)) $o['lastUpdatedUtc'] = JsonConverters::to('DateTime', $this->lastUpdatedUtc);
        return empty($o) ? new class(){} : $o;
    }
}

enum LinkCreatorOption : string
{
    case NotSet = 'NotSet';
    case Simple = 'Simple';
    case Split = 'Split';
    case Advanced = 'Advanced';
    case Interstitial = 'Interstitial';
    case Other = 'Other';
}

// @DataContract
class UserShortLink implements IUserShortLink, JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var int */
        public int $id=0,

        // @DataMember
        /** @var string|null */
        public ?string $destinationUrl=null,

        // @DataMember
        /** @var string|null */
        public ?string $shortUrlCode=null,

        // @DataMember
        /** @var string|null */
        public ?string $domain=null,

        // @DataMember
        /** @var string|null */
        public ?string $linkType=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $hasOverride=null,

        // @DataMember
        /** @var string|null */
        public ?string $productUrl=null,

        // @DataMember
        /** @var string|null */
        public ?string $trackingCode=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $skipAffiliateRedirect=null,

        // @DataMember
        /** @var DateTime */
        public DateTime $createdUtc=new DateTime(),

        // @DataMember
        /** @var DateTime */
        public DateTime $updatedUtc=new DateTime(),

        // @DataMember
        /** @var string|null */
        public ?string $notes=null,

        // @DataMember
        /** @var DateTime */
        public DateTime $createdUserTime=new DateTime(),

        // @DataMember
        /** @var DateTime */
        public DateTime $updatedUserTime=new DateTime(),

        // @DataMember
        /** @var int|null */
        public ?int $tsid=null,

        // @DataMember
        /** @var string|null */
        public ?string $group=null,

        // @DataMember
        /** @var string|null */
        public ?string $username=null,

        // @DataMember
        /** @var string|null */
        public ?string $jsonMetadata=null,

        // @DataMember
        /** @var string|null */
        public ?string $jsonItemMetadata=null,

        // @DataMember
        /** @var string|null */
        public ?string $jsonPostProcessingRules=null,

        // @DataMember
        /** @var string|null */
        public ?string $jsonOverrides=null,

        // @DataMember
        /** @var float */
        public float $totalClicks=0.0,

        // @DataMember
        /** @var string|null */
        public ?string $advertiser=null,

        // @DataMember
        /** @var int */
        public int $advertiserId=0,

        // @DataMember
        /** @var float */
        public float $percentChangePeriodOverPeriod=0.0,

        // @DataMember
        /** @var float */
        public float $previousPeriodTotalClicks=0.0,

        // @DataMember
        /** @var int */
        public int $isArchived=0,

        // @DataMember
        /** @var int */
        public int $isArchivedInt=0,

        // @DataMember
        /** @var bool|null */
        public ?bool $fetchMetadata=null,

        // @DataMember
        /** @var string|null */
        public ?string $productDisplayName1=null,

        // @DataMember
        /** @var string|null */
        public ?string $productDisplayName2=null,

        // @DataMember
        /** @var string|null */
        public ?string $productDisplayName3=null,

        // @DataMember
        /** @var string|null */
        public ?string $productArtworkThumbnailUrl=null,

        // @DataMember
        /** @var string|null */
        public ?string $productArtworkThumbnailUrl100=null,

        // @DataMember
        /** @var string|null */
        public ?string $advertiserIcon=null,

        // @DataMember
        /** @var string|null */
        public ?string $advertiserIconCssClass=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $isGenius=null,

        // @DataMember
        /** @var string|null */
        public ?string $advertiserIconTitle=null,

        // @DataMember
        /** @var string|null */
        public ?string $trackingPixelIds=null,

        // @DataMember
        /** @var int */
        public int $applePreference=0,

        // @DataMember
        /** @var array<ShortUrlAlias>|null */
        public ?array $aliases=null,

        // @DataMember
        /** @var LinkCreatorOption|null */
        public ?LinkCreatorOption $linkCreatorSetting=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['destinationUrl'])) $this->destinationUrl = $o['destinationUrl'];
        if (isset($o['shortUrlCode'])) $this->shortUrlCode = $o['shortUrlCode'];
        if (isset($o['domain'])) $this->domain = $o['domain'];
        if (isset($o['linkType'])) $this->linkType = $o['linkType'];
        if (isset($o['hasOverride'])) $this->hasOverride = $o['hasOverride'];
        if (isset($o['productUrl'])) $this->productUrl = $o['productUrl'];
        if (isset($o['trackingCode'])) $this->trackingCode = $o['trackingCode'];
        if (isset($o['skipAffiliateRedirect'])) $this->skipAffiliateRedirect = $o['skipAffiliateRedirect'];
        if (isset($o['createdUtc'])) $this->createdUtc = JsonConverters::from('DateTime', $o['createdUtc']);
        if (isset($o['updatedUtc'])) $this->updatedUtc = JsonConverters::from('DateTime', $o['updatedUtc']);
        if (isset($o['notes'])) $this->notes = $o['notes'];
        if (isset($o['createdUserTime'])) $this->createdUserTime = JsonConverters::from('DateTime', $o['createdUserTime']);
        if (isset($o['updatedUserTime'])) $this->updatedUserTime = JsonConverters::from('DateTime', $o['updatedUserTime']);
        if (isset($o['tsid'])) $this->tsid = $o['tsid'];
        if (isset($o['group'])) $this->group = $o['group'];
        if (isset($o['username'])) $this->username = $o['username'];
        if (isset($o['jsonMetadata'])) $this->jsonMetadata = $o['jsonMetadata'];
        if (isset($o['jsonItemMetadata'])) $this->jsonItemMetadata = $o['jsonItemMetadata'];
        if (isset($o['jsonPostProcessingRules'])) $this->jsonPostProcessingRules = $o['jsonPostProcessingRules'];
        if (isset($o['jsonOverrides'])) $this->jsonOverrides = $o['jsonOverrides'];
        if (isset($o['totalClicks'])) $this->totalClicks = $o['totalClicks'];
        if (isset($o['advertiser'])) $this->advertiser = $o['advertiser'];
        if (isset($o['advertiserId'])) $this->advertiserId = $o['advertiserId'];
        if (isset($o['percentChangePeriodOverPeriod'])) $this->percentChangePeriodOverPeriod = $o['percentChangePeriodOverPeriod'];
        if (isset($o['previousPeriodTotalClicks'])) $this->previousPeriodTotalClicks = $o['previousPeriodTotalClicks'];
        if (isset($o['isArchived'])) $this->isArchived = $o['isArchived'];
        if (isset($o['isArchivedInt'])) $this->isArchivedInt = $o['isArchivedInt'];
        if (isset($o['fetchMetadata'])) $this->fetchMetadata = $o['fetchMetadata'];
        if (isset($o['productDisplayName1'])) $this->productDisplayName1 = $o['productDisplayName1'];
        if (isset($o['productDisplayName2'])) $this->productDisplayName2 = $o['productDisplayName2'];
        if (isset($o['productDisplayName3'])) $this->productDisplayName3 = $o['productDisplayName3'];
        if (isset($o['productArtworkThumbnailUrl'])) $this->productArtworkThumbnailUrl = $o['productArtworkThumbnailUrl'];
        if (isset($o['productArtworkThumbnailUrl100'])) $this->productArtworkThumbnailUrl100 = $o['productArtworkThumbnailUrl100'];
        if (isset($o['advertiserIcon'])) $this->advertiserIcon = $o['advertiserIcon'];
        if (isset($o['advertiserIconCssClass'])) $this->advertiserIconCssClass = $o['advertiserIconCssClass'];
        if (isset($o['isGenius'])) $this->isGenius = $o['isGenius'];
        if (isset($o['advertiserIconTitle'])) $this->advertiserIconTitle = $o['advertiserIconTitle'];
        if (isset($o['trackingPixelIds'])) $this->trackingPixelIds = $o['trackingPixelIds'];
        if (isset($o['applePreference'])) $this->applePreference = $o['applePreference'];
        if (isset($o['aliases'])) $this->aliases = JsonConverters::fromArray('ShortUrlAlias', $o['aliases']);
        if (isset($o['linkCreatorSetting'])) $this->linkCreatorSetting = JsonConverters::from('LinkCreatorOption', $o['linkCreatorSetting']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->destinationUrl)) $o['destinationUrl'] = $this->destinationUrl;
        if (isset($this->shortUrlCode)) $o['shortUrlCode'] = $this->shortUrlCode;
        if (isset($this->domain)) $o['domain'] = $this->domain;
        if (isset($this->linkType)) $o['linkType'] = $this->linkType;
        if (isset($this->hasOverride)) $o['hasOverride'] = $this->hasOverride;
        if (isset($this->productUrl)) $o['productUrl'] = $this->productUrl;
        if (isset($this->trackingCode)) $o['trackingCode'] = $this->trackingCode;
        if (isset($this->skipAffiliateRedirect)) $o['skipAffiliateRedirect'] = $this->skipAffiliateRedirect;
        if (isset($this->createdUtc)) $o['createdUtc'] = JsonConverters::to('DateTime', $this->createdUtc);
        if (isset($this->updatedUtc)) $o['updatedUtc'] = JsonConverters::to('DateTime', $this->updatedUtc);
        if (isset($this->notes)) $o['notes'] = $this->notes;
        if (isset($this->createdUserTime)) $o['createdUserTime'] = JsonConverters::to('DateTime', $this->createdUserTime);
        if (isset($this->updatedUserTime)) $o['updatedUserTime'] = JsonConverters::to('DateTime', $this->updatedUserTime);
        if (isset($this->tsid)) $o['tsid'] = $this->tsid;
        if (isset($this->group)) $o['group'] = $this->group;
        if (isset($this->username)) $o['username'] = $this->username;
        if (isset($this->jsonMetadata)) $o['jsonMetadata'] = $this->jsonMetadata;
        if (isset($this->jsonItemMetadata)) $o['jsonItemMetadata'] = $this->jsonItemMetadata;
        if (isset($this->jsonPostProcessingRules)) $o['jsonPostProcessingRules'] = $this->jsonPostProcessingRules;
        if (isset($this->jsonOverrides)) $o['jsonOverrides'] = $this->jsonOverrides;
        if (isset($this->totalClicks)) $o['totalClicks'] = $this->totalClicks;
        if (isset($this->advertiser)) $o['advertiser'] = $this->advertiser;
        if (isset($this->advertiserId)) $o['advertiserId'] = $this->advertiserId;
        if (isset($this->percentChangePeriodOverPeriod)) $o['percentChangePeriodOverPeriod'] = $this->percentChangePeriodOverPeriod;
        if (isset($this->previousPeriodTotalClicks)) $o['previousPeriodTotalClicks'] = $this->previousPeriodTotalClicks;
        if (isset($this->isArchived)) $o['isArchived'] = $this->isArchived;
        if (isset($this->isArchivedInt)) $o['isArchivedInt'] = $this->isArchivedInt;
        if (isset($this->fetchMetadata)) $o['fetchMetadata'] = $this->fetchMetadata;
        if (isset($this->productDisplayName1)) $o['productDisplayName1'] = $this->productDisplayName1;
        if (isset($this->productDisplayName2)) $o['productDisplayName2'] = $this->productDisplayName2;
        if (isset($this->productDisplayName3)) $o['productDisplayName3'] = $this->productDisplayName3;
        if (isset($this->productArtworkThumbnailUrl)) $o['productArtworkThumbnailUrl'] = $this->productArtworkThumbnailUrl;
        if (isset($this->productArtworkThumbnailUrl100)) $o['productArtworkThumbnailUrl100'] = $this->productArtworkThumbnailUrl100;
        if (isset($this->advertiserIcon)) $o['advertiserIcon'] = $this->advertiserIcon;
        if (isset($this->advertiserIconCssClass)) $o['advertiserIconCssClass'] = $this->advertiserIconCssClass;
        if (isset($this->isGenius)) $o['isGenius'] = $this->isGenius;
        if (isset($this->advertiserIconTitle)) $o['advertiserIconTitle'] = $this->advertiserIconTitle;
        if (isset($this->trackingPixelIds)) $o['trackingPixelIds'] = $this->trackingPixelIds;
        if (isset($this->applePreference)) $o['applePreference'] = $this->applePreference;
        if (isset($this->aliases)) $o['aliases'] = JsonConverters::toArray('ShortUrlAlias', $this->aliases);
        if (isset($this->linkCreatorSetting)) $o['linkCreatorSetting'] = JsonConverters::to('LinkCreatorOption', $this->linkCreatorSetting);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class GetShortLinkMetadataResponse implements IGetShortLinkMetadataResponse, JsonSerializable
{
    public function __construct(
        // @DataMember(Name="responseStatus")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,

        // @DataMember(Name="data")
        /** @var UserShortLink|null */
        public ?UserShortLink $data=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['data'])) $this->data = JsonConverters::from('UserShortLink', $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->data)) $o['data'] = JsonConverters::to('UserShortLink', $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class GetShortLinkMetadataRequest implements IGetShortLinkMetadataRequest, JsonSerializable
{
    public function __construct(
        // @DataMember(Name="baseCode")
        /** @var string|null */
        public ?string $baseCode=null
    ) {
    }

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

PHP GetShortLinkMetadataRequest 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.

GET /v4/links/metadata/{baseCode} HTTP/1.1 
Host: shortlinks-api.qa.platform.georiot.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"data":{"id":0,"destinationUrl":"String","shortUrlCode":"String","domain":"String","linkType":"NotSet","hasOverride":false,"productUrl":"String","trackingCode":"String","skipAffiliateRedirect":false,"createdUtc":"0001-01-01T00:00:00.0000000","updatedUtc":"0001-01-01T00:00:00.0000000","notes":"String","createdUserTime":"0001-01-01T00:00:00.0000000","updatedUserTime":"0001-01-01T00:00:00.0000000","tsid":0,"group":"String","username":"String","jsonMetadata":"String","jsonItemMetadata":"String","jsonPostProcessingRules":"String","jsonOverrides":"String","totalClicks":0,"advertiser":"String","advertiserId":0,"percentChangePeriodOverPeriod":0,"previousPeriodTotalClicks":0,"isArchived":0,"isArchivedInt":0,"fetchMetadata":false,"productDisplayName1":"String","productDisplayName2":"String","productDisplayName3":"String","productArtworkThumbnailUrl":"String","productArtworkThumbnailUrl100":"String","advertiserIcon":"String","advertiserIconCssClass":"String","isGenius":false,"advertiserIconTitle":"String","trackingPixelIds":"String","applePreference":0,"aliases":[{"code":"String","domain":"String","baseCode":"String","lastUpdatedUtc":"0001-01-01T00:00:00.0000000"}],"linkCreatorSetting":"NotSet"}}