Cdn Public Collector's Pricing Guide (CPG) API V2

<back to all web services

GetNodeRequest

Catalog

Retrieve a node

The following routes are available for this service:
GET/GetNodeRequestWhen NodeChildrenCountLive > 0 then this is a leaf node and has Node children. If CollectibleChildrenCountLive > 0 then the node has collectible children. There is no advanced APi version for this call.
<?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 BaseResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Total=0,
        /** @var int */
        public int $OpCode=0,
        /** @var string|null */
        public ?string $ErrorText=null,
        /** @var string|null */
        public ?string $RequestTime=null,
        /** @var string|null */
        public ?string $ResponseTime=null,
        /** @var string|null */
        public ?string $TotalExecutionTime=null,
        /** @var bool|null */
        public ?bool $CachedResponse=null,
        /** @var bool|null */
        public ?bool $PermitAccess=null,
        /** @var string|null */
        public ?string $AccessDeniedMessage=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['OpCode'])) $this->OpCode = $o['OpCode'];
        if (isset($o['ErrorText'])) $this->ErrorText = $o['ErrorText'];
        if (isset($o['RequestTime'])) $this->RequestTime = $o['RequestTime'];
        if (isset($o['ResponseTime'])) $this->ResponseTime = $o['ResponseTime'];
        if (isset($o['TotalExecutionTime'])) $this->TotalExecutionTime = $o['TotalExecutionTime'];
        if (isset($o['CachedResponse'])) $this->CachedResponse = $o['CachedResponse'];
        if (isset($o['PermitAccess'])) $this->PermitAccess = $o['PermitAccess'];
        if (isset($o['AccessDeniedMessage'])) $this->AccessDeniedMessage = $o['AccessDeniedMessage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->OpCode)) $o['OpCode'] = $this->OpCode;
        if (isset($this->ErrorText)) $o['ErrorText'] = $this->ErrorText;
        if (isset($this->RequestTime)) $o['RequestTime'] = $this->RequestTime;
        if (isset($this->ResponseTime)) $o['ResponseTime'] = $this->ResponseTime;
        if (isset($this->TotalExecutionTime)) $o['TotalExecutionTime'] = $this->TotalExecutionTime;
        if (isset($this->CachedResponse)) $o['CachedResponse'] = $this->CachedResponse;
        if (isset($this->PermitAccess)) $o['PermitAccess'] = $this->PermitAccess;
        if (isset($this->AccessDeniedMessage)) $o['AccessDeniedMessage'] = $this->AccessDeniedMessage;
        return empty($o) ? new class(){} : $o;
    }
}

class NodeDto implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $FeaturedImageUrl=null,
        /** @var string|null */
        public ?string $FeaturedImageAttribution=null,
        /** @var string|null */
        public ?string $FlagCode=null,
        /** @var string|null */
        public ?string $CountryName=null,
        /** @var int */
        public int $SortingPosition=0,
        /** @var int */
        public int $NodeChildrenCountLive=0,
        /** @var int */
        public int $CollectibleChildrenCountLive=0,
        /** @var int|null */
        public ?int $ParentNode_Id=null,
        /** @var int|null */
        public ?int $RootNode_Id=null,
        /** @var array<NodeDto>|null */
        public ?array $ChildNodes=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['FeaturedImageUrl'])) $this->FeaturedImageUrl = $o['FeaturedImageUrl'];
        if (isset($o['FeaturedImageAttribution'])) $this->FeaturedImageAttribution = $o['FeaturedImageAttribution'];
        if (isset($o['FlagCode'])) $this->FlagCode = $o['FlagCode'];
        if (isset($o['CountryName'])) $this->CountryName = $o['CountryName'];
        if (isset($o['SortingPosition'])) $this->SortingPosition = $o['SortingPosition'];
        if (isset($o['NodeChildrenCountLive'])) $this->NodeChildrenCountLive = $o['NodeChildrenCountLive'];
        if (isset($o['CollectibleChildrenCountLive'])) $this->CollectibleChildrenCountLive = $o['CollectibleChildrenCountLive'];
        if (isset($o['ParentNode_Id'])) $this->ParentNode_Id = $o['ParentNode_Id'];
        if (isset($o['RootNode_Id'])) $this->RootNode_Id = $o['RootNode_Id'];
        if (isset($o['ChildNodes'])) $this->ChildNodes = JsonConverters::fromArray('NodeDto', $o['ChildNodes']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->FeaturedImageUrl)) $o['FeaturedImageUrl'] = $this->FeaturedImageUrl;
        if (isset($this->FeaturedImageAttribution)) $o['FeaturedImageAttribution'] = $this->FeaturedImageAttribution;
        if (isset($this->FlagCode)) $o['FlagCode'] = $this->FlagCode;
        if (isset($this->CountryName)) $o['CountryName'] = $this->CountryName;
        if (isset($this->SortingPosition)) $o['SortingPosition'] = $this->SortingPosition;
        if (isset($this->NodeChildrenCountLive)) $o['NodeChildrenCountLive'] = $this->NodeChildrenCountLive;
        if (isset($this->CollectibleChildrenCountLive)) $o['CollectibleChildrenCountLive'] = $this->CollectibleChildrenCountLive;
        if (isset($this->ParentNode_Id)) $o['ParentNode_Id'] = $this->ParentNode_Id;
        if (isset($this->RootNode_Id)) $o['RootNode_Id'] = $this->RootNode_Id;
        if (isset($this->ChildNodes)) $o['ChildNodes'] = JsonConverters::toArray('NodeDto', $this->ChildNodes);
        return empty($o) ? new class(){} : $o;
    }
}

