GET | /script | ||
---|---|---|---|
GET | /script/{Sprint} | ||
GET | /script/{Sprint}/{Country}/{Language}/{Section}/{Element} | ||
GET | /script/{Sprint}/{Country}/{Language}/{Section}/{ItemCode}/{Element} |
import Foundation
import ServiceStack
public class ScriptTrackerReq : Codable
{
public var sprint:String?
public var country:String?
public var language:String?
public var section:String?
public var itemCode:String?
public var element:String?
required public init(){}
}
public class ScriptTracker : Entity
{
public var sprint:String?
public var country:String?
public var language:String?
public var section:String?
public var itemCode:String?
public var element:String?
public var value:String?
public var isFromMerge:Bool?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case sprint
case country
case language
case section
case itemCode
case element
case value
case isFromMerge
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
sprint = try container.decodeIfPresent(String.self, forKey: .sprint)
country = try container.decodeIfPresent(String.self, forKey: .country)
language = try container.decodeIfPresent(String.self, forKey: .language)
section = try container.decodeIfPresent(String.self, forKey: .section)
itemCode = try container.decodeIfPresent(String.self, forKey: .itemCode)
element = try container.decodeIfPresent(String.self, forKey: .element)
value = try container.decodeIfPresent(String.self, forKey: .value)
isFromMerge = try container.decodeIfPresent(Bool.self, forKey: .isFromMerge)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if sprint != nil { try container.encode(sprint, forKey: .sprint) }
if country != nil { try container.encode(country, forKey: .country) }
if language != nil { try container.encode(language, forKey: .language) }
if section != nil { try container.encode(section, forKey: .section) }
if itemCode != nil { try container.encode(itemCode, forKey: .itemCode) }
if element != nil { try container.encode(element, forKey: .element) }
if value != nil { try container.encode(value, forKey: .value) }
if isFromMerge != nil { try container.encode(isFromMerge, forKey: .isFromMerge) }
}
}
public class Entity : IEntity, Codable
{
public var id:String?
required public init(){}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /script HTTP/1.1 Host: hcbtas-q-albamfs-api.azurewebsites.net Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"sprint":"String","country":"String","language":"String","section":"String","itemCode":"String","element":"String","value":"String","isFromMerge":false,"id":"String"}