Trendsic Platform Service

<back to all web services

TicketRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,POST,PUT,OPTIONS/v1/Ticket
GET/v1/Ticket/{AgentId}/{Status}
import Foundation
import ServiceStack

public class TicketRequest : Codable
{
    public var ticket:[TicketExtended] = []
    public var agentId:Int
    public var status:String

    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(){}
}

public class TicketResponse : Codable
{
    public var responseStatus:ResponseStatus
    public var ticket:[TicketExtended] = []

    required public init(){}
}


Swift TicketRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/Ticket HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Ticket: 
	[
		{
			AgentName: String,
			TicketType: String,
			AgentHasRead: False,
			AdminHasRead: False,
			TicketId: 0,
			CreatedDate: 0001-01-01,
			CreatedBy: 00000000000000000000000000000000,
			Description: String,
			Resolution: String,
			IsClosed: False,
			IsFollowup: False,
			TicketTypeId: 0,
			ModifiedDate: 0001-01-01,
			ModifiedBy: String
		}
	],
	AgentId: 0,
	Status: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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-01,
			CreatedBy: 00000000000000000000000000000000,
			Description: String,
			Resolution: String,
			IsClosed: False,
			IsFollowup: False,
			TicketTypeId: 0,
			ModifiedDate: 0001-01-01,
			ModifiedBy: String
		}
	]
}