| All Verbs | /qry/lookups |
|---|
import Foundation
import ServiceStack
public class GetLookup : Codable
{
public var id:String
required public init(){}
}
public class Lookup : Codable
{
public var id:String
public var data:[RefEx]
required public init(){}
}
public class RefEx : Ref
{
public var data:RecordDictionary<String, String>
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(RecordDictionary<String, String>.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 Ref : Codable
{
public var id:String
public var val:String
required public init(){}
}
public class RecordDictionary<TKey : Codable, TVal : Codable> : List<TKey:TVal>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /qry/lookups HTTP/1.1
Host: api.sbbet.ath.cx
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"id":"String","data":[{"data":{"String":"String"},"id":"String","val":"String"}]}