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
why is endpoint not able to return correct Error code
why is Errorcode property type is int instead of HttpStatus code
why are you checking Errorcode as 0 in the method implentation and returning the same status code(0)
which Httpstatus code is Errorcode: 0 referring to
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 .
Error calling PostAnalyticsConversationsDetailsQuery: Unable to connect to the remote server
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
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.