POST | /api/MobileRegistration |
---|
import Foundation
import ServiceStack
/**
* MobileRegistrationRequires active-e AIMMobile
*/
// @DataContract
public class MobileRegistrationRequest : BaseRequest
{
// @DataMember
public var name:String
// @DataMember
public var phone:String
// @DataMember
public var company:String
// @DataMember
public var address1:String
// @DataMember
public var address2:String
// @DataMember
public var city:String
// @DataMember
public var state:String
// @DataMember
public var email:String
// @DataMember
public var zip:String
// @DataMember
public var password:String
/**
* Should be Register or Confirm
*/
// @DataMember
// @ApiMember(DataType="string", Description="Should be Register or Confirm", IsRequired=true, Name="Action", ParameterType="query")
public var action:String
// @DataMember
public var passwordToken:String
// @DataMember
public var optIn1:Bool
// @DataMember
public var optIn2:Bool
// @DataMember
public var optIn3:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case name
case phone
case company
case address1
case address2
case city
case state
case email
case zip
case password
case action
case passwordToken
case optIn1
case optIn2
case optIn3
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
name = try container.decodeIfPresent(String.self, forKey: .name)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
company = try container.decodeIfPresent(String.self, forKey: .company)
address1 = try container.decodeIfPresent(String.self, forKey: .address1)
address2 = try container.decodeIfPresent(String.self, forKey: .address2)
city = try container.decodeIfPresent(String.self, forKey: .city)
state = try container.decodeIfPresent(String.self, forKey: .state)
email = try container.decodeIfPresent(String.self, forKey: .email)
zip = try container.decodeIfPresent(String.self, forKey: .zip)
password = try container.decodeIfPresent(String.self, forKey: .password)
action = try container.decodeIfPresent(String.self, forKey: .action)
passwordToken = try container.decodeIfPresent(String.self, forKey: .passwordToken)
optIn1 = try container.decodeIfPresent(Bool.self, forKey: .optIn1)
optIn2 = try container.decodeIfPresent(Bool.self, forKey: .optIn2)
optIn3 = try container.decodeIfPresent(Bool.self, forKey: .optIn3)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if name != nil { try container.encode(name, forKey: .name) }
if phone != nil { try container.encode(phone, forKey: .phone) }
if company != nil { try container.encode(company, forKey: .company) }
if address1 != nil { try container.encode(address1, forKey: .address1) }
if address2 != nil { try container.encode(address2, forKey: .address2) }
if city != nil { try container.encode(city, forKey: .city) }
if state != nil { try container.encode(state, forKey: .state) }
if email != nil { try container.encode(email, forKey: .email) }
if zip != nil { try container.encode(zip, forKey: .zip) }
if password != nil { try container.encode(password, forKey: .password) }
if action != nil { try container.encode(action, forKey: .action) }
if passwordToken != nil { try container.encode(passwordToken, forKey: .passwordToken) }
if optIn1 != nil { try container.encode(optIn1, forKey: .optIn1) }
if optIn2 != nil { try container.encode(optIn2, forKey: .optIn2) }
if optIn3 != nil { try container.encode(optIn3, forKey: .optIn3) }
}
}
// @DataContract
public class BaseRequest : Codable
{
/**
* This is your AIM API Key provided by Tri-Tech
*/
// @DataMember
// @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
public var apiKey:String
// @DataMember
// @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
public var oAuthToken:String
required public init(){}
}
// @DataContract
public class MobileRegistrationResponse : BaseResponse
{
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)
}
}
// @DataContract
public class BaseResponse : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
public var status:BaseResponseResult
required public init(){}
}
// @DataContract
public class BaseResponseResult : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
public var statusCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
public var login:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
public var errorCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
public var errorDisplayText:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
public var errorMessage:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
public var domainName:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
public var ipAddress:String
required public init(){}
}
Swift MobileRegistrationRequest DTOs
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 /api/MobileRegistration HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<MobileRegistrationRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<OAuthToken>String</OAuthToken>
<Action>String</Action>
<Address1>String</Address1>
<Address2>String</Address2>
<City>String</City>
<Company>String</Company>
<Email>String</Email>
<Name>String</Name>
<OptIn1>false</OptIn1>
<OptIn2>false</OptIn2>
<OptIn3>false</OptIn3>
<Password>String</Password>
<PasswordToken>String</PasswordToken>
<Phone>String</Phone>
<State>String</State>
<Zip>String</Zip>
</MobileRegistrationRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <MobileRegistrationResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService"> <Status> <DomainName>String</DomainName> <ErrorCode>String</ErrorCode> <ErrorDisplayText>String</ErrorDisplayText> <ErrorMessage>String</ErrorMessage> <IpAddress>String</IpAddress> <Login>String</Login> <StatusCode>String</StatusCode> </Status> </MobileRegistrationResponse>