Skip to main content

<a id=“SuperOffice_WebApi_Agents_TicketAgent”></a> Class TicketAgent

Namespace: SuperOffice.WebApi.Agents
Assembly: SuperOffice.WebApi.dll
Agent used for Ticket functions

Inheritance

objectAgentBaseTicketAgent

Implements

ITicketAgent, IAgentBase, IDisposable

Inherited Members

AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T&gt;(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Examples

<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“http://example.com/super/api”); mySession.Authorization = new AuthorizationUsernamePassword(“user”, “pass”); using (TicketAgent agent = new TicketAgent(mySession)) { // call methods on agent here… }</code></pre>

Constructors

<a id=“SuperOffice_WebApi_Agents_TicketAgent__ctor_System_Net_Http_HttpClient_”></a> TicketAgent(HttpClient)

Constructor: Agent used for Ticket functions

Parameters

httpClient HttpClient Use this HTTP client instead of making own HttpClient instance.

<a id=“SuperOffice_WebApi_Agents_TicketAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> TicketAgent(WebApiOptions, HttpClient)

Constructor: Agent used for Ticket functions

Parameters

options WebApiOptions Base URL and authentication values. httpClient HttpClient Optional: Use this HTTP client instead of making a new one.

Methods

<a id=“SuperOffice_WebApi_Agents_TicketAgent_AcceptTicketsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> AcceptTicketsAsync(int[], RequestOptions)

Accepts tickets by their ids. Sets owner to current user

Parameters

ticketIds int[] Ids of tickets to be accepted. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_AddAttachmentsAsync_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> AddAttachmentsAsync(int, int[], RequestOptions)

Connect existing attachments with this TicketMessage. Can connect multiple attachments

Parameters

ticketMessageEntityId int The id of the ticket message to connect the attachments to attachmentIds int[] An array of attachments to connect to this TicketMessage requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_TicketAgent_BatchForwardAsync_System_Int32___System_String___System_String___System_String___System_String_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> BatchForwardAsync(int[], string[], string[], string[], string, bool, RequestOptions)

Forwards selected tickets to specified recipients. This method starts a batch task.

Parameters

ticketIds int[] Ids of tickets to be forwarded. to string[] The To-recipients. Each recipient must be in correct mailbox format (john@example.com or John Doe <john@example.com>). cc string[] The Cc-recipients. Each recipient must be in correct mailbox format (john@example.com or John Doe <john@example.com>). bcc string[] The Bcc-recipients. Each recipient must be in correct mailbox format (john@example.com or John Doe <john@example.com>). comment string Comment will be included before ticket messages. Might be empty closeTicket bool If true, ticket will be closed after forwarding requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; ID of the new batch task.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_BatchReplyAsync_SuperOffice_WebApi_Data_TicketBatchReplyData_SuperOffice_WebApi_RequestOptions_”></a> BatchReplyAsync(TicketBatchReplyData, RequestOptions)

Replies to the specified tickets. This method starts a batch task.

Parameters

batchReplyData TicketBatchReplyData All data needed to initiate a mass ticket reply sending. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; ID of the new batch task.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CalculateMessageRecipientsAsync_System_Int32_SuperOffice_WebApi_Data_MessageActionType_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CalculateMessageRecipientsAsync(int, MessageActionType, int, RequestOptions)

Gets recipients for new message

Parameters

ticketId int The id of the ticket actionType MessageActionType Message action messageId int Optional ID of message being replied. Value <= 0 ignores parameter requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Recipient[]&gt; An array with Recipient objects

<a id=“SuperOffice_WebApi_Agents_TicketAgent_ClearNotifyAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> ClearNotifyAsync(int[], RequestOptions)

Clear notification status for one or more tickets.

Parameters

ids int[] List of notify IDs. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CopyFromCRMDocumentAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CopyFromCRMDocumentAsync(int, RequestOptions)

Copy CRM document to an attachment

Parameters

documentId int The id of the document to copy to an attachment requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity&gt;

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CopyToTempFileAsync_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CopyToTempFileAsync(string, int, RequestOptions)

Copy ticket attachment to temporary file. Needed for existing document dialog compatibility

Parameters

filename string Preferred filename attachmentId int The id of the attachment to copy requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Temporary document filename

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateDefaultAttachmentEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultAttachmentEntityAsync(RequestOptions)

Set default values into a new AttachmentEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity&gt; A blank AttachmentEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateDefaultForTicketTypeAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultForTicketTypeAsync(int, RequestOptions)

Create default ticket entity for particular TicketType

Parameters

ticketTypeId int ID of ticket type requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; Default ticket entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateDefaultTicketEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTicketEntityAsync(RequestOptions)

Set default values into a new TicketEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; A blank TicketEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateDefaultTicketMessageEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTicketMessageEntityAsync(RequestOptions)

Set default values into a new TicketMessageEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; A blank TicketMessageEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateDefaultTicketRelationEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTicketRelationEntityAsync(RequestOptions)

Set default values into a new TicketRelationEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationEntity&gt; A blank TicketRelationEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_CreateTicketRelationsAsync_System_Int32___System_Int32_SuperOffice_WebApi_Data_TicketRelationType_System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateTicketRelationsAsync(int[], int, TicketRelationType, string, RequestOptions)

Create multiple ticket relations in a single call. Returns a result per source ticket indicating success or failure.

Parameters

sourceTicketIds int[] The ids of the tickets to relate to the destination ticket. destinationTicketId int The id of the ticket that the source tickets will be related to. relationType TicketRelationType The type of relation to create. comment string Optional comment to store on each relation. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationResult[]&gt; Creation results, one per source ticket id.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_DeleteMessageHeadersAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> DeleteMessageHeadersAsync(int[], RequestOptions)

Removes headers from the message as specified in the collection of entity ids. The ids are message header ids (message header primary key)

Parameters

headerIds int[] Message header primary keys requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_DeleteTicketEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteTicketEntityAsync(int, RequestOptions)

Delete a ticket

Parameters

ticketEntityId int The ticket to delete requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_DeleteTicketMessageEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteTicketMessageEntityAsync(int, RequestOptions)

Delete a ticket message

Parameters

ticketMessageEntityId int The ticket message to delete requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_DeleteTicketRelationEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteTicketRelationEntityAsync(int, RequestOptions)

Deletes the TicketRelationEntity

Parameters

ticketRelationEntityId int The identity of the TicketRelationEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_TicketAgent_DoEscalatingAsync_System_Int32_SuperOffice_WebApi_Data_TicketPriorityEscalateAction_SuperOffice_WebApi_RequestOptions_”></a> DoEscalatingAsync(int, TicketPriorityEscalateAction, RequestOptions)

Checks if the ticket should change its alert level based on the priority and action. If it is to change, the alert level and alert timeout for the ticket will be updated.

Parameters

ticketId int The id of ticket action TicketPriorityEscalateAction The action to use when calculating the escalation requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetAttachmentEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAttachmentEntityAsync(int, RequestOptions)

Gets a specific AttachmentEntity object.

Parameters

attachmentEntityId int The identifier of the AttachmentEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity&gt; AttachmentEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetAttachmentInfoAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAttachmentInfoAsync(int, RequestOptions)

Get a list with meta data for all attached attachments

Parameters

ticketMessageEntityId int The id of the ticket message to get attachment infos for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity[]&gt; An array with AttachmentEntity objects, describing each attachment

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetAttachmentInfoNonInlineAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAttachmentInfoNonInlineAsync(int, RequestOptions)

Get a list with meta data for all attached attachments, EXCEPT those marked as inline

Parameters

ticketMessageEntityId int The id of the ticket message to get attachment infos for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity[]&gt; An array with AttachmentEntity objects, describing each attachment; those marked as INLINE will be skipped

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetAttachmentPreviewAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAttachmentPreviewAsync(int, RequestOptions)

Retrieve an attachment from ticket message. The returned data is intended to be used for a preview. The returned data is sanitized.

Parameters

attachmentId int The id of the attachment to retrieve requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentPreview&gt; Sanitized preview version of the attachment and additional metadata, if available

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetAttachmentStreamAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetAttachmentStreamAsync(int, string, RequestOptions)

Get the content of an attachment

Parameters

attachmentId int The id of the attachment to retrieve returnContentType string Accept content-type. Default “application/octet-stream”. Could also be “application/pdf”, “text/plain”, “text/html”, or “multipart/related” requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<byte[]&gt; A stream to the attachment content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetDefaultMessageContentAsync_System_Int32_SuperOffice_WebApi_Data_MessageActionType_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetDefaultMessageContentAsync(int, MessageActionType, int, RequestOptions)

Obsolete, use GetDefaultMessageContentFull instead

Parameters

ticketId int The id of the ticket messageActionType MessageActionType Message action type: None/Reply/ReplyAll/Forward ticketMessageId int The id of the message to quote in the returned content. 0 to skip/ignore requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Sanitized HTML content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetDefaultMessageContentFullAsync_System_Int32_SuperOffice_WebApi_Data_MessageActionType_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetDefaultMessageContentFullAsync(int, MessageActionType, int, int, RequestOptions)

Generate a default message content: attachments and body as sanitized HTML

Parameters

ticketId int The id of the ticket messageActionType MessageActionType Message action type: None/Reply/ReplyAll/Forward ticketMessageId int The id of the message to quote in the returned content. 0 to skip/ignore ticketTypeId int The id of the ticket type to look for reply template. 0 to use current ticket type requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageContent&gt; Generated default message content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetDefaultMessageContentWithOptionsAsync_System_Int32_SuperOffice_WebApi_Data_MessageActionType_System_Int32_System_Int32_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> GetDefaultMessageContentWithOptionsAsync(int, MessageActionType, int, int, bool, RequestOptions)

Generate a default message content with option to exclude signature: attachments and body as sanitized HTML

Parameters

ticketId int The id of the ticket messageActionType MessageActionType Message action type: None/Reply/ReplyAll/Forward ticketMessageId int The id of the message to quote in the returned content. 0 to skip/ignore ticketTypeId int The id of the ticket type to look for reply template. 0 to use current ticket type excludeSignature bool Flag to exclude a signature when generating the return content requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageContent&gt; Generated default message content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetForRmUiAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetForRmUiAsync(int, RequestOptions)

Get a ticket entity, adapted to the specific needs of the Request Management UI. WARNING: This endpoint is not guaranteed to be stable/compatible between versions

Parameters

ticketId int Primary key of ticket to fetch requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The ticket entity. Information is filtered/adapted to the current needs of the UI

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetHotlistEjUsersAsync_System_Int32_System_Int32___SuperOffice_WebApi_Data_NotifyType_SuperOffice_WebApi_Data_NotifyChannel_SuperOffice_WebApi_RequestOptions_”></a> GetHotlistEjUsersAsync(int, int[], NotifyType, NotifyChannel, RequestOptions)

Get a list of ej_user ids who should receive hotlist notification based on request and notification type

Parameters

ticketId int The id of the ticket skipAssociateIds int[] A list of associate ids to skip when calculating whom to get the notification notifyType NotifyType The notification type we want to check for channel NotifyChannel The channel which we should check for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; List of matching ej_user ids

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetNextInQueueAsync_SuperOffice_WebApi_RequestOptions_”></a> GetNextInQueueAsync(RequestOptions)

Assign a ticket to the caller based on intelligent queue system

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The ticket entity after assigning it to the caller

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetPreviewAttachmentStreamAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPreviewAttachmentStreamAsync(int, RequestOptions)

Deprecated, see GetPreviewAttachment instead. Retrieve an attachment from ticket message. The returned data is intended to be used for a preview. The returned data is sanitized.

Parameters

attachmentId int The id of the attachment to retrieve requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentPreview&gt; Sanitized preview version of the attachment

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetRfcAttachmentStreamAsync_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetRfcAttachmentStreamAsync(int, int, string, RequestOptions)

Get the content of an attachment which is part of RFC822 email attachment

Parameters

attachmentId int The id of the root attachment position int The position (index) of the attachment within the root attachment. Numbering starts from 0 returnContentType string Accept content-type. Default “application/octet-stream”. Could also be “application/pdf”, “text/plain”, “text/html”, or “multipart/related” requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<byte[]&gt; RFC822 attachment content as a Stream

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketAsync(int, RequestOptions)

Gets a specific Ticket object.

Parameters

ticketId int The identifier of the Ticket object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Ticket&gt; Ticket

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketAttachmentsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketAttachmentsAsync(int, RequestOptions)

Get attachment infos for all attachments connected to messages in specified ticket

Parameters

ticketEntityId int The id of the ticket to get attachment infos from requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity[]&gt; An array containing attachment info objects for all the attachments

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketEntityAsync(int, RequestOptions)

Gets a specific TicketEntity object.

Parameters

ticketEntityId int The identifier of the TicketEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; TicketEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketMessageAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketMessageAsync(int, RequestOptions)

Gets a specific TicketMessage object.

Parameters

ticketMessageId int The identifier of the TicketMessage object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessage&gt; TicketMessage

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketMessageEntitiesAsync_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetTicketMessageEntitiesAsync(int, int[], RequestOptions)

Get ticket message entities with attachment info for given ticket

Parameters

ticketId int The id of the ticket to get message entities from messageIds int[] Optional ids of message entities to get. If not provided, all ticket message entities will be returned. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity[]&gt; An array containing ticket message entities

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketMessageEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketMessageEntityAsync(int, RequestOptions)

Gets a specific TicketMessageEntity object.

Parameters

ticketMessageEntityId int The identifier of the TicketMessageEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; TicketMessageEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketMessageWithEmbeddedDataAsync_System_Int32_SuperOffice_WebApi_Data_ImageEmbedType_SuperOffice_WebApi_RequestOptions_”></a> GetTicketMessageWithEmbeddedDataAsync(int, ImageEmbedType, RequestOptions)

Get a ticket message entity with posibillity to change embedded images to be represented with inline data within the HTML body. If using inline data, be sure not to save this back to the database.

Parameters

id int The id of the ticket message entity embedImages ImageEmbedType If set to Inline, then use inline base64 data to represent the images in the HTML body. Default: Link will use link to the image. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; The entity to get

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketMessageWithOptionsAsync_System_Int32_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> GetTicketMessageWithOptionsAsync(int, bool, RequestOptions)

Get a ticket message entity with additional options.

Parameters

ticketMessageEntityId int The id of the ticket message entity includeNonInlineAttachmentsInfo bool If true, then non inline attachments info will be loaded into TicketMessageEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; The entity to get

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketParentIdAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketParentIdAsync(int, RequestOptions)

Get the parent ticket id. Returns 0 if the ticket has no parent.

Parameters

ticketId int The id of the ticket to get the parent for. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; The id of the parent ticket, or 0 if there is no parent.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketRelationActionsAsync_System_Int32_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketRelationActionsAsync(int, int, int, RequestOptions)

Get the relation-driven actions that apply to a ticket, such as whether to offer closing the parent or whether open children are blocking the ticket from being closed.

Parameters

ticketId int The id of the ticket being evaluated. parentTicketId int The id of the parent ticket, if any. Pass 0 if there is no parent. ticketTypeId int The id of the ticket type. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationAction&gt; The relation-driven actions applicable to the ticket.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketRelationEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketRelationEntityAsync(int, RequestOptions)

Gets a specific TicketRelationEntity object.

Parameters

ticketRelationEntityId int The identifier of the TicketRelationEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationEntity&gt; TicketRelationEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketRelationsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTicketRelationsAsync(int, RequestOptions)

Get all relations for a ticket.

Parameters

ticketId int The id of the ticket to get relations for. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationItem[]&gt; All relations for the ticket. Each item carries its RelationType (Parent, Child, or Related).

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketSummariesAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetTicketSummariesAsync(int[], RequestOptions)

Get an array of summaryitem for the given tickets

Parameters

ticketIds int[] The tickets to fetch summaries for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketSummaryItem[]&gt; Summary items for the given id’s, in no particular order

<a id=“SuperOffice_WebApi_Agents_TicketAgent_GetTicketsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetTicketsAsync(int[], RequestOptions)

Get multiple tickets

Parameters

ticketIds int[] The ids of tickets to get requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Ticket[]&gt; Returns array of tickets in same order as input ids

<a id=“SuperOffice_WebApi_Agents_TicketAgent_Html2TextAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> Html2TextAsync(string, RequestOptions)

Create a plain text version of the html, suitable for email

Parameters

content string The html version requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; The plain text version

<a id=“SuperOffice_WebApi_Agents_TicketAgent_MergeTicketsAsync_SuperOffice_WebApi_Data_TicketEntity_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> MergeTicketsAsync(TicketEntity, int[], RequestOptions)

Merge one or more tickets into one primary ticket

Parameters

mergedTicketEntity TicketEntity Merged ticket entity secondaryTicketIds int[] Ids of secondary tickets requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The newly merged entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_NotifyNewTicketAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> NotifyNewTicketAsync(int, RequestOptions)

Notify user agents about the creation of a new ticket

Parameters

ticketEntityId int The id of the ticket to notify about requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_NotifyNewTicketMessageAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> NotifyNewTicketMessageAsync(int, RequestOptions)

Notify user agents about the creation of a new message on a ticket

Parameters

ticketEntityId int The id of the ticket to notify about requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_ProcessTicketWhenReadAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ProcessTicketWhenReadAsync(int, RequestOptions)

When a user view/read a ticket, a number of action should be performed: set read status, escalation handling, remove notifications, etc. Which actions will be performed depends on owner, caller and configuration

Parameters

ticketEntityId int The id of the ticket to mark as read requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The ticket entity after marking it as read

<a id=“SuperOffice_WebApi_Agents_TicketAgent_RemoveMessageAttachmentsAsync_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> RemoveMessageAttachmentsAsync(int, int[], RequestOptions)

Removes attachments from the message as specified in the collection of entity ids. The ids are attachment ids (attachment primary key)

Parameters

ticketMessageEntityId int The id of the ticket message to remove attachments from attachmentIds int[] Attachment primary keys requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_ResolveTicketIdAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ResolveTicketIdAsync(int, RequestOptions)

Ticket can be connected (merged) to another ticket. This method traverses through its connection(s) and returns proper ticketId

Parameters

ticketId int Potentially correct ticketId requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; Correct ticketId. Returns 0 in case ticket does not exists

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SanitizeMailContentAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> SanitizeMailContentAsync(string, RequestOptions)

Remove harmful HTML tags and attributes from an email

Parameters

content string The email content to sanitize requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; The sanitized email content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SanitizeMailContentWithOptionsAsync_System_String_SuperOffice_WebApi_Data_HtmlSanitizerOptions_SuperOffice_WebApi_RequestOptions_”></a> SanitizeMailContentWithOptionsAsync(string, HtmlSanitizerOptions, RequestOptions)

Remove harmful HTML tags and attributes from an email, using specified options

Parameters

content string The email content to sanitize options HtmlSanitizerOptions The options for the sanitizer engine requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; The sanitized email content

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SanitizeMailContentsAsync_System_String___SuperOffice_WebApi_RequestOptions_”></a> SanitizeMailContentsAsync(string[], RequestOptions)

Remove harmful HTML tags and attributes from an email

Parameters

contents string[] The email contents to sanitize requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string[]&gt; The sanitized email contents

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveAttachmentEntityAsync_SuperOffice_WebApi_Data_AttachmentEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveAttachmentEntityAsync(AttachmentEntity, RequestOptions)

Updates the existing AttachmentEntity or creates a new AttachmentEntity if the id parameter is 0.

Parameters

attachmentEntity AttachmentEntity The AttachmentEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentEntity&gt; New or updated AttachmentEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketEntityAsync_SuperOffice_WebApi_Data_TicketEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketEntityAsync(TicketEntity, RequestOptions)

Updates the existing TicketEntity or creates a new TicketEntity if the id parameter is 0. Does not notify users of save.

Parameters

ticketEntity TicketEntity The TicketEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; New or updated TicketEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketEntityWithNotifyAsync_SuperOffice_WebApi_Data_TicketEntity_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketEntityWithNotifyAsync(TicketEntity, bool, RequestOptions)

Saves a ticket and performs any user notifications

Parameters

newEntity TicketEntity The ticket to save notify bool If true, then the notifications will be sent requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The newly saved entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketMessageEntityAsync_SuperOffice_WebApi_Data_TicketMessageEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketMessageEntityAsync(TicketMessageEntity, RequestOptions)

Updates the existing TicketMessageEntity or creates a new TicketMessageEntity if the id parameter is 0. Does not notify users of save.

Parameters

ticketMessageEntity TicketMessageEntity The TicketMessageEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; New or updated TicketMessageEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketMessageEntityWithNotifyAsync_SuperOffice_WebApi_Data_TicketMessageEntity_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketMessageEntityWithNotifyAsync(TicketMessageEntity, bool, RequestOptions)

Saves a ticket message and performs any user notifications

Parameters

newEntity TicketMessageEntity The ticket message to save notify bool If true, then the notification will be sent along with the save requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; The saved entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketMessageEntityWithOptionsAsync_SuperOffice_WebApi_Data_TicketMessageEntity_System_Boolean_System_Int32___System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketMessageEntityWithOptionsAsync(TicketMessageEntity, bool, int[], bool, RequestOptions)

Saves a ticket message and performs additional actions

Parameters

entity TicketMessageEntity The ticket message to save notify bool If true, then the notification will be sent along with the save attachmentIds int[] An array of attachments to connect to this TicketMessage updateRepliedAt bool Updates ticket’s replied_at field if needed requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketMessageEntity&gt; The saved entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SaveTicketRelationEntityAsync_SuperOffice_WebApi_Data_TicketRelationEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveTicketRelationEntityAsync(TicketRelationEntity, RequestOptions)

Updates the existing TicketRelationEntity or creates a new TicketRelationEntity if the id parameter is 0.

Parameters

ticketRelationEntity TicketRelationEntity The TicketRelationEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationEntity&gt; New or updated TicketRelationEntity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SendTicketMessageAsync_System_Int32_System_String___System_String___System_String___System_String_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> SendTicketMessageAsync(int, string[], string[], string[], string, int, string, RequestOptions)

Send a message to recipients by email

Parameters

ticketMessageEntityId int The id of the ticket message to send to string[] The To-recipients. Each recipient must be in correct format cc string[] The Cc-recipients. Each recipient must be in correct format bcc string[] The Bcc-recipients. Each recipient must be in correct format subject string The subject replyTemplateId int Optional ID of reply template to merge message with. <= 0 to skip. gdprSource string Obsolete requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SendTicketMessageSmsAsync_System_Int32_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> SendTicketMessageSmsAsync(int, int, string[], RequestOptions)

Send a message to recipients by sms

Parameters

ticketMessageEntityId int The id of the ticket message to send replyTemplateId int Optional ID of reply template to merge message with. <= 0 to skip. sms string[] The Sms-recipients. Each recipient must be in correct format requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetDeletedStatusByIdsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> SetDeletedStatusByIdsAsync(int[], RequestOptions)

Sets tickets’ status to Deleted. After a grace period these tickets will be deleted by a background job.

Parameters

ticketIds int[] Ids of tickets to be set for deletion. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Ids of tickets set for deletion.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetDeletedStatusByProviderAsync_System_String_SuperOffice_WebApi_Data_ArchiveRestrictionInfo___SuperOffice_WebApi_RequestOptions_”></a> SetDeletedStatusByProviderAsync(string, ArchiveRestrictionInfo[], RequestOptions)

Sets tickets’ status to Deleted. After a grace period these tickets will be deleted by a background job.

Parameters

providerName string Name of the provider that returns ticket rows. restrictions ArchiveRestrictionInfo[] Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Ids of tickets set for deletion.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetSpamStatusByIdsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> SetSpamStatusByIdsAsync(int[], RequestOptions)

Sets tickets’ status to SPAM. After a grace period these tickets will be deleted by a background job.

Parameters

ticketIds int[] Ids of tickets to be set for SPAM. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Ids of tickets set for SPAM.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetSpamStatusByProviderAsync_System_String_SuperOffice_WebApi_Data_ArchiveRestrictionInfo___SuperOffice_WebApi_RequestOptions_”></a> SetSpamStatusByProviderAsync(string, ArchiveRestrictionInfo[], RequestOptions)

Sets tickets’ status to SPAM. After a grace period these tickets will be deleted by a background job.

Parameters

providerName string Name of the provider that returns ticket rows. restrictions ArchiveRestrictionInfo[] Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Ids of tickets set for deletion.

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetTicketMessageImportantAsync_System_Int32_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SetTicketMessageImportantAsync(int, bool, RequestOptions)

Set the important flag on or off for a ticket message

Parameters

ticketMessageId int The id of the ticket message to set the important flag on important bool Turn on or off the important flag requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetTicketParentAsync_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> SetTicketParentAsync(int, int, string, RequestOptions)

Set the parent of a ticket. If the ticket already has a parent, it will be overwritten.

Parameters

ticketId int The id of the ticket to set the parent on. parentTicketId int The id of the ticket to set as parent. comment string Optional comment to store on the relation. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SetTicketReadByOwnerAsync_System_Int32_SuperOffice_WebApi_Data_TicketReadStatus_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SetTicketReadByOwnerAsync(int, TicketReadStatus, bool, RequestOptions)

Set the ReadByOwner status for a ticket. It will only have an effect if the calling user is the same as the owner of the ticket

Parameters

ticketEntityId int The id of the ticket to set readStatus TicketReadStatus The read status to set. See the enum for explanation of the different colors. Setting Unknown does nothing checkEscalating bool If true, then the escalation system will be called and executed when setting the ReadByOwner requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The ticket entity after setting the ReadByOwner

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SplitTicketAsync_System_Int32_System_Int32_System_DateTime_System_Int32___SuperOffice_WebApi_Data_TicketEntity_SuperOffice_WebApi_RequestOptions_”></a> SplitTicketAsync(int, int, DateTime, int[], TicketEntity, RequestOptions)

Save new ticket and move/copy data from existing ticket in a single request. Specified messages will be moved.

Parameters

sourceTicketEntityId int The id of the ticket to split sourceTicketEntityStatusId int The id of the source ticket’s status sourceTicketEntityActivate DateTime The activate date of the source ticket transferMessageIds int[] IDs of messages that should be transferred from the original ticket to the new one newTicketEntity TicketEntity The new ticket to save. Includes new values for simple properties like title, category, status, etc., but not messages. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The newly created entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_SplitTicketMessageAsync_SuperOffice_WebApi_Data_TicketMessageEntity_SuperOffice_WebApi_Data_TicketEntity_SuperOffice_WebApi_Data_TicketMessageEntity_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> SplitTicketMessageAsync(TicketMessageEntity, TicketEntity, TicketMessageEntity, int[], RequestOptions)

Create new ticket and move/copy data from existing ticket in addition update old message and save new message in a single request.

Parameters

sourceTicketMessage TicketMessageEntity The message being splitted, content can be modified as part of the split. newTicketEntity TicketEntity The new ticket to save. Includes new values for simple properties like title, category, status, etc., but not messages. newTicketMessage TicketMessageEntity The new message to be saved transferAttachmentsIds int[] IDs of attachments that should be transferred from the original message to the new one requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketEntity&gt; The newly created entity

<a id=“SuperOffice_WebApi_Agents_TicketAgent_UndeleteByIdsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> UndeleteByIdsAsync(int[], RequestOptions)

Restores deleted tickets by their ids. Status is set to a default open status defined in Registry table

Parameters

ticketIds int[] Ids of tickets to be restored. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_UpdateTicketsReadStatusAsync_System_Int32___SuperOffice_WebApi_Data_TicketReadStatus_SuperOffice_WebApi_RequestOptions_”></a> UpdateTicketsReadStatusAsync(int[], TicketReadStatus, RequestOptions)

This method changes multiple tickets’ read status

Parameters

ticketIds int[] Ticket ids to be updated newStatus TicketReadStatus New read status requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Updated ticket ids

<a id=“SuperOffice_WebApi_Agents_TicketAgent_UpdateTicketsReadStatusByProviderAsync_System_String_SuperOffice_WebApi_Data_ArchiveRestrictionInfo___SuperOffice_WebApi_Data_TicketReadStatus_SuperOffice_WebApi_RequestOptions_”></a> UpdateTicketsReadStatusByProviderAsync(string, ArchiveRestrictionInfo[], TicketReadStatus, RequestOptions)

This method changes multiple tickets’ read status

Parameters

provider string Name of the provider that returns ticket rows. restrictions ArchiveRestrictionInfo[] Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction. newStatus TicketReadStatus New read status requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int[]&gt; Updated ticket ids

<a id=“SuperOffice_WebApi_Agents_TicketAgent_UploadAttachmentAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> UploadAttachmentAsync(int, byte[], RequestOptions)

Upload the content for an attachment

Parameters

attachmentId int The id of the attachment row, for which to attach the upload data content byte[] A stream to the content to be uploaded requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_TicketAgent_ValidateAttachmentsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> ValidateAttachmentsAsync(int[], RequestOptions)

Check attachments, return validation result for each item

Parameters

attachmentIds int[] The IDs of the attachments to validate requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AttachmentValidationResult[]&gt; Validation result

<a id=“SuperOffice_WebApi_Agents_TicketAgent_ValidateTicketRelationsAsync_System_Int32___System_Int32_SuperOffice_WebApi_Data_TicketRelationType_SuperOffice_WebApi_RequestOptions_”></a> ValidateTicketRelationsAsync(int[], int, TicketRelationType, RequestOptions)

Validate proposed ticket relations without saving them. Returns a result per source ticket indicating whether the relation is valid.

Parameters

sourceTicketIds int[] The ids of the tickets to relate to the destination ticket. destinationTicketId int The id of the ticket that the source tickets will be related to. relationType TicketRelationType The type of relation to create. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TicketRelationResult[]&gt; Validation results, one per source ticket id.