class NodeResponse extends BaseResponse implements JsonSerializable
{
    /**
     * @param int $Total
     * @param int $OpCode
     * @param string|null $ErrorText
     * @param string|null $RequestTime
     * @param string|null $ResponseTime
     * @param string|null $TotalExecutionTime
     * @param bool|null $CachedResponse
     * @param bool|null $PermitAccess
     * @param string|null $AccessDeniedMessage
     */
    public function __construct(
        int $Total=0,
        int $OpCode=0,
        ?string $ErrorText=null,
        ?string $RequestTime=null,
        ?string $ResponseTime=null,
        ?string $TotalExecutionTime=null,
        ?bool $CachedResponse=null,
        ?bool $PermitAccess=null,
        ?string $AccessDeniedMessage=null,
        /** @var array<NodeDto>|null */
        public ?array $Data=null
    ) {
        parent::__construct($Total,$OpCode,$ErrorText,$RequestTime,$ResponseTime,$TotalExecutionTime,$CachedResponse,$PermitAccess,$AccessDeniedMessage);
    }

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

/** @description Retrieve a node */
// @Api(Description="Retrieve a node")
class GetNodeRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $NodeId=0
    ) {
    }

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

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

GET /GetNodeRequest HTTP/1.1 
Host: cpgpublicapiv2dev.greysheet.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<NodeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Cdn.PublicApiV2.ResponseObjects">
  <AccessDeniedMessage>String</AccessDeniedMessage>
  <CachedResponse>false</CachedResponse>
  <ErrorText>String</ErrorText>
  <OpCode>0</OpCode>
  <PermitAccess>false</PermitAccess>
  <RequestTime>String</RequestTime>
  <ResponseTime>String</ResponseTime>
  <Total>0</Total>
  <TotalExecutionTime>String</TotalExecutionTime>
  <Data xmlns:d2p1="http://schemas.datacontract.org/2004/07/Cdn.PublicApiV2.Dto">
    <d2p1:NodeDto>
      <d2p1:ChildNodes>
        <d2p1:NodeDto>
          <d2p1:ChildNodes>
            <d2p1:NodeDto>
              <d2p1:ChildNodes i:nil="true" />
              <d2p1:CollectibleChildrenCountLive>0</d2p1:CollectibleChildrenCountLive>
              <d2p1:CountryName>String</d2p1:CountryName>
              <d2p1:Description>String</d2p1:Description>
              <d2p1:FeaturedImageAttribution>String</d2p1:FeaturedImageAttribution>
              <d2p1:FeaturedImageUrl>String</d2p1:FeaturedImageUrl>
              <d2p1:FlagCode>String</d2p1:FlagCode>
              <d2p1:Id>0</d2p1:Id>
              <d2p1:Name>String</d2p1:Name>
              <d2p1:NodeChildrenCountLive>0</d2p1:NodeChildrenCountLive>
              <d2p1:ParentNode_Id>0</d2p1:ParentNode_Id>
              <d2p1:RootNode_Id>0</d2p1:RootNode_Id>
              <d2p1:SortingPosition>0</d2p1:SortingPosition>
            </d2p1:NodeDto>
          </d2p1:ChildNodes>
          <d2p1:CollectibleChildrenCountLive>0</d2p1:CollectibleChildrenCountLive>
          <d2p1:CountryName>String</d2p1:CountryName>
          <d2p1:Description>String</d2p1:Description>
          <d2p1:FeaturedImageAttribution>String</d2p1:FeaturedImageAttribution>
          <d2p1:FeaturedImageUrl>String</d2p1:FeaturedImageUrl>
          <d2p1:FlagCode>String</d2p1:FlagCode>
          <d2p1:Id>0</d2p1:Id>
          <d2p1:Name>String</d2p1:Name>
          <d2p1:NodeChildrenCountLive>0</d2p1:NodeChildrenCountLive>
          <d2p1:ParentNode_Id>0</d2p1:ParentNode_Id>
          <d2p1:RootNode_Id>0</d2p1:RootNode_Id>
          <d2p1:SortingPosition>0</d2p1:SortingPosition>
        </d2p1:NodeDto>
      </d2p1:ChildNodes>
      <d2p1:CollectibleChildrenCountLive>0</d2p1:CollectibleChildrenCountLive>
      <d2p1:CountryName>String</d2p1:CountryName>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:FeaturedImageAttribution>String</d2p1:FeaturedImageAttribution>
      <d2p1:FeaturedImageUrl>String</d2p1:FeaturedImageUrl>
      <d2p1:FlagCode>String</d2p1:FlagCode>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:NodeChildrenCountLive>0</d2p1:NodeChildrenCountLive>
      <d2p1:ParentNode_Id>0</d2p1:ParentNode_Id>
      <d2p1:RootNode_Id>0</d2p1:RootNode_Id>
      <d2p1:SortingPosition>0</d2p1:SortingPosition>
    </d2p1:NodeDto>
  </Data>
</NodeResponse>