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

<back to all web services

GetNodeChildrenRequest

Catalog

Retrieve node children for a given node

The following routes are available for this service:
GET/GetNodeChildrenRequestThis will return no data for those nodes with collectible children. There is no advanced APi version for this call.
import Foundation
import ServiceStack

/**
* Retrieve node children for a given node
*/
// @Api(Description="Retrieve node children for a given node")
public class GetNodeChildrenRequest : 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 GetNodeChildrenRequest 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 /GetNodeChildrenRequest HTTP/1.1 
Host: cpgpublicapiv2dev.greysheet.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
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"}