OLX.FreshDeskAPI 1.0.2-alpha

An implementation for FreshDesk API V2.

This is a prerelease version of OLX.FreshDeskAPI.
Install-Package OLX.FreshDeskAPI -Version 1.0.2-alpha
dotnet add package OLX.FreshDeskAPI --version 1.0.2-alpha
<PackageReference Include="OLX.FreshDeskAPI" Version="1.0.2-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OLX.FreshDeskAPI --version 1.0.2-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Welcome to OLX.FreshDeskAPI

OLX.FreshDeskAPI allows for a simple implementation of FreshDesk API v2 into your project.

Installation

OLX.FreshDeskAPI is available as a NuGet Package. NuGet package manager is preferred method of project integration.

To install, run the following command into Package Manager Console.

Install-Package OLX.FreshDeskAPI -Version 1.0.0-alpha

Usage

An account on Freshdesk.com is required. If you have not done so, be sure to go to Freshdesk.com and register before proceeding.

After account creation, please note your FreshDesk subdomain URL (typically: http://domainname.freshdesk.com) and FreshDesk API Key (found in your Profile Settings) which is needed for further API calls.

This Package makes calls to the Freshdesk REST API.

FreshDeskService

Creating a new instance:

The constructor requires, 1) your FreshDesk URL, 2) yourAPI Key and 3) your Company Name (which is a custom field) against which the ticket(s) will be created and/or fetched. Note that the company name must be registered in your FreshDesk account (https://domainname.freshdesk.com/a/admin/contact_fields).

IFreshDeskService _ifreshdeskservice = new FreshDeskService("https://domain.freshdesk.com/api/v2/", 
				    "FreshDeskAPIV2Key",
				    "CompanyName_CustomField");

GetTickets

This method requires SearchTicketViewModel as an input parameter.
If SearchTicketViewModel.isSuperAdmin(uses Freshdesk API) is FALSE, then it will return all tickets for the passed email address, and is ideal when displaying records to end users.

_ifreshdeskservice.GetTickets(_ifreshdeskservice.GetTickets(new SearchTicketViewModel()
            {
                EmailId= "example@example.com",
                FilterFields= null,
                isSuperAdmin= false,
                Page = 0
            }));

If SearchTicketViewModel.isSuperAdmin(uses Freshdesk API) is TRUE, then tickets will be retuned on the basis of SearchTicketViewModel.FilterFields (Currently, this filter works on 'status' field only). When FilterFields are not mentioned, this will return all the records (30 records per page). This can be used to display records for admin users. This may take some time to reflect any ticket updates as the Query API on FreshDesk v2 does not return realtime records.

_ifreshdeskservice.GetTickets(_ifreshdeskservice.GetTickets(new SearchTicketViewModel()
        {
            EmailId= null,
            FilterFields= new List<Filter>()
            {
                new Filter() { Key="status",Value="" }//will return all the records
            },
            isSuperAdmin= true,
            Page = 1//page size is 30
        }));

GetTicketDetails

The Freshdesk API expects an int Ticket Id as input parameter, which returns details of the mentioned ticket with conversation included (first 10 conversations only).
_ifreshdeskservice.GetTicketDetails(42);//ticket id

GetTicketConversationWithPageNumber

Freshdesk API expects an integer for the Ticket Id and Page Number as input parameter and returns the conversations. This call returns paged conversations with the page size defaulting to 10.

    _ifreshdeskservice.GetTicketConversationWithPageNumber(
    							 42,//Ticket Id 
    							  2//Page Number
); 

CreateTicket

Freshdesk API accepts an instance of the TicketDescriptionModel type and returns successful response if ticket creation is successful.

var httpRequest = HttpContext.Current.Request;
var model = new TicketDescriptionModel()
{
    Requester = httpRequest.Form["Requester"],//Email id of the ticket requester
    TicketSubject = httpRequest.Form["TicketSubject"],//Subject on the ticket
    TicketDesc = httpRequest.Form["TicketDesc"],//Description on the ticket
    TicketPriority = httpRequest.Form["TicketPriority"],//Priority in the range of 1-4
    attachments = httpRequest.Files,//Attachments with the ticket
};
_ifreshdeskservice.CreateTicket(model);

ReplyOnTicket

Freshdesk API accepts an instance of TicketReply type and returns a successful response if the reply has posted successfully.

var httpRequest = HttpContext.Current.Request;
var model = new TicketReply()
{
    TicketId = Convert.ToInt16(httpRequest.Form["ticketId"]),//ticket id against which the reply is posted
    IsClosingComment = Convert.ToBoolean(httpRequest.Form["isClosingComment"]),//if true, the ticket will be closed after this reply is posted
    IsSuperAdminComment = Convert.ToBoolean(httpRequest.Form["IsSuperAdminComment"]),//is this comment posted by admin or the user
    TicketComment = httpRequest.Form["ticketComment"],//comments on the ticket
    TicketFrom = httpRequest.Form["ticketFrom"],//Email id of replier (Only used if IsSuperAdminComment comes false)
    attachments = httpRequest.Files,//files associated with the request
};
_ifreshdeskservice.ReplyOnTicket(model);

DeleteTicket

Freshdesk API expects an integer for the Ticket Id field and returns a successful response if the mentioned ticket was deleted successfully.

_ifreshdeskservice.DeleteTicket(42);//id of ticket to be deleted

UpdateTicket

Freshdesk API expects an integer for the Ticket Id and Status fields, and returns a successful response if the ticket status was successfully updated. Note that this API only updates the status of the ticket.

_ifreshdeskservice.UpdateTicket(
	    42,//ticket id to be updated
	    3//new status id
);

Welcome to OLX.FreshDeskAPI

OLX.FreshDeskAPI allows for a simple implementation of FreshDesk API v2 into your project.

Installation

OLX.FreshDeskAPI is available as a NuGet Package. NuGet package manager is preferred method of project integration.

To install, run the following command into Package Manager Console.

Install-Package OLX.FreshDeskAPI -Version 1.0.0-alpha

Usage

An account on Freshdesk.com is required. If you have not done so, be sure to go to Freshdesk.com and register before proceeding.

After account creation, please note your FreshDesk subdomain URL (typically: http://domainname.freshdesk.com) and FreshDesk API Key (found in your Profile Settings) which is needed for further API calls.

This Package makes calls to the Freshdesk REST API.

FreshDeskService

Creating a new instance:

The constructor requires, 1) your FreshDesk URL, 2) yourAPI Key and 3) your Company Name (which is a custom field) against which the ticket(s) will be created and/or fetched. Note that the company name must be registered in your FreshDesk account (https://domainname.freshdesk.com/a/admin/contact_fields).

IFreshDeskService _ifreshdeskservice = new FreshDeskService("https://domain.freshdesk.com/api/v2/", 
				    "FreshDeskAPIV2Key",
				    "CompanyName_CustomField");

GetTickets

This method requires SearchTicketViewModel as an input parameter.
If SearchTicketViewModel.isSuperAdmin(uses Freshdesk API) is FALSE, then it will return all tickets for the passed email address, and is ideal when displaying records to end users.

_ifreshdeskservice.GetTickets(_ifreshdeskservice.GetTickets(new SearchTicketViewModel()
            {
                EmailId= "example@example.com",
                FilterFields= null,
                isSuperAdmin= false,
                Page = 0
            }));

If SearchTicketViewModel.isSuperAdmin(uses Freshdesk API) is TRUE, then tickets will be retuned on the basis of SearchTicketViewModel.FilterFields (Currently, this filter works on 'status' field only). When FilterFields are not mentioned, this will return all the records (30 records per page). This can be used to display records for admin users. This may take some time to reflect any ticket updates as the Query API on FreshDesk v2 does not return realtime records.

_ifreshdeskservice.GetTickets(_ifreshdeskservice.GetTickets(new SearchTicketViewModel()
        {
            EmailId= null,
            FilterFields= new List<Filter>()
            {
                new Filter() { Key="status",Value="" }//will return all the records
            },
            isSuperAdmin= true,
            Page = 1//page size is 30
        }));

GetTicketDetails

The Freshdesk API expects an int Ticket Id as input parameter, which returns details of the mentioned ticket with conversation included (first 10 conversations only).
_ifreshdeskservice.GetTicketDetails(42);//ticket id

GetTicketConversationWithPageNumber

Freshdesk API expects an integer for the Ticket Id and Page Number as input parameter and returns the conversations. This call returns paged conversations with the page size defaulting to 10.

    _ifreshdeskservice.GetTicketConversationWithPageNumber(
    							 42,//Ticket Id 
    							  2//Page Number
); 

CreateTicket

Freshdesk API accepts an instance of the TicketDescriptionModel type and returns successful response if ticket creation is successful.

var httpRequest = HttpContext.Current.Request;
var model = new TicketDescriptionModel()
{
    Requester = httpRequest.Form["Requester"],//Email id of the ticket requester
    TicketSubject = httpRequest.Form["TicketSubject"],//Subject on the ticket
    TicketDesc = httpRequest.Form["TicketDesc"],//Description on the ticket
    TicketPriority = httpRequest.Form["TicketPriority"],//Priority in the range of 1-4
    attachments = httpRequest.Files,//Attachments with the ticket
};
_ifreshdeskservice.CreateTicket(model);

ReplyOnTicket

Freshdesk API accepts an instance of TicketReply type and returns a successful response if the reply has posted successfully.

var httpRequest = HttpContext.Current.Request;
var model = new TicketReply()
{
    TicketId = Convert.ToInt16(httpRequest.Form["ticketId"]),//ticket id against which the reply is posted
    IsClosingComment = Convert.ToBoolean(httpRequest.Form["isClosingComment"]),//if true, the ticket will be closed after this reply is posted
    IsSuperAdminComment = Convert.ToBoolean(httpRequest.Form["IsSuperAdminComment"]),//is this comment posted by admin or the user
    TicketComment = httpRequest.Form["ticketComment"],//comments on the ticket
    TicketFrom = httpRequest.Form["ticketFrom"],//Email id of replier (Only used if IsSuperAdminComment comes false)
    attachments = httpRequest.Files,//files associated with the request
};
_ifreshdeskservice.ReplyOnTicket(model);

DeleteTicket

Freshdesk API expects an integer for the Ticket Id field and returns a successful response if the mentioned ticket was deleted successfully.

_ifreshdeskservice.DeleteTicket(42);//id of ticket to be deleted

UpdateTicket

Freshdesk API expects an integer for the Ticket Id and Status fields, and returns a successful response if the ticket status was successfully updated. Note that this API only updates the status of the ticket.

_ifreshdeskservice.UpdateTicket(
	    42,//ticket id to be updated
	    3//new status id
);

Release Notes

Initial pre-release

Version History

Version Downloads Last updated
1.0.2-alpha 112 9/14/2018
1.0.1-alpha 183 7/14/2018