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.
import Foundation
import ServiceStack

/**
* Retrieve a node
*/
// @Api(Description="Retrieve a node")
public class GetNodeRequest : Codable
{
    public var nodeId:Int

    required public init(){}
}

public class NodeResponse : BaseResponse
{
    public var data:[NodeDto]

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        data = try container.decodeIfPresent([NodeDto].self, forKey: .data) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if data != nil { try container.encode(data, forKey: .data) }
    }
}

public class BaseResponse : Codable
{
    public var total:Int
    public var opCode:Int
    public var errorText:String
    public var requestTime:String
    public var responseTime:String
    public var totalExecutionTime:String
    public var cachedResponse:Bool
    public var permitAccess:Bool
    public var accessDeniedMessage:String

    required public init(){}
}

public class NodeDto : Codable
{
    public var id:Int
    public var name:String
    public var Description:String
    public var featuredImageUrl:String
    public var featuredImageAttribution:String
    public var flagCode:String
    public var countryName:String
    public var sortingPosition:Int
    public var nodeChildrenCountLive:Int
    public var collectibleChildrenCountLive:Int
    public var parentNode_Id:Int?
    public var rootNode_Id:Int?
    public var childNodes:[NodeDto]

    required public init(){}
}


Swift GetNodeRequest DTOs

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

HTTP + JSV

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: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Data: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			FeaturedImageUrl: String,
			FeaturedImageAttribution: String,
			FlagCode: String,
			CountryName: String,
			SortingPosition: 0,
			NodeChildrenCountLive: 0,
			CollectibleChildrenCountLive: 0,
			ParentNode_Id: 0,
			RootNode_Id: 0,
			ChildNodes: 
			[
				{
					Id: 0,
					Name: String,
					Description: String,
					FeaturedImageUrl: String,
					FeaturedImageAttribution: String,
					FlagCode: String,
					CountryName: String,
					SortingPosition: 0,
					NodeChildrenCountLive: 0,
					CollectibleChildrenCountLive: 0,
					ParentNode_Id: 0,
					RootNode_Id: 0,
					ChildNodes: 
					[
						{
							Id: 0,
							Name: String,
							Description: String,
							FeaturedImageUrl: String,
							FeaturedImageAttribution: String,
							FlagCode: String,
							CountryName: String,
							SortingPosition: 0,
							NodeChildrenCountLive: 0,
							CollectibleChildrenCountLive: 0,
							ParentNode_Id: 0,
							RootNode_Id: 0
						}
					]
				}
			]
		}
	],
	Total: 0,
	OpCode: 0,
	ErrorText: String,
	RequestTime: String,
	ResponseTime: String,
	TotalExecutionTime: String,
	CachedResponse: False,
	PermitAccess: False,
	AccessDeniedMessage: String
}