/// <summary> /// This method is used to get the details of a bulk read job performed previously. /// </summary> /// <param name="jobId">The unique ID of the bulk read job.</param> public static void GetBulkReadJobDetails(long jobId) { //example //long jobId = 347702; //Get instance of BulkReadOperations Class BulkReadOperations bulkReadOperations = new BulkReadOperations(); //Call GetBulkReadJobDetails method that takes jobId as parameter APIResponse <ResponseHandler> response = bulkReadOperations.GetBulkReadJobDetails(jobId); 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 API.BulkRead.ResponseHandler responseHandler = response.Object; if (responseHandler is ResponseWrapper) { //Get the received ResponseWrapper instance ResponseWrapper responseWrapper = (API.BulkRead.ResponseWrapper)responseHandler; //Get the list of obtained jobDetail instances List <JobDetail> jobDetails = responseWrapper.Data; foreach (JobDetail jobDetail in jobDetails) { //Get the Job ID of each jobDetail Console.WriteLine("Bulk read Job ID: " + jobDetail.Id); //Get the Operation of each jobDetail Console.WriteLine("Bulk read Operation: " + jobDetail.Operation); //Get the Operation of each jobDetail Console.WriteLine("Bulk read State: " + jobDetail.State.Value); //Get the Result instance of each jobDetail Result result = jobDetail.Result; //Check if Result is not null if (result != null) { //Get the Page of the Result Console.WriteLine("Bulkread Result Page: " + result.Page); //Get the Count of the Result Console.WriteLine("Bulkread Result Count: " + result.Count); //Get the Download URL of the Result Console.WriteLine("Bulkread Result Download URL: " + result.DownloadUrl); //Get the Per_Page of the Result Console.WriteLine("Bulkread Result Per_Page: " + result.PerPage); //Get the MoreRecords of the Result Console.WriteLine("Bulkread Result MoreRecords: " + result.MoreRecords); } // Get the Query instance of each jobDetail API.BulkRead.Query query = jobDetail.Query; if (query != null) { //Get the fields List of each Query List <string> fields = query.Fields; //Check if fields is not null if (fields != null) { foreach (object fieldName in fields) { //Get the Field Name of the Query Console.WriteLine("Bulk read Query Fields: " + fieldName); } } API.Modules.Module module = query.Module; if (module != null) { //Get the Module Name of the Query Console.WriteLine("Bulk Read Query Module APIName: " + module.APIName); //Get the Module Name of the Query Console.WriteLine("Bulk Read Query Module Id: " + module.Id); } // Get the Criteria instance of each Query Criteria criteria = query.Criteria; //Check if criteria is not null if (criteria != null) { PrintCriteria(criteria); } //Get the Page of the Query Console.WriteLine("Bulk read Query Page: " + query.Page); //Get the cvid of the Query Console.WriteLine("Bulk read Query cvid: " + query.Cvid); } //Get the CreatedBy User instance of each jobDetail User createdBy = jobDetail.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the ID of the CreatedBy User Console.WriteLine("Bulkread Created By User-ID: " + createdBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("Bulkread Created By user-Name: " + createdBy.Name); } //Get the CreatedTime of each jobDetail Console.WriteLine("Bulkread CreatedTime: " + jobDetail.CreatedTime); //Get the ID of each jobDetail Console.WriteLine("Bulkread File Type: " + jobDetail.FileType); } } //Check if the request returned an exception else if (responseHandler is API.BulkRead.APIException) { //Get the received APIException instance API.BulkRead.APIException exception = (API.BulkRead.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}) : {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject)); } else { Console.WriteLine("{0} ({1}) : <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
/// <summary> /// <h3> Get EmailTemplate</h3> /// This method is used to get a single Email Template /// </summary> /// <param name="emailTemplateID">The id of the Email Template</param> public static void GetEmailTemplateById(long emailTemplateID) { //Get instance of EmailTemplatesOperations Class EmailTemplatesOperations emailTemplatesOperations = new EmailTemplatesOperations(); //Call GetEmailTemplateById method APIResponse <ResponseHandler> response = emailTemplatesOperations.GetEmailTemplateById(emailTemplateID); 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 EmailTemplate instances List <API.EmailTemplates.EmailTemplate> emailTemplates = responseWrapper.EmailTemplates; foreach (API.EmailTemplates.EmailTemplate emailTemplate in emailTemplates) { //Get the CreatedTime of each EmailTemplate Console.WriteLine("EmailTemplate CreatedTime: " + emailTemplate.CreatedTime); List <Attachment> attachments = emailTemplate.Attachments; if (attachments != null) { foreach (Attachment attachment in attachments) { //Get the Size of each Attachment Console.WriteLine("EmailTemplate Attachment Size: " + attachment.Size); //Get the FileId of each Attachment Console.WriteLine("EmailTemplate Attachment FileId: " + attachment.FileId); //Get the FileName of each Attachment Console.WriteLine("EmailTemplate Attachment FileName: " + attachment.FileName); //Get the Id of each Attachment Console.WriteLine("EmailTemplate Attachment ID: " + attachment.Id); } } //Get the Subject of each EmailTemplate Console.WriteLine("EmailTemplate Subject: " + emailTemplate.Subject); API.Modules.Module module = emailTemplate.Module; if (module != null) { //Get the Module Name of the EmailTemplate Console.WriteLine("EmailTemplate Module Name : " + module.APIName); //Get the Module Id of the EmailTemplate Console.WriteLine("EmailTemplate Module Id : " + module.Id); } //Get the Type of each EmailTemplate Console.WriteLine("EmailTemplate Type: " + emailTemplate.Type); //Get the CreatedBy User instance of each EmailTemplate User createdBy = emailTemplate.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the Id of the CreatedBy User Console.WriteLine("EmailTemplate Created By User-ID: " + createdBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("EmailTemplate Created By User-Name: " + createdBy.Name); Console.WriteLine("EmailTemplate Created By User-Email : " + createdBy.Email); } //Get the ModifiedTime of each EmailTemplate Console.WriteLine("EmailTemplate ModifiedTime: " + emailTemplate.ModifiedTime); //Get the Folder instance of each EmailTemplate API.EmailTemplates.EmailTemplate folder = emailTemplate.Folder; //Check if folder is not null if (folder != null) { //Get the Id of the Folder Console.WriteLine("EmailTemplate Folder Id: " + folder.Id); //Get the Name of the Folder Console.WriteLine("EmailTemplate Folder Name: " + folder.Name); } //Get the LastUsageTime of each EmailTemplate Console.WriteLine("EmailTemplate LastUsageTime: " + emailTemplate.LastUsageTime); //Get the Associated of each EmailTemplate Console.WriteLine("EmailTemplate Associated: " + emailTemplate.Associated); //Get the name of each EmailTemplate Console.WriteLine("EmailTemplate Name: " + emailTemplate.Name); //Get the ConsentLinked of each EmailTemplate Console.WriteLine("EmailTemplate ConsentLinked: " + emailTemplate.ConsentLinked); //Get the modifiedBy User instance of each EmailTemplate User modifiedBy = emailTemplate.ModifiedBy; //Check if modifiedBy is not null if (modifiedBy != null) { //Get the ID of the ModifiedBy User Console.WriteLine("EmailTemplate Modified By User-ID: " + modifiedBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("EmailTemplate Modified By User-Name: " + modifiedBy.Name); Console.WriteLine("EmailTemplate Modified By User-Email : " + modifiedBy.Email); } //Get the ID of each EmailTemplate Console.WriteLine("EmailTemplate Id: " + emailTemplate.Id); //Get the EditorMode each EmailTemplate Console.WriteLine("EmailTemplate EditorMode: " + emailTemplate.EditorMode); //Get the Content of each EmailTemplate Console.WriteLine("EmailTemplate Content: " + emailTemplate.Content); // Get the Description of each EmailTemplate Console.WriteLine("EmailTemplate Description: " + emailTemplate.Description); // Get the EditorMode of each EmailTemplate Console.WriteLine("EmailTemplate EditorMode: " + emailTemplate.EditorMode); // Get the Favourite of each EmailTemplate Console.WriteLine("EmailTemplate Favourite: " + emailTemplate.Favorite); // Get the Favourite of each EmailTemplate Console.WriteLine("EmailTemplate Subject: " + emailTemplate.Subject); } } //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 <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
/// <summary> /// This method is used to get the details of a Bulk Write job performed previously. /// </summary> /// <param name="jobId">The unique ID of the Bulk Write job.</param> public static void GetBulkWriteJobDetails(long jobId) { //example //long jobId = 3477003; //Get instance of BulkWriteOperations Class BulkWriteOperations bulkWriteOperations = new BulkWriteOperations(); //Call GetBulkWriteJobDetails method that takes jobId as parameter APIResponse <ResponseWrapper> response = bulkWriteOperations.GetBulkWriteJobDetails(jobId); 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 ResponseWrapper responseWrapper = response.Object; if (responseWrapper is BulkWriteResponse) { //Get the received BulkWriteResponse instance BulkWriteResponse bulkWriteResponse = (BulkWriteResponse)responseWrapper; //Get the Job Status of each bulkWriteResponse Console.WriteLine("Bulk Write Job Status: " + bulkWriteResponse.Status); //Get the CharacterEncoding of each bulkWriteResponse Console.WriteLine("Bulk Write CharacterEncoding: " + bulkWriteResponse.CharacterEncoding); List <Resource> resources = bulkWriteResponse.Resource; if (resources != null) { foreach (Resource resource in resources) { //Get the Status of each Resource Console.WriteLine("Bulk Write Resource Status: " + resource.Status.Value); //Get the Type of each Resource Console.WriteLine("Bulk Write Resource Type: " + resource.Type.Value); API.Modules.Module module = resource.Module; if (module != null) { //Get the Module Name of the Resource Console.WriteLine("Bulkwrite Resource Module Name : " + module.APIName); //Get the Module Id of the Resource Console.WriteLine("Bulkwrite Resource Module Id : " + module.Id); } List <FieldMapping> fieldMappings = resource.FieldMappings; if (fieldMappings != null) { foreach (FieldMapping fieldMapping in fieldMappings) { //Get the APIName of each FieldMapping Console.WriteLine("Bulk Write Resource FieldMapping Module: " + fieldMapping.APIName); if (fieldMapping.Index != null) { //Get the Index of each FieldMapping Console.WriteLine("Bulk Write Resource FieldMapping Index: " + fieldMapping.Index); } if (fieldMapping.Format != null) { //Get the Format of each FieldMapping Console.WriteLine("Bulk Write Resource FieldMapping Format: " + fieldMapping.Format); } if (fieldMapping.FindBy != null) { //Get the FindBy of each FieldMapping Console.WriteLine("Bulk Write Resource FieldMapping FindBy: " + fieldMapping.FindBy); } if (fieldMapping.Module != null) { //Get the FindBy of each FieldMapping Console.WriteLine("Bulkwrite Resource FieldMapping Module: " + fieldMapping.Module); } if (fieldMapping.DefaultValue != null) { //Get all entries from the keyValues map foreach (KeyValuePair <string, object> entry in fieldMapping.DefaultValue) { //Get each value from the map Console.WriteLine(entry.Key + " : " + JsonConvert.SerializeObject(entry.Value)); } } } } if (resource.FindBy != null) { //Get the FindBy of each Resource Console.WriteLine("Bulkwrite Resource FindBy: " + resource.FindBy); } Com.Zoho.Crm.API.BulkWrite.File file = resource.File; if (file != null) { //Get the Status of each File Console.WriteLine("Bulk Write Resource File Status: " + file.Status.Value); //Get the Name of each File Console.WriteLine("Bulk Write Resource File Name: " + file.Name); //Get the AddedCount of each File Console.WriteLine("Bulk Write Resource File AddedCount: " + file.AddedCount); //Get the SkippedCount of each File Console.WriteLine("Bulk Write Resource File SkippedCount: " + file.SkippedCount); //Get the UpdatedCount of each File Console.WriteLine("Bulk Write Resource File UpdatedCount: " + file.UpdatedCount); //Get the TotalCount of each File Console.WriteLine("Bulk Write Resource File TotalCount: " + file.TotalCount); } Console.WriteLine("Bulk Write Resource Code: " + resource.Code); } } //Get the ID of each BulkWriteResponse Console.WriteLine("Bulk Write ID: " + bulkWriteResponse.Id); CallBack callback = bulkWriteResponse.Callback; if (callback != null) { //Get the CallBack Url Console.WriteLine("Bulk Write CallBack Url: " + callback.Url); //Get the CallBack Method Console.WriteLine("Bulk Write CallBack Method: " + callback.Method.Value); } Result result = bulkWriteResponse.Result; if (result != null) { //Get the DownloadUrl of the Result Console.WriteLine("Bulk Write DownloadUrl: " + result.DownloadUrl); } //Get the CreatedBy User instance of each BulkWriteResponse User createdBy = bulkWriteResponse.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the ID of the CreatedBy User Console.WriteLine("Bulkread Created By User-ID: " + createdBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("Bulkread Created By User-Name: " + createdBy.Name); } //Get the Operation of each BulkWriteResponse Console.WriteLine("Bulk Write Operation: " + bulkWriteResponse.Operation); //Get the CreatedTime of each BulkWriteResponse Console.WriteLine("Bulk Write File CreatedTime: " + bulkWriteResponse.CreatedTime); } //Check if the request returned an exception else if (responseWrapper is APIException) { //Get the received APIException instance APIException exception = (APIException)responseWrapper; //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}) : {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject)); } else { Console.WriteLine("{0} ({1}) : <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
public static void GetAssignmentRule(long ruleId) { //Get instance of AssignmentRulesOperations Class AssignmentRulesOperations assignmentRulesOperations = new AssignmentRulesOperations(); ParameterMap paramInstance = new ParameterMap(); paramInstance.Add(GetAssignmentRuleParam.MODULE, "Leads"); //Call GetAssignmentRules method APIResponse <API.AssignmentRules.ResponseHandler> response = assignmentRulesOperations.GetAssignmentRule(ruleId, paramInstance); 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 API.AssignmentRules.ResponseHandler responseHandler = response.Object; if (responseHandler is API.AssignmentRules.ResponseWrapper) { //Get the received ResponseWrapper instance API.AssignmentRules.ResponseWrapper responseWrapper = (API.AssignmentRules.ResponseWrapper)responseHandler; //Get the list of obtained AssignmentRule instances List <AssignmentRule> assignmentRules = responseWrapper.AssignmentRules; foreach (AssignmentRule assignmentRule in assignmentRules) { //Get the modifiedTime of each AssignmentRule Console.WriteLine("AssignmentRule ModifiedTime : "); Console.WriteLine(assignmentRule.ModifiedTime); //Get the createdTime of each AssignmentRule Console.WriteLine("AssignmentRule CreatedTime : "); Console.WriteLine(assignmentRule.CreatedTime); DefaultUser defaultAssignee = assignmentRule.DefaultAssignee; if (defaultAssignee != null) { //Get the id of DefaultAssignee Console.WriteLine("AssignmentRule DefaultAssignee Id : " + defaultAssignee.Id); //Get the name of DefaultAssignee Console.WriteLine("AssignmentRule DefaultAssignee Name : " + defaultAssignee.Name); } API.Modules.Module module = assignmentRule.Module; if (module != null) { //Get the id of Module Console.WriteLine("AssignmentRule Module Id : " + module.Id); //Get the apiName of Module Console.WriteLine("AssignmentRule Module APIName : " + module.APIName); } //Get the name of each AssignmentRule Console.WriteLine("AssignmentRule Name : " + assignmentRule.Name); User modifiedBy = assignmentRule.ModifiedBy; if (modifiedBy != null) { //Get the id of ModifiedBy Console.WriteLine("AssignmentRule ModifiedBy Id : " + modifiedBy.Id); //Get the name of ModifiedBy Console.WriteLine("AssignmentRule ModifiedBy Name : " + modifiedBy.Name); //Get the email of ModifiedBy Console.WriteLine("AssignmentRule ModifiedBy User-Email : " + modifiedBy.Email); } User createdBy = assignmentRule.CreatedBy; if (createdBy != null) { //Get the id of CreatedBy Console.WriteLine("AssignmentRule CreatedBy Id : " + createdBy.Id); //Get the name of CreatedBy Console.WriteLine("AssignmentRule CreatedBy Name : " + createdBy.Name); //Get the email of CreatedBy Console.WriteLine("AssignmentRule CreatedBy User-Email : " + createdBy.Email); } //Get the id of each AssignmentRule Console.WriteLine("AssignmentRule Id : " + assignmentRule.Id); //Get the description of each AssignmentRule Console.WriteLine("AssignmentRule Description : " + assignmentRule.Description); } } //Check if the request returned an exception else if (responseHandler is API.AssignmentRules.APIException) { //Get the received APIException instance API.AssignmentRules.APIException exception = (API.AssignmentRules.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 <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
public static void GetInventoryTemplates(string moduleName) { // string moduleAPIName = "Quotes"; string sortBy = "Modified_Time"; string sortOrder = "desc"; string category = "Created_By"; //Get instance of InventoryTemplatesOperations Class InventoryTemplatesOperations inventoryTemplatesOperations = new InventoryTemplatesOperations(sortBy, sortOrder, category); ParameterMap parameter = new ParameterMap(); parameter.Add(GetInventoryTemplatesParam.MODULE, moduleName); //Call GetInventoryTemplates method APIResponse <ResponseHandler> response = inventoryTemplatesOperations.GetInventoryTemplates(parameter); 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 InventoryTemplate instances List <API.InventoryTemplates.InventoryTemplate> inventoryTemplates = responseWrapper.InventoryTemplates; foreach (API.InventoryTemplates.InventoryTemplate inventoryTemplate in inventoryTemplates) { //Get the CreatedTime of each InventoryTemplate Console.WriteLine("InventoryTemplate CreatedTime: " + inventoryTemplate.CreatedTime); // Get the Subject of each InventoryTemplate Console.WriteLine("InventoryTemplate Subject: " + inventoryTemplate.Subject); API.Modules.Module module = inventoryTemplate.Module; if (module != null) { //Get the Module Name of the InventoryTemplate Console.WriteLine("InventoryTemplate Module Name : " + module.APIName); //Get the Module Id of the InventoryTemplate Console.WriteLine("InventoryTemplate Module Id : " + module.Id); } //Get the Type of each InventoryTemplate Console.WriteLine("InventoryTemplate Type: " + inventoryTemplate.Type); //Get the CreatedBy User instance of each InventoryTemplate User createdBy = inventoryTemplate.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the Id of the CreatedBy User Console.WriteLine("InventoryTemplate Created By User-ID: " + createdBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("InventoryTemplate Created By User-Name: " + createdBy.Name); } //Get the ModifiedTime of each InventoryTemplate Console.WriteLine("InventoryTemplate ModifiedTime: " + inventoryTemplate.ModifiedTime); //Get the Folder instance of each InventoryTemplate API.InventoryTemplates.InventoryTemplate folder = inventoryTemplate.Folder; //Check if folder is not null if (folder != null) { //Get the Id of the Folder Console.WriteLine("InventoryTemplate Folder Id: " + folder.Id); //Get the Name of the Folder Console.WriteLine("InventoryTemplate Folder Name: " + folder.Name); } //Get the LastUsageTime of each InventoryTemplate Console.WriteLine("InventoryTemplate LastUsageTime: " + inventoryTemplate.LastUsageTime); // Get the Associated of each InventoryTemplate Console.WriteLine("InventoryTemplate Associated: " + inventoryTemplate.Associated); //Get the name of each InventoryTemplate Console.WriteLine("InventoryTemplate Name: " + inventoryTemplate.Name); //Get the modifiedBy User instance of each InventoryTemplate User modifiedBy = inventoryTemplate.ModifiedBy; //Check if modifiedBy is not null if (modifiedBy != null) { //Get the ID of the ModifiedBy User Console.WriteLine("InventoryTemplate Modified By User-ID: " + modifiedBy.Id); //Get the Name of the CreatedBy User Console.WriteLine("InventoryTemplate Modified By User-Name: " + modifiedBy.Name); } //Get the ID of each InventoryTemplate Console.WriteLine("InventoryTemplate Id: " + inventoryTemplate.Id); //Get the EditorMode each InventoryTemplate Console.WriteLine("InventoryTemplate EditorMode: " + inventoryTemplate.EditorMode); Console.WriteLine("InventoryTemplate Content: " + inventoryTemplate.Content); // Get the Description of each InventoryTemplate Console.WriteLine("InventoryTemplate Description: " + inventoryTemplate.Description); // Get the EditorMode of each InventoryTemplate Console.WriteLine("InventoryTemplate EditorMode: " + inventoryTemplate.EditorMode); //Get the Favorite of each InventoryTemplate Console.WriteLine("InventoryTemplate Favorite: " + inventoryTemplate.Favorite); } API.Record.Info info = responseWrapper.Info; Console.WriteLine("InventoryTemplate Info PerPage : " + info.PerPage); Console.WriteLine("InventoryTemplate Info Count : " + info.Count); Console.WriteLine("InventoryTemplate Info Page : " + info.Page); Console.WriteLine("InventoryTemplate Info MoreRecords : " + info.MoreRecords); } //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 <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
public static void GetWizards() { //Get instance of WizardsOperations Class WizardsOperations wizardsOperations = new WizardsOperations(); //Call GetWizards method APIResponse <ResponseHandler> response = wizardsOperations.GetWizards(); 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 Wizard instances List <API.Wizards.Wizard> wizards = responseWrapper.Wizards; foreach (API.Wizards.Wizard wizard in wizards) { //Get the CreatedTime of each Wizard Console.WriteLine("Wizard CreatedTime: " + wizard.CreatedTime); //Get the PermissionType of each Wizard Console.WriteLine("Wizard ModifiedTime: " + wizard.ModifiedTime); //Get the manager User instance of each Wizard API.Modules.Module module = wizard.Module; //Check if manager is not null if (module != null) { //Get the Name of the Manager Console.WriteLine("Wizard Module APIName: " + module.APIName); //Get the ID of the Manager Console.WriteLine("Wizard Module Id: " + module.Id); } //Get the Name of each Wizard Console.WriteLine("Wizard Name: " + wizard.Name); //Get the modifiedBy User instance of each Wizard API.Users.User modifiedBy = wizard.ModifiedBy; //Check if modifiedBy is not null if (modifiedBy != null) { //Get the Name of the modifiedBy User Console.WriteLine("Wizard Modified By User-Name: " + modifiedBy.Name); //Get the ID of the modifiedBy User Console.WriteLine("Wizard Modified By User-ID: " + modifiedBy.Id); } //Get the array of Profile instance each Wizard List <API.Profiles.Profile> profiles = wizard.Profiles; //Check if profiles is not null if (profiles != null) { foreach (API.Profiles.Profile profile in profiles) { //Get the Name of each Profile Console.WriteLine("Wizard Profile Name: " + profile.Name); //Get the ID of each Profile Console.WriteLine("Wizard Profile ID: " + profile.Id); } } //Get the Active of each Wizard Console.WriteLine("Wizard Active: " + wizard.Active); //Get the array of Container instance each Wizard List <API.Wizards.Container> containers = wizard.Containers; //Check if containers is not null if (containers != null) { foreach (API.Wizards.Container container in containers) { //Get the array of Layout instance each Wizard API.Layouts.Layout layout = container.Layout; //Check if layout is not null if (layout != null) { //Get the Name of Layout Console.WriteLine("Wizard Container Layout Name: " + layout.Name); //Get the ID of Layout Console.WriteLine("Wizard Container Layout ID: " + layout.Id); } //Get the ID of each Container Console.WriteLine("Wizard Container ID: " + container.Id); } } //Get the ID of each Wizard Console.WriteLine("Wizard ID: " + wizard.Id); //Get the createdBy User instance of each Wizard User createdBy = wizard.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the Name of the createdBy Wizard Console.WriteLine("Wizard Created By User-Name: " + createdBy.Name); //Get the ID of the createdBy Wizard Console.WriteLine("Wizard Created By User-ID: " + createdBy.Id); } } } //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 <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }
public static void GetWizardById(long?id, string layoutId) { //Get instance of WizardsOperations Class WizardsOperations wizardsOperations = new WizardsOperations(); ParameterMap paramInstance = new ParameterMap(); paramInstance.Add(GetWizardbyIDParam.LAYOUT_ID, layoutId); //Call GetWizardById method APIResponse <ResponseHandler> response = wizardsOperations.GetWizardById(id, paramInstance); 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 Wizard instances List <API.Wizards.Wizard> wizards = responseWrapper.Wizards; foreach (API.Wizards.Wizard wizard in wizards) { //Get the CreatedTime of each Wizard Console.WriteLine("Wizard CreatedTime: " + wizard.CreatedTime); //Get the PermissionType of each Wizard Console.WriteLine("Wizard ModifiedTime: " + wizard.ModifiedTime); //Get the manager User instance of each Wizard API.Modules.Module module = wizard.Module; //Check if manager is not null if (module != null) { //Get the Name of the Manager Console.WriteLine("Wizard Module APIName: " + module.APIName); //Get the ID of the Manager Console.WriteLine("Wizard Module Id: " + module.Id); } //Get the Name of each Wizard Console.WriteLine("Wizard Name: " + wizard.Name); //Get the modifiedBy User instance of each Wizard API.Users.User modifiedBy = wizard.ModifiedBy; //Check if modifiedBy is not null if (modifiedBy != null) { //Get the Name of the modifiedBy User Console.WriteLine("Wizard Modified By User-Name: " + modifiedBy.Name); //Get the ID of the modifiedBy User Console.WriteLine("Wizard Modified By User-ID: " + modifiedBy.Id); } //Get the array of Profile instance each Wizard List <API.Profiles.Profile> profiles = wizard.Profiles; //Check if profiles is not null if (profiles != null) { foreach (API.Profiles.Profile profile in profiles) { //Get the Name of each Profile Console.WriteLine("Wizard Profile Name: " + profile.Name); //Get the ID of each Profile Console.WriteLine("Wizard Profile ID: " + profile.Id); } } //Get the Active of each Wizard Console.WriteLine("Wizard Active: " + wizard.Active); //Get the array of Container instance each Wizard List <Container> containers = wizard.Containers; //Check if containers is not null if (containers != null) { foreach (Container container in containers) { //Get the array of Layout instance each Wizard Layout layout = container.Layout; //Check if layout is not null if (layout != null) { //Get the Name of Layout Console.WriteLine("Wizard Container Layout Name: " + layout.Name); //Get the ID of Layout Console.WriteLine("Wizard Container Layout ID: " + layout.Id); } ChartData chartData = container.ChartData; if (chartData != null) { List <Node> nodes = chartData.Nodes; if (nodes != null) { foreach (Node node in nodes) { Console.WriteLine("Wizard Container ChartData Node PosY: " + node.PosY); Console.WriteLine("Wizard Container ChartData Node PosX: " + node.PosX); Console.WriteLine("Wizard Container ChartData Node StartNode: " + node.StartNode); Screen screen = node.Screen; if (screen != null) { Console.WriteLine("Wizard Container ChartData Node Screen DisplayLabel: " + screen.DisplayLabel); Console.WriteLine("Wizard Container ChartData Node Screen ID: " + screen.Id); } } } List <Connection> connections = chartData.Connections; if (connections != null) { foreach (Connection connection in connections) { Button sourceButton = connection.SourceButton; if (sourceButton != null) { PrintButton(sourceButton); } Screen targetScreen = connection.TargetScreen; if (targetScreen != null) { PrintScreen(targetScreen); } } } Console.WriteLine("Wizard Container ChartData CanvasWidth: " + chartData.CanvasWidth); Console.WriteLine("Wizard Container ChartData CanvasHeight: " + chartData.CanvasHeight); } List <Screen> screens = container.Screens; if (screens != null) { foreach (Screen screen in screens) { PrintScreen(screen); } } //Get the ID of each Container Console.WriteLine("Wizard Container ID: " + container.Id); } } //Get the ID of each Wizard Console.WriteLine("Wizard ID: " + wizard.Id); //Get the createdBy User instance of each Wizard User createdBy = wizard.CreatedBy; //Check if createdBy is not null if (createdBy != null) { //Get the Name of the createdBy Wizard Console.WriteLine("Wizard Created By User-Name: " + createdBy.Name); //Get the ID of the createdBy Wizard Console.WriteLine("Wizard Created By User-ID: " + createdBy.Id); } } } //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 <Indexed>", prop.Name, prop.PropertyType.Name); } } } } }