| Requires any of the roles: | Agent, Administrator |
| GET | /v1/Ticket/{TicketId} |
|---|
import Foundation
import ServiceStack
public class SingleTicketRequest : Codable
{
public var ticketId:String
required public init(){}
}
public class SingleTicketResponse : Codable
{
public var responseStatus:ResponseStatus
public var ticket:TicketExtended
required public init(){}
}
public class TicketExtended : Ticket
{
public var agentName:String
public var ticketType:String
public var agentHasRead:Bool
public var adminHasRead:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case agentName
case ticketType
case agentHasRead
case adminHasRead
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
agentName = try container.decodeIfPresent(String.self, forKey: .agentName)
ticketType = try container.decodeIfPresent(String.self, forKey: .ticketType)
agentHasRead = try container.decodeIfPresent(Bool.self, forKey: .agentHasRead)
adminHasRead = try container.decodeIfPresent(Bool.self, forKey: .adminHasRead)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if agentName != nil { try container.encode(agentName, forKey: .agentName) }
if ticketType != nil { try container.encode(ticketType, forKey: .ticketType) }
if agentHasRead != nil { try container.encode(agentHasRead, forKey: .agentHasRead) }
if adminHasRead != nil { try container.encode(adminHasRead, forKey: .adminHasRead) }
}
}
public class Ticket : Codable
{
public var ticketId:Int
public var createdDate:Date
public var createdBy:String
public var Description:String
public var resolution:String
public var isClosed:Bool
public var isFollowup:Bool
public var ticketTypeId:Int
public var modifiedDate:Date
public var modifiedBy:String
required public init(){}
}
Swift SingleTicketRequest DTOs
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 /v1/Ticket/{TicketId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
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"}},"Ticket":{"AgentName":"String","TicketType":"String","AgentHasRead":false,"AdminHasRead":false,"TicketId":0,"CreatedDate":"0001-01-01T00:00:00.0000000","CreatedBy":"00000000000000000000000000000000","Description":"String","Resolution":"String","IsClosed":false,"IsFollowup":false,"TicketTypeId":0,"ModifiedDate":"0001-01-01T00:00:00.0000000","ModifiedBy":"String"}}