This repository was archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
FreshdeskClient.CreateContact Method
Jean-Sebastien Carle edited this page Jul 24, 2019
·
6 revisions
Creates a new contact and returns the created contact.
public (Response, Contact) CreateContact(NewContact contact);| Name | Type | Description |
|---|---|---|
| contact | NewContact | The information used to create the new contact. |
This method is returned as a Tuple.
| Type | Description |
|---|---|
| Response | The server response that was returned by the request. |
| Contact | The created contact. Is null if the contact was not created. |
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");
NewContact newContact = new NewContact();
newContact.Name = "Iosef Tarasov";
newContact.Email = "iosef tarasov@mafia.ru";
(Response response, Contact contact) = freshdesk.CreateContact(newContact);
if (response.StatusCode == HttpStatusCode.Created)
Console.WriteLine(contact.ID);
}
}
}ℹ️ The Response StatusCode will return HttpStatusCode.Created if the contact was successfully created.