-
Notifications
You must be signed in to change notification settings - Fork 2
FreshdeskClient.GetContacts Method
| Method | Description |
|---|---|
| GetContacts() | Retrieves all contacts and returns them as a single list object. |
| GetContacts(NameValueCollection) | Retrieves contacts according to the filters specified and returns them as a single list object. |
Retrieves all contacts and returns them as a single list object.
public (Response, List<Contact>) GetContacts();This method is returned as a Tuple.
| Type | Description |
|---|---|
| Response | The server response that was returned by the request. |
| List<Contact> | A list of contacts. |
The following code example demonstrates this method.
using Freshdesk;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
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);
}
}
}ℹ️ The Response StatusCode will return HttpStatusCode.OK if the contact was successfully retrieved.
Retrieves contacts according to the filters specified and returns them as a single list object.
public (Response, List<Contact>) GetContacts(NameValueCollection filter);| Name | Type | Description |
|---|---|---|
| filter | NameValueCollection | A NameValueCollection of filters to apply to the request. |
This method is returned as a Tuple.
| Type | Description |
|---|---|
| Response | The server response that was returned by the request. |
| List<Contact> | A list of contacts. |
The following code example demonstrates this method.
using Freshdesk;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string freshdeskDomain = "yourcompany.freshdesk.com";
string apiKey = "yourapikey";
FreshdeskClient freshdesk = new FreshdeskClient(freshdeskDomain, apiKey, "X");
NameValueCollection filters = new NameValueCollection();
filters.Add("email", "john.wick@hightable.org");
(Response response, List<Contact> contacts) = freshdesk.GetContacts(filters);
if (response.StatusCode == HttpStatusCode.OK)
Console.WriteLine(contacts.Count);
}
}
}ℹ️ The Response StatusCode will return HttpStatusCode.OK if the contact was successfully retrieved.