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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<PageMarkupRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Telerik.Sitefinity.Web.Compilation.Model">
<Keys xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
</PageMarkupRequest>