Пример #1
0
        public string IssueInfo()
        {
            string result;
            var    provider        = JiraOAuth1AProvider;
            var    jiraCredentials = JiraApplicationCredentials;

            var accessToken       = Session["access_token"] as string;
            var accessTokenSecret = Session["accessTokenSecret"] as string;

            const string issueId = "TEST-1";

            string fullUrl = "http://172.25.121.176:8080/rest/api/2/issue/" + issueId;

            var http = new Http {
                Url = new Uri(fullUrl)
            };

            http.ApplyAccessTokenToHeader(provider, jiraCredentials, accessToken, accessTokenSecret, "GET");

            var request = WebRequest.Create(fullUrl);

            request.Headers["Authorization"] = http.Headers[0].Value;

            using (var response = request.GetResponse())
                using (var content = response.GetResponseStream())
                    using (var reader = new StreamReader(content))
                    {
                        result = reader.ReadToEnd();
                    }
            return(result);
        }