简体   繁体   English

如何从 c# 上的 jira api 获取信息

[英]how get info from jira api on c#

I am writing an asp.net mvc application on c#, i have the task of writing a controller that receives data from JIRA via jira api, I have a format link:我正在 c# 上编写一个 asp.net mvc 应用程序,我的任务是编写一个控制器,该控制器通过 jira api 从 JIRA 接收数据,我有一个格式链接:

https://jira.xxx.ru/rest/api/2/search?jql=project=yyy https://jira.xxx.ru/rest/api/2/search?jql=project=yyy

I know the login and password for connecting to jira, in the json response I get the following information:我知道连接到 jira 的登录名和密码,在 json 响应中我得到以下信息:

"maxResults": x, "total": x “最大结果”:x,“总计”:x

can i just connect and return the necessary data to me in the containers, can someone have an example or tell me where can I start?我可以在容器中连接并将必要的数据返回给我吗,有人可以举个例子或告诉我我可以从哪里开始吗?

you use RestClient Following code is I am use get issue from JIRA.您使用 RestClient 以下代码是我使用来自 JIRA 的 get 问题。

        private string RestCall()
        {
            var result = string.Empty;
            try
            {
                var client = new RestClient(url + "/rest/api/2/search?jql=");
                var request = new RestRequest
                {
                    Method = Method.GET,
                    RequestFormat = DataFormat.Json
                };
                request.AddHeader("Authorization", "Basic " + api_token);
                var response = client.Execute(request);
                result = response.Content;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return result;
        } 

Here这里

 url: Base URL of you jira account

 api_token: JIRA API token generated from JIRA username and password 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM