POST | /api/EditContactRecord |
---|
import Foundation
import ServiceStack
/**
* EditContactRecord web service.
*/
// @DataContract
public class EditContactRecordRequest : BaseSecureRequest
{
// @DataMember
public var refNumber:String
// @DataMember
public var contact:String
// @DataMember
public var customerAcct:Int?
// @DataMember
public var actionId:Int?
// @DataMember
public var actionDate:Date?
// @DataMember
public var popUp:Bool?
// @DataMember
public var topicId:Int?
// @DataMember
public var closed:Bool?
// @DataMember
public var closedDate:Date?
// @DataMember
public var colorValue:Int?
// @DataMember
public var lanID:String
// @DataMember
public var formattedNotes:Bool
// @DataMember
public var appendNotes:Bool
// @DataMember
public var note1:String
// @DataMember
public var note2:String
// @DataMember
public var note3:String
// @DataMember
public var attributes:[AttributeValuePair] = []
// @DataMember
public var newAttachments:[FileAttachment] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case refNumber
case contact
case customerAcct
case actionId
case actionDate
case popUp
case topicId
case closed
case closedDate
case colorValue
case lanID
case formattedNotes
case appendNotes
case note1
case note2
case note3
case attributes
case newAttachments
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
refNumber = try container.decodeIfPresent(String.self, forKey: .refNumber)
contact = try container.decodeIfPresent(String.self, forKey: .contact)
customerAcct = try container.decodeIfPresent(Int.self, forKey: .customerAcct)
actionId = try container.decodeIfPresent(Int.self, forKey: .actionId)
actionDate = try container.decodeIfPresent(Date.self, forKey: .actionDate)
popUp = try container.decodeIfPresent(Bool.self, forKey: .popUp)
topicId = try container.decodeIfPresent(Int.self, forKey: .topicId)
closed = try container.decodeIfPresent(Bool.self, forKey: .closed)
closedDate = try container.decodeIfPresent(Date.self, forKey: .closedDate)
colorValue = try container.decodeIfPresent(Int.self, forKey: .colorValue)
lanID = try container.decodeIfPresent(String.self, forKey: .lanID)
formattedNotes = try container.decodeIfPresent(Bool.self, forKey: .formattedNotes)
appendNotes = try container.decodeIfPresent(Bool.self, forKey: .appendNotes)
note1 = try container.decodeIfPresent(String.self, forKey: .note1)
note2 = try container.decodeIfPresent(String.self, forKey: .note2)
note3 = try container.decodeIfPresent(String.self, forKey: .note3)
attributes = try container.decodeIfPresent([AttributeValuePair].self, forKey: .attributes) ?? []
newAttachments = try container.decodeIfPresent([FileAttachment].self, forKey: .newAttachments) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if refNumber != nil { try container.encode(refNumber, forKey: .refNumber) }
if contact != nil { try container.encode(contact, forKey: .contact) }
if customerAcct != nil { try container.encode(customerAcct, forKey: .customerAcct) }
if actionId != nil { try container.encode(actionId, forKey: .actionId) }
if actionDate != nil { try container.encode(actionDate, forKey: .actionDate) }
if popUp != nil { try container.encode(popUp, forKey: .popUp) }
if topicId != nil { try container.encode(topicId, forKey: .topicId) }
if closed != nil { try container.encode(closed, forKey: .closed) }
if closedDate != nil { try container.encode(closedDate, forKey: .closedDate) }
if colorValue != nil { try container.encode(colorValue, forKey: .colorValue) }
if lanID != nil { try container.encode(lanID, forKey: .lanID) }
if formattedNotes != nil { try container.encode(formattedNotes, forKey: .formattedNotes) }
if appendNotes != nil { try container.encode(appendNotes, forKey: .appendNotes) }
if note1 != nil { try container.encode(note1, forKey: .note1) }
if note2 != nil { try container.encode(note2, forKey: .note2) }
if note3 != nil { try container.encode(note3, forKey: .note3) }
if attributes.count > 0 { try container.encode(attributes, forKey: .attributes) }
if newAttachments.count > 0 { try container.encode(newAttachments, forKey: .newAttachments) }
}
}
// @DataContract
public class BaseSecureRequest : BaseRequest
{
/**
* The Login Token return by the Security API. Required for secured calls.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The Login Token return by the Security API. Required for secured calls.", Name="Token", ParameterType="Header")
public var token:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case token
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
token = try container.decodeIfPresent(String.self, forKey: .token)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if token != nil { try container.encode(token, forKey: .token) }
}
}
// @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
/**
* The OAuthToken token return by AeServices30
*/
// @DataMember
// @ApiMember(DataType="string", Description="The OAuthToken token return by AeServices30", IsRequired=true, Name="OAuthToken", ParameterType="Header")
public var oAuthToken:String
/**
* The Device ID of the Mobile Device. Not used for non-mobile devices.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The Device ID of the Mobile Device. Not used for non-mobile devices.", Name="DeviceId", ParameterType="Header")
public var deviceId:String
/**
* An identifier for your integration
*/
// @DataMember
// @ApiMember(DataType="string", Description="An identifier for your integration", IsRequired=true, Name="AppId", ParameterType="Header")
public var appId:String
required public init(){}
}
// @DataContract
public class AttributeValuePair : Codable
{
// @DataMember
public var name:String
// @DataMember
public var value:String
required public init(){}
}
// @DataContract
public class FileAttachment : Codable
{
// @DataMember
public var fileName:String
// @DataMember
public var base64Contents:String
required public init(){}
}
// @DataContract
public class EditContactRecordResponse : 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 EditContactRecordRequest 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/EditContactRecord HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<EditContactRecordRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<AppId>String</AppId>
<DeviceId>String</DeviceId>
<OAuthToken>String</OAuthToken>
<Token>String</Token>
<ActionDate>0001-01-01T00:00:00</ActionDate>
<ActionId>0</ActionId>
<AppendNotes>false</AppendNotes>
<Attributes xmlns:d2p1="http://schemas.datacontract.org/2004/07/AIM">
<d2p1:AttributeValuePair>
<d2p1:Name>String</d2p1:Name>
<d2p1:Value>String</d2p1:Value>
</d2p1:AttributeValuePair>
</Attributes>
<Closed>false</Closed>
<ClosedDate>0001-01-01T00:00:00</ClosedDate>
<ColorValue>0</ColorValue>
<Contact>String</Contact>
<CustomerAcct>0</CustomerAcct>
<FormattedNotes>false</FormattedNotes>
<LanID>String</LanID>
<NewAttachments xmlns:d2p1="http://schemas.datacontract.org/2004/07/AIM">
<d2p1:FileAttachment>
<d2p1:Base64Contents>String</d2p1:Base64Contents>
<d2p1:FileName>String</d2p1:FileName>
</d2p1:FileAttachment>
</NewAttachments>
<Note1>String</Note1>
<Note2>String</Note2>
<Note3>String</Note3>
<PopUp>false</PopUp>
<RefNumber>String</RefNumber>
<TopicId>0</TopicId>
</EditContactRecordRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <EditContactRecordResponse 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> </EditContactRecordResponse>