Cdn Marketing API

<back to all web services

GetMarketplaceAdRequest

MarketplaceAds

Get CDN Marketplace ads

The following routes are available for this service:
GET/GetMarketplaceAdRequestEither Gsid or PCGS is required, not both.
import Foundation
import ServiceStack

/**
* Get CDN Marketplace ads
*/
// @Api(Description="Get CDN Marketplace ads")
public class GetMarketplaceAdRequest : Codable
{
    public var gsid:Int
    public var pcgs:String
    public var numberOfItems:Int

    required public init(){}
}

public class MarketplaceAdResponse : BaseResponse
{
    public var data:[MarketplaceAdItemDto]

    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([MarketplaceAdItemDto].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 MarketplaceAdItemDto : Codable
{
    public var title:String
    public var isAuction:Bool
    public var auctionEnds:Date?
    public var buyNowPrice:Double
    public var viewItemUrl:String
    public var imageUrl:String

    required public init(){}
}


Swift GetMarketplaceAdRequest 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 /GetMarketplaceAdRequest HTTP/1.1 
Host: marketingapidev.greysheet.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Data":[{"Title":"String","IsAuction":false,"AuctionEnds":"\/Date(-62135596800000-0000)\/","BuyNowPrice":0,"ViewItemUrl":"String","ImageUrl":"String"}],"Total":0,"OpCode":0,"ErrorText":"String","RequestTime":"String","ResponseTime":"String","TotalExecutionTime":"String","CachedResponse":false,"PermitAccess":false,"AccessDeniedMessage":"String"}