Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

FreshdeskClient.CreateContact Method

Jean-Sebastien Carle edited this page Jul 24, 2019 · 6 revisions

CreateContact(NewContact)

Creates a new contact and returns the created contact.

public (Response, Contact) CreateContact(NewContact contact);

Parameters

Name Type Description
contact NewContact The information used to create the new contact.

Returns

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.

Examples

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);
        }
    }
}

Remarks

ℹ️ The Response StatusCode will return HttpStatusCode.Created if the contact was successfully created.

Clone this wiki locally