JIRA web request causes issues












0















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 RunQuery(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.










share|improve this question




















  • 1





    I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

    – NthDeveloper
    Jan 1 at 13:29
















0















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 RunQuery(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.










share|improve this question




















  • 1





    I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

    – NthDeveloper
    Jan 1 at 13:29














0












0








0








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 RunQuery(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.










share|improve this question
















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 RunQuery(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.







c# visual-studio rest jira jira-rest-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 13:07









marc_s

580k13011191266




580k13011191266










asked Jul 13 '18 at 8:31









naxcuonaxcuo

37




37








  • 1





    I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

    – NthDeveloper
    Jan 1 at 13:29














  • 1





    I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

    – NthDeveloper
    Jan 1 at 13:29








1




1





I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

– NthDeveloper
Jan 1 at 13:29





I did not work with JIRA API but developed such APIs for our systems. There are always protection mechanisms in Web APIs. Servers always have a max result and max call per second limitations. Even if you specify bigger result count or make more calls, the server applies its own limitations in order to better serve to many clients. You should check the API's documentation, because the remote server is intentionally closing the connection.

– NthDeveloper
Jan 1 at 13:29












1 Answer
1






active

oldest

votes


















0














A few things to try below. If any of these work, it will help you get to the source of the problem.



Try with a request for a small amount of data:



string url = "<your base url>/search?jql=startAt=1&maxResults=1&fields=created";


Try that same url in a web browser (log in to Jira first with the same creds you are using in your C# code)



Try with this code before the call:



        System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
return true;
};


Check the permissions in Jira for the user id you are using for the api call.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51320929%2fjira-web-request-causes-issues%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    A few things to try below. If any of these work, it will help you get to the source of the problem.



    Try with a request for a small amount of data:



    string url = "<your base url>/search?jql=startAt=1&maxResults=1&fields=created";


    Try that same url in a web browser (log in to Jira first with the same creds you are using in your C# code)



    Try with this code before the call:



            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
    {
    return true;
    };


    Check the permissions in Jira for the user id you are using for the api call.






    share|improve this answer




























      0














      A few things to try below. If any of these work, it will help you get to the source of the problem.



      Try with a request for a small amount of data:



      string url = "<your base url>/search?jql=startAt=1&maxResults=1&fields=created";


      Try that same url in a web browser (log in to Jira first with the same creds you are using in your C# code)



      Try with this code before the call:



              System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
      {
      return true;
      };


      Check the permissions in Jira for the user id you are using for the api call.






      share|improve this answer


























        0












        0








        0







        A few things to try below. If any of these work, it will help you get to the source of the problem.



        Try with a request for a small amount of data:



        string url = "<your base url>/search?jql=startAt=1&maxResults=1&fields=created";


        Try that same url in a web browser (log in to Jira first with the same creds you are using in your C# code)



        Try with this code before the call:



                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
        {
        return true;
        };


        Check the permissions in Jira for the user id you are using for the api call.






        share|improve this answer













        A few things to try below. If any of these work, it will help you get to the source of the problem.



        Try with a request for a small amount of data:



        string url = "<your base url>/search?jql=startAt=1&maxResults=1&fields=created";


        Try that same url in a web browser (log in to Jira first with the same creds you are using in your C# code)



        Try with this code before the call:



                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate X509certificate, X509Chain chain, System.Net.Security.SslPolicyErrors errors)
        {
        return true;
        };


        Check the permissions in Jira for the user id you are using for the api call.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 16:51









        tonitoni

        5618




        5618
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51320929%2fjira-web-request-causes-issues%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            'app-layout' is not a known element: how to share Component with different Modules