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

<back to all web services

GetPricingRequest

Pricing

Retrieve pricing data for a collectible.

The following routes are available for this service:
GET/GetPricingRequestGsid or Pcgs Number is required. Grade, MinGrade and MaxGrade are optional. Specify ApiLevel=Advanced for additional collectible information.
<?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 CdnPricingItemDto implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Grade=0,
        /** @var string|null */
        public ?string $GradeLabel=null,
        /** @var bool|null */
        public ?bool $IsCac=null,
        /** @var string|null */
        public ?string $CpgVal=null,
        /** @var string|null */
        public ?string $GreyVal=null,
        /** @var string|null */
        public ?string $PcgsVal=null,
        /** @var string|null */
        public ?string $NgcVal=null,
        /** @var string|null */
        public ?string $BlueBookVal=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Grade'])) $this->Grade = $o['Grade'];
        if (isset($o['GradeLabel'])) $this->GradeLabel = $o['GradeLabel'];
        if (isset($o['IsCac'])) $this->IsCac = $o['IsCac'];
        if (isset($o['CpgVal'])) $this->CpgVal = $o['CpgVal'];
        if (isset($o['GreyVal'])) $this->GreyVal = $o['GreyVal'];
        if (isset($o['PcgsVal'])) $this->PcgsVal = $o['PcgsVal'];
        if (isset($o['NgcVal'])) $this->NgcVal = $o['NgcVal'];
        if (isset($o['BlueBookVal'])) $this->BlueBookVal = $o['BlueBookVal'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Grade)) $o['Grade'] = $this->Grade;
        if (isset($this->GradeLabel)) $o['GradeLabel'] = $this->GradeLabel;
        if (isset($this->IsCac)) $o['IsCac'] = $this->IsCac;
        if (isset($this->CpgVal)) $o['CpgVal'] = $this->CpgVal;
        if (isset($this->GreyVal)) $o['GreyVal'] = $this->GreyVal;
        if (isset($this->PcgsVal)) $o['PcgsVal'] = $this->PcgsVal;
        if (isset($this->NgcVal)) $o['NgcVal'] = $this->NgcVal;
        if (isset($this->BlueBookVal)) $o['BlueBookVal'] = $this->BlueBookVal;
        return empty($o) ? new class(){} : $o;
    }
}

class CdnPricingDataDto implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $GsId=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var int */
        public int $SortingPosition=0,
        /** @var bool|null */
        public ?bool $IsType=null,
        /** @var bool|null */
        public ?bool $IsSet=null,
        /** @var int */
        public int $UiParentId=0,
        /** @var array<CdnPricingItemDto>|null */
        public ?array $PricingData=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['GsId'])) $this->GsId = $o['GsId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['SortingPosition'])) $this->SortingPosition = $o['SortingPosition'];
        if (isset($o['IsType'])) $this->IsType = $o['IsType'];
        if (isset($o['IsSet'])) $this->IsSet = $o['IsSet'];
        if (isset($o['UiParentId'])) $this->UiParentId = $o['UiParentId'];
        if (isset($o['PricingData'])) $this->PricingData = JsonConverters::fromArray('CdnPricingItemDto', $o['PricingData']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->GsId)) $o['GsId'] = $this->GsId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->SortingPosition)) $o['SortingPosition'] = $this->SortingPosition;
        if (isset($this->IsType)) $o['IsType'] = $this->IsType;
        if (isset($this->IsSet)) $o['IsSet'] = $this->IsSet;
        if (isset($this->UiParentId)) $o['UiParentId'] = $this->UiParentId;
        if (isset($this->PricingData)) $o['PricingData'] = JsonConverters::toArray('CdnPricingItemDto', $this->PricingData);
        return empty($o) ? new class(){} : $o;
    }
}

class GetPricingResponse 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<CdnPricingDataDto>|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('CdnPricingDataDto', $o['Data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Data)) $o['Data'] = JsonConverters::toArray('CdnPricingDataDto', $this->Data);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Retrieve pricing data for a collectible. */
// @Api(Description="Retrieve pricing data for a collectible.")
class GetPricingRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Gsid=0,
        /** @var string|null */
        public ?string $PcgsNumber=null,
        /** @var string|null */
        public ?string $FrNumber=null,
        /** @var int */
        public int $Grade=0,
        /** @var int */
        public int $MinGrade=0,
        /** @var int */
        public int $MaxGrade=0,
        /** @var string|null */
        public ?string $ApiLevel=null
    ) {
    }

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

PHP GetPricingRequest DTOs

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

HTTP + OTHER

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

GET /GetPricingRequest HTTP/1.1 
Host: cpgpublicapiv2dev.greysheet.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Data":[{"GsId":0,"Name":"String","SortingPosition":0,"IsType":false,"IsSet":false,"UiParentId":0,"PricingData":[{"Grade":0,"GradeLabel":"String","IsCac":false,"CpgVal":"String","GreyVal":"String","PcgsVal":"String","NgcVal":"String","BlueBookVal":"String"}]}],"Total":0,"OpCode":0,"ErrorText":"String","RequestTime":"String","ResponseTime":"String","TotalExecutionTime":"String","CachedResponse":false,"PermitAccess":false,"AccessDeniedMessage":"String"}