Freshdesk.Net is a .NET library for freshdesk.com's REST API. It can be used to create contacts, customers and tickets (with attachments). Freshdesk.Net also runs on Mono, so yay!
Freshdesk.Net is available as a NuGet Package. NuGet package manager the preferred method of integrating Freshdesk.Net into your project.
Click on Tools -> NuGet Package Manager -> Package Manager Console and enter the following
PM> Install-Package Freshdesk
Click on Project -> Add NuGet Packages then search for "Freshdesk", check it off and click Add Package
To use Freshdesk.Net you'll need an account on Freshdesk.com. When you create an account you'll get an instance url (typically: http://YOURCOMPANY.freshdesk.com
). Each user also has their own API Key. Yours can be found by clicking on your profile image, then Profile Settings and it will be listed on the right hand side of the screen. When you use Freshdesk.Net you'll need your site URL and your API Key. It should be noted that all calls made with this library are made as if they're performed by the user whose API Key is used.
This library makes calls to the Freshdesk REST API. This documentation is helpful debugging your application or determining what values to send for various parameters.
All examples are written as if you've added the following using statement to your file...
using Freshdesk;
All functions in Freshdesk.Net are made through the instances of the FreshdeskService class. To create an instance of this class you'll need your API Key and your site url.
FreshdeskService freshdeskService =
new FreshdeskService(
"YOUR_API_KEY",
new Uri("https://YOURCOMPANY.freshdesk.com"));
http://freshdesk.com/api#ticket
http://freshdesk.com/api#create_ticket
GetTicketResponse ticketResponse = freshdeskService.CreateTicket(new CreateTicketRequest()
{
TicketInfo = new CreateTicketInfo()
{
Email = "wilecoyote@acme.com",
Subject = "ACME Super Outfit won't fly!!!",
Description = "I recently purchased an ACME Super Outfit because it was supposed to fly, but it's doesn't work!",
Priority = 1,
Status = 2
}
});
http://freshdesk.com/api#ticket_attachment
var ticketResponse = freshdeskService.CreateTicketWithAttachment(new CreateTicketRequest
{
TicketInfo = new CreateTicketInfo
{
Email = "roadrunner@acme.com",
Subject = "Beep Beep",
Description = "Beep Beep!",
Priority = 1,
Status = 2
}
}, new Collection<Attachment>
{
new Attachment
{
Content = File.OpenRead("beep.txt"),
FileName = "beep.txt"
},
new Attachment
{
Content = File.OpenRead("beep.png"),
FileName = "beep.png"
}
});
http://freshdesk.com/api#companies_attributes
http://freshdesk.com/api#create_customer
GetCustomerResponse customerResponse = freshdeskService.CreateCustomer(new CreateCustomerRequest()
{
Customer = new Customer()
{
Name = "ACME Corp.",
Description = "The ACME Corporation"
}
});
http://freshdesk.com/api#companies_attributes
http://freshdesk.com/api#create_customer
GetUserResponse userResponse = freshdeskService.CreateUser(new CreateUserRequest()
{
User = new User()
{
Name = "Bugs Bunny",
Email = "bugs@acme.com"
}
});