Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Why am i getting "The operation has timed out" when i try to exract data ?

Nada El Boustaoui July 13, 2018

0down votefavorite

I am trying to to extract data from Jira via JIRA REST API from a c# application. to do so i execute this method :

public string RunQuerry(JiraRessource resource, string project_id, int startAt, int maxResults, string method = "GET")
        {
             string url = string.Format(m_BaseUrl);
            if (project_id != null)
            {
                string jql = "search?jql=project=" + project_id;                url = string.Format("{0}{1}", url, jql);
            }
            string jqr = "&startAt=" + startAt + "&maxResults=" + maxResults;            url = string.Format("{0}{1}", url, jqr);

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;            request.ContentType = "application/json";            request.Method = method;

            string base64Credentials = GetEncodedCredentials();            request.Headers.Add("Authorization", "Basic " + base64Credentials);
            string result = string.Empty;            using (WebResponse response = request.GetResponse())
            {                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {                    result = reader.ReadToEnd();
                    return result;
                }
            }
        }

i execute this method in a loop in order to be able to get all issues after i read that the REST API only gives 50 issues each time. I get errors such as "connection timed out" or "unable to read data from the transport connection". i searched online and all i found is that the connection to the server is lost but i do not know how to solve this. If anyone knows anything about the reason why i'm getting this error or how to solve it i will be very thankful.

1 answer

1 accepted

0 votes
Answer accepted
Nada El Boustaoui July 17, 2018

The problem is that although i put a condition on the StartAt it always starts form 0 while extracting the data. 

for example if i use the link :

http://eudca-jira01/jira/rest/api/latest/search?jql=project=C1A&startAt=0&maxResults=50 

i get the first last 50 issues on my list. But if i use the following :

http://eudca-jira01/jira/rest/api/latest/search?jql=project=C1A&startAt=50&maxResults=100

the result is 100 issues it includes the first 50 issues too. 
so after it gets to thousands of issues the data becomes voluminous and it breaks the connection. 

does anyone have any idea on how to set the startAt parameter in other to only get the issues in the chosen range of values ?? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events