C# SDK Samples - Contact Roles Operations

Get Contact Roles
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to get all the Contact Roles and print the response.
        /// 
        public static void GetContactRoles()
        {
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Call GetContactRoles method
            APIResponse<ResponseHandler> response = contactRolesOperations.GetContactRoles();
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                if(new List<int>() { 204, 304 }.Contains(response.StatusCode))
                {
                    Console.WriteLine(response.StatusCode == 204? "No Content" : "Not Modified");
                    return;
                }
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ResponseHandler responseHandler = response.Object;
                    if(responseHandler is ResponseWrapper)
                    {
                        //Get the received ResponseWrapper instance
                        ResponseWrapper responseWrapper = (ResponseWrapper) responseHandler;
                        //Get the list of obtained ContactRole instances
                        List<ContactRole> contactRoles = responseWrapper.ContactRoles;
                        foreach(ContactRole contactRole in contactRoles)
                        {
                            //Get the ID of each ContactRole
                            Console.WriteLine("ContactRole ID: " + contactRole.Id);
                            //Get the name of each ContactRole
                            Console.WriteLine("ContactRole Name: " + contactRole.Name);
                            //Get the sequence number each ContactRole
                            Console.WriteLine("ContactRole SequenceNumber: " + contactRole.SequenceNumber);
                        }
                    }
                    //Check if the request returned an exception
                    else if(responseHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) responseHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach(KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}
 
Create Contact Roles
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to create Contact Roles and print the response.
        /// 
        public static void CreateContactRoles()
        {
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Get instance of BodyWrapper Class that will contain the request body
            BodyWrapper bodyWrapper = new BodyWrapper();
            //List of ContactRole instances
            List<ContactRole> contactRoles = new List<ContactRole>();
            for(int i = 1; i ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
}
 
Update Contact Roles
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to update Contact Roles and print the response.
        /// 
        public static void UpdateContactRoles()
        {
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Get instance of BodyWrapper Class that will contain the request body
            BodyWrapper bodyWrapper = new BodyWrapper();
            //List of ContactRole instances
            List<ContactRole> contactRolesList = new List<ContactRole>();
            //Get instance of ContactRole Class
            ContactRole cr1 = new ContactRole();
            //Set ID to the ContactRole instance
            cr1.Id = 3477061000007540001;
            //Set name to the ContactRole instance
            cr1.Name = "Edited122";
            //Add ContactRole instance to the list
            contactRolesList.Add(cr1);
            //Get instance of ContactRole Class
            ContactRole cr2 = new ContactRole();
            //Set ID to the ContactRole instance
            cr2.Id = 3477061000007540002;
            //Set name to the ContactRole instance
            //cr2.Name = "Edit";
            //Add ContactRole instance to the list
            contactRolesList.Add(cr2);
            //Set the list to contactRoles in BodyWrapper instance
            bodyWrapper.ContactRoles = contactRolesList;
            //Call UpdateContactRoles method that takes BodyWrapper instance as parameter
            APIResponse<ActionHandler> response = contactRolesOperations.UpdateContactRoles(bodyWrapper);
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ActionHandler actionHandler = response.Object;
                    if(actionHandler is ActionWrapper)
                    {
                        //Get the received ActionWrapper instance
                        ActionWrapper actionWrapper = (ActionWrapper) actionHandler;
                        //Get the list of obtained ActionResponse instances
                        List<ActionResponse> actionResponses = actionWrapper.ContactRoles;
                        foreach(ActionResponse actionResponse in actionResponses)
                        {
                            //Check if the request is successful
                            if(actionResponse is SuccessResponse)
                            {
                                //Get the received SuccessResponse instance
                                SuccessResponse successResponse = (SuccessResponse)actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + successResponse.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + successResponse.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach(KeyValuePair<string, object> entry in successResponse.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + successResponse.Message.Value);
                            }
                            //Check if the request returned an exception
                            else if(actionResponse is APIException)
                            {
                                //Get the received APIException instance
                                APIException exception = (APIException) actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + exception.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + exception.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach(KeyValuePair<string, object> entry in exception.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + exception.Message.Value);
                            }
                        }
                    }
                    //Check if the request returned an exception
                    else if(actionHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) actionHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach( KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}
 
Delete Contact Roles
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to delete Contact Roles and print the response.
        /// 
        /// The List of ContactRole IDs to be deleted.
        public static void DeleteContactRoles(List<long> contactRoleIds)
        {
            //example
            //List<long> contactRoleIds = new List<long>() { 3477061000005208001, 3477061000005208002, 3477061000005177003, 3477061000006104001 };
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Get instance of ParameterMap Class
            ParameterMap paramInstance = new ParameterMap();
            foreach(long id in contactRoleIds)
            {
                paramInstance.Add(DeleteContactRolesParam.IDS, id);
            }
            //Call DeleteContactRoles method that takes paramInstance as parameter 
            APIResponse<ActionHandler> response = contactRolesOperations.DeleteContactRoles(paramInstance);
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ActionHandler actionHandler = response.Object;
                    if(actionHandler is ActionWrapper)
                    {
                        //Get the received ActionWrapper instance
                        ActionWrapper actionWrapper = (ActionWrapper) actionHandler;
                        //Get the list of obtained ContactRole instances
                        List<ActionResponse> actionResponses = actionWrapper.ContactRoles;
                        foreach(ActionResponse actionResponse in actionResponses)
                        {
                            //Check if the request is successful
                            if(actionResponse is SuccessResponse)
                            {
                                //Get the received SuccessResponse instance
                                SuccessResponse successResponse = (SuccessResponse)actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + successResponse.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + successResponse.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in successResponse.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + successResponse.Message.Value);
                            }
                            //Check if the request returned an exception
                            else if(actionResponse is APIException)
                            {
                                //Get the received APIException instance
                                APIException exception = (APIException) actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + exception.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + exception.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in exception.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + exception.Message.Value);
                            }
                        }
                    }
                    //Check if the request returned an exception
                    else if(actionHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) actionHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach( KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}
 
Get a Contact Role
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to get single Contact Role with ID and print the response.
        /// 
        /// The ID of the ContactRole to be obtained
        public static void GetContactRole(long contactRoleId)
        {
            //example
            //long contactRoleId = 3477061000005177004;
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Call GetContactRole method that takes contactRoleId as parameter
            APIResponse<ResponseHandler> response = contactRolesOperations.GetContactRole(contactRoleId);
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                if(new List<int>() { 204, 304 }.Contains(response.StatusCode))
                {
                    Console.WriteLine(response.StatusCode == 204? "No Content" : "Not Modified");
                    return;
                }
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ResponseHandler responseHandler = response.Object;
                    if(responseHandler is ResponseWrapper)
                    {
                        //Get the received ResponseWrapper instance
                        ResponseWrapper responseWrapper = (ResponseWrapper) responseHandler;
                        //Get the list of obtained ContactRole instances
                        List<ContactRole> contactRoles = responseWrapper.ContactRoles;
                        foreach(ContactRole contactRole in contactRoles)
                        {
                            //Get the ID of each ContactRole
                            Console.WriteLine("ContactRole ID: " + contactRole.Id);
                            //Get the name of each ContactRole
                            Console.WriteLine("ContactRole Name: " + contactRole.Name);
                            //Get the sequence number each ContactRole
                            Console.WriteLine("ContactRole SequenceNumber: " + contactRole.SequenceNumber);
                        }
                    }
                    //Check if the request returned an exception
                    else if(responseHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) responseHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach( KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}
 
Update a Contact Role
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
        /// 
        /// This method is used to update single Contact Role with ID and print the response.
        /// 
        /// The ID of the ContactRole to be updated
        public static void UpdateContactRole(long contactRoleId)
        {
            //ID of the ContactRole to be updated
            //long contactRoleId = 525508000005067923;
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Get instance of BodyWrapper Class that will contain the request body
            BodyWrapper bodyWrapper = new BodyWrapper();
            //List of ContactRole instances
            List<ContactRole> contactRolesList = new List<ContactRole>();
            //Get instance of ContactRole Class
            ContactRole cr1 = new ContactRole();
            //Set name to the ContactRole instance
            cr1.Name = "contactRoleUpdate1";
            //Set sequence number to the ContactRole instance
            cr1.SequenceNumber = 2;
            //Add ContactRole instance to the list
            contactRolesList.Add(cr1);
            //Set the list to contactRoles in BodyWrapper instance
            bodyWrapper.ContactRoles = contactRolesList;
            //Call UpdateContactRole method that takes contactRoleId  and BodyWrapper instance as parameters
            APIResponse<ActionHandler> response = contactRolesOperations.UpdateContactRole(contactRoleId, bodyWrapper);
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ActionHandler actionHandler = response.Object;
                    if(actionHandler is ActionWrapper)
                    {
                        //Get the received ActionWrapper instance
                        ActionWrapper actionWrapper = (ActionWrapper) actionHandler;
                        //Get the list of obtained ActionResponse instances
                        List<ActionResponse> actionResponses = actionWrapper.ContactRoles;
                        foreach(ActionResponse actionResponse in actionResponses)
                        {
                            //Check if the request is successful
                            if(actionResponse is SuccessResponse)
                            {
                                //Get the received SuccessResponse instance
                                SuccessResponse successResponse = (SuccessResponse)actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + successResponse.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + successResponse.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in successResponse.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + successResponse.Message.Value);
                            }
                            //Check if the request returned an exception
                            else if(actionResponse is APIException)
                            {
                                //Get the received APIException instance
                                APIException exception = (APIException) actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + exception.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + exception.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in exception.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + exception.Message.Value);
                            }
                        }
                    }
                    //Check if the request returned an exception
                    else if(actionHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) actionHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach( KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}
 
Delete a Contact Role
              
              
using System;
using System.Collections.Generic;
using System.Reflection;
using Com.Zoho.Crm.API;
using Com.Zoho.Crm.API.ContactRoles;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;
using static Com.Zoho.Crm.API.ContactRoles.ContactRolesOperations;
namespace Com.Zoho.Crm.Sample.ContactRoles
{
    public class ContactRoles
    {
    /// 
        /// This method is used to delete single Contact Role with ID and print the response.
        /// 
        /// The ID of the ContactRole to be deleted
        public static void DeleteContactRole(long contactRoleId)
        {
            //ID of the ContactRole to be updated
            //long contactRoleId = 525508000005067923;
            //Get instance of ContactRolesOperations Class
            ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
            //Call DeleteContactRole which takes contactRoleId as parameter
            APIResponse<ActionHandler> response = contactRolesOperations.DeleteContactRole(contactRoleId);
            if(response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);
                //Check if expected response is received
                if(response.IsExpected)
                {
                    //Get object from response
                    ActionHandler actionHandler = response.Object;
                    if(actionHandler is ActionWrapper)
                    {
                        //Get the received ActionWrapper instance
                        ActionWrapper actionWrapper = (ActionWrapper) actionHandler;
                        //Get the list of obtained ActionResponse instances
                        List<ActionResponse> actionResponses = actionWrapper.ContactRoles;
                        foreach(ActionResponse actionResponse in actionResponses)
                        {
                            //Check if the request is successful
                            if(actionResponse is SuccessResponse)
                            {
                                //Get the received SuccessResponse instance
                                SuccessResponse successResponse = (SuccessResponse)actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + successResponse.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + successResponse.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in successResponse.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + successResponse.Message.Value);
                            }
                            //Check if the request returned an exception
                            else if(actionResponse is APIException)
                            {
                                //Get the received APIException instance
                                APIException exception = (APIException) actionResponse;
                                //Get the Status
                                Console.WriteLine("Status: " + exception.Status.Value);
                                //Get the Code
                                Console.WriteLine("Code: " + exception.Code.Value);
                                Console.WriteLine("Details: " );
                                //Get the details map
                                foreach( KeyValuePair<string, object> entry in exception.Details)
                                {
                                    //Get each value in the map
                                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                                }
                                //Get the Message
                                Console.WriteLine("Message: " + exception.Message.Value);
                            }
                        }
                    }
                    //Check if the request returned an exception
                    else if(actionHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException) actionHandler;
                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);
                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);
                        Console.WriteLine("Details: " );
                        //Get the details map
                        foreach( KeyValuePair<string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }
                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;
                    //Get the response object's class
                    Type type = responseObject.GetType();
                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);
                    PropertyInfo[] props = type.GetProperties();
                    Console.WriteLine("Properties (N = {0}):", props.Length);
                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in ", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }
    }
}