GET | /profile/{Id} |
---|
import Foundation
import ServiceStack
public class GetProfileRequest : GetOperationUnTenanted<GetProfileResponse>
{
public var id:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if id != nil { try container.encode(id, forKey: .id) }
}
}
public class GetOperationUnTenanted<TResponse : Codable> : IHasGetOptions, IGet, Codable
{
public var embed:String?
required public init(){}
}
public class GetProfileResponse : Codable
{
public var responseStatus:ResponseStatus?
public var profile:Profile?
required public init(){}
}
public class Profile : ProfileBasic
{
public var defaultOrganisationId:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case defaultOrganisationId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
defaultOrganisationId = try container.decodeIfPresent(String.self, forKey: .defaultOrganisationId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if defaultOrganisationId != nil { try container.encode(defaultOrganisationId, forKey: .defaultOrganisationId) }
}
}
public class ProfileBasic : IIdentifiableResource, Codable
{
public var name:PersonName?
public var displayName:String?
public var emailAddress:String?
public var phoneNumber:String?
public var timezone:String?
public var id:String?
required public init(){}
}
public class PersonName : Codable
{
public var firstName:String?
public var lastName: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.
GET /profile/{Id} HTTP/1.1 Host: foundrystage-api-app.azurewebsites.net Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"profile":{"defaultOrganisationId":"String","name":{"firstName":"String","lastName":"String"},"displayName":"String","emailAddress":"String","phoneNumber":"String","timezone":"String","id":"String"}}