POST | /RestApi/markup/pages |
---|
import Foundation
import ServiceStack
public class PageMarkupRequest : Codable
{
public var keys:[String] = []
required public init(){}
}
public class TemplateMarkupResponseCollection<PageMarkupModel : Codable> : Codable
{
public var items:IList<PageMarkupModel>
required public init(){}
}
public class PageMarkupModel : TemplateMarkupModel
{
public var key:String
public var cultureName:String
public var versionKey:String
public var url:String
public var errorMessage:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case key
case cultureName
case versionKey
case url
case errorMessage
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
key = try container.decodeIfPresent(String.self, forKey: .key)
cultureName = try container.decodeIfPresent(String.self, forKey: .cultureName)
versionKey = try container.decodeIfPresent(String.self, forKey: .versionKey)
url = try container.decodeIfPresent(String.self, forKey: .url)
errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if key != nil { try container.encode(key, forKey: .key) }
if cultureName != nil { try container.encode(cultureName, forKey: .cultureName) }
if versionKey != nil { try container.encode(versionKey, forKey: .versionKey) }
if url != nil { try container.encode(url, forKey: .url) }
if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
}
}
public class TemplateMarkupModel : Codable
{
public var markup:String
public var fileName:String
public var virtualPath:String
public var virtualDirectory:String
required public init(){}
}
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 /RestApi/markup/pages HTTP/1.1
Host: www.asg.com.au
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {Unable to show example output for type 'TemplateMarkupResponseCollection`1' using the custom 'csv' filter}No parameterless constructor defined for this object.