The Freshdesk REST Client is designed to abstract Freshdesk's JSON API and present the developer with a simplified and strongly typed implementation. Much of the underlying mechanics have therefore purposefully been abstracted behind private modifiers.
The current release notes can be read in CHANGELOG.md.
Both RestSharp and Newtonsoft.Json are required dependencies.
Make sure to consult the Wiki for the full documentation.
string freshdeskDomain = "yourcompany.freshdesk.com";
string apiKey = "yourapikey";
FreshdeskClient freshdesk = new FreshdeskClient(freshdeskDomain, apiKey, "X");
(Response response, List<Contact> contacts) = freshdesk.GetContacts();
if (response.StatusCode == HttpStatusCode.OK)
Console.WriteLine(contacts.Count);
(Response response, Contact contact) = freshdesk.GetContact(28000000000);
if (response.StatusCode == HttpStatusCode.OK)
Console.WriteLine(contact.Name);
NewContact newContact = new NewContact();
newContact.Name = "Iosef Tarasov";
newContact.Email = "iosef [email protected]";
(Response response, Contact contact) = freshdesk.CreateContact(newContact);
if (response.StatusCode == HttpStatusCode.Created)
Console.WriteLine(contact.ID);
Contact contact = new Contact();
contact.ID = 28000000002;
contact.Name = "John Wick";
contact.Email = "[email protected]";
(Response response, Contact contact) = freshdesk.UpdateContact(contact);
if (response.StatusCode == HttpStatusCode.OK)
Console.WriteLine(contact.Name);
Response response = freshdesk.DeleteContact(28000000001);
if (response.StatusCode == HttpStatusCode.NoContent)
Console.WriteLine("Iosef didn't make it.");