In ApiException object Error code is returning 0 which is not valid Http Status code

Hi @tim.smith , @Becky_Powell and @GenesysCommunity ,
Greetings of the day

RegardingEndpoint mentioned: https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-analytics-conversations-details-query

In ApiException object Error code property is returning 0 which is not valid Http Status code.
This is an intermittent issue and occurs at midnight in IST Timezone.

My queries are listed below

  1. why is endpoint not able to return correct Error code
  2. why is Errorcode property type is int instead of HttpStatus code
  3. why are you checking Errorcode as 0 in the method implentation and returning the same status code(0)
  4. which Httpstatus code is Errorcode: 0 referring to
  5. what are the possible scenarios for returning Error code as 0 from genesys api

As you've noted, a code of 0 is not a valid HTTP status code. This means that the request did not complete. Please inspect the rest of the error to determine what has happened in your application.

Hi @tim.smith ,
but Status Code 0 is received in below scenarios from Genesys .

  1. Error calling PostAnalyticsConversationsDetailsQuery: Unable to connect to the remote server
  2. Error calling PostAnalyticsConversationsDetailsQuery: An error occurred while sending the request
    Code snippet from Genesys SDK implentation in .NET is attached for reference
    public async Task<ApiResponse<AsyncQueryResponse>> PostAnalyticsConversationsDetailsJobsAsyncWithHttpInfo(AsyncConversationQuery body)
    {
        if (body == null)
        {
            throw new ApiException(400, "Missing required parameter 'body' when calling AnalyticsApi->PostAnalyticsConversationsDetailsJobs");
        }

        string path = "/api/v2/analytics/conversations/details/jobs";
        Dictionary<string, string> dictionary = new Dictionary<string, string>();
        List<Tuple<string, string>> queryParams = new List<Tuple<string, string>>();
        Dictionary<string, string> dictionary2 = new Dictionary<string, string>(Configuration.DefaultHeader);
        Dictionary<string, string> formParams = new Dictionary<string, string>();
        Dictionary<string, FileParameter> fileParams = new Dictionary<string, FileParameter>();
        string[] contentTypes = new string[1] { "application/json" };
        string contentType = Configuration.ApiClient.SelectHeaderContentType(contentTypes);
        string[] accepts = new string[1] { "application/json" };
        string text = Configuration.ApiClient.SelectHeaderAccept(accepts);
        if (text != null)
        {
            dictionary2.Add("Accept", text);
        }

        dictionary.Add("format", "json");
        object postBody = ((body == null || !(body.GetType() != typeof(byte[]))) ? ((object)body) : ((object)Configuration.ApiClient.Serialize(body)));
        if (!string.IsNullOrEmpty(Configuration.AccessToken))
        {
            dictionary2["Authorization"] = "Bearer " + Configuration.AccessToken;
        }

        RestResponse restResponse = (RestResponse)(await Configuration.ApiClient.CallApiAsync(path, Method.Post, queryParams, postBody, dictionary2, formParams, fileParams, dictionary, contentType));
        int statusCode = (int)restResponse.StatusCode;
        Dictionary<string, string> headers = restResponse.Headers?.Select((HeaderParameter header) => new
        {
            Name = header.GetType().GetProperty("Name")?.GetValue(header),
            Value = header.GetType().GetProperty("Value")?.GetValue(header)
        }).ToDictionary(header => header?.Name?.ToString(), header => header?.Value?.ToString()) ?? new Dictionary<string, string>();
        if (statusCode >= 400)
        {
            throw new ApiException(statusCode, "Error calling PostAnalyticsConversationsDetailsJobs: " + restResponse.Content, restResponse.Content, headers);
        }

        if (statusCode == 0)
        {
            throw new ApiException(statusCode, "Error calling PostAnalyticsConversationsDetailsJobs: " + restResponse.ErrorMessage, restResponse.ErrorMessage);
        }

        return new ApiResponse<AsyncQueryResponse>(statusCode, headers, (AsyncQueryResponse)Configuration.ApiClient.Deserialize(restResponse, typeof(AsyncQueryResponse)), restResponse.Content, restResponse.StatusDescription);
    }

In the above code snippet 42 line is the cause of the error , you can see that genesys checking 0 status code as well

And what's the error message from that case?

Below are the error messages in that case

  1. Error calling PostAnalyticsConversationsDetailsQuery: An error occurred while sending the request
  2. Error calling PostAnalyticsConversationsDetailsQuery: An error occurred while sending the request

That sounds like your computer is likely having network issues since it's non-specific and definitely isn't coming from Genesys Cloud. I'd suggest working with your IT team to diagnose connectivity issues with the machine you're running this from. Given that your machine is failing at the same time every day, I'd focus your search on anti-virus scans or other timed tasks you may be running on your machine.

We are using
Azure app service and it is running perfectly.
Genesys uswest2 app service might be having problems
Can you cross check

You can check the status of the Genesys Cloud service here: https://status.mypurecloud.com/. There are no active or recent issues.

The HTTP status code of 0 indicates your request did not reach Genesys Cloud.

Yes i validated there ,But it might also due to network load on Genesys.
Why only USWest2 region is having many issues

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.