예제 #1
0
        private static AutomationExecutionLogsApi GetApiInstance(string token, string serverUrl)
        {
            var apiInstance = new AutomationExecutionLogsApi(serverUrl);

            apiInstance.Configuration.AccessToken = token;

            return(apiInstance);
        }
        public static AutomationExecutionLog CreateExecutionLog(AuthAPIManager apiManager, AutomationExecutionLog body)
        {
            AutomationExecutionLogsApi executionLogsApi = new AutomationExecutionLogsApi(apiManager.Configuration);

            try
            {
                return(executionLogsApi.ApiV1AutomationExecutionLogsStartAutomationPost(body));
            }
            catch (Exception ex)
            {
                // In case of Unauthorized request
                if (ex.GetType().GetProperty("ErrorCode").GetValue(ex, null).ToString() == "401")
                {
                    // Refresh Token and Call API
                    executionLogsApi.Configuration.AccessToken = apiManager.GetToken();
                    return(executionLogsApi.ApiV1AutomationExecutionLogsStartAutomationPost(body));
                }
                throw ex;
            }
        }