我想在jira中使用rest创建一个问题。我需要使用rest.can远程创建一个项目。有人帮助我吗? [英] I want to create an issue on jira using rest in java.also I need to create a project remotely using rest.can someone help me with that?

查看:105
本文介绍了我想在jira中使用rest创建一个问题。我需要使用rest.can远程创建一个项目。有人帮助我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jira 6.4.11并编写了以下Java代码:



I'm using Jira 6.4.11 and have written the following Java code:

public static void main(){
 String username="ssinghal";
    String password="as12345678";
    String url="http://localhost:9002/rest/api/2/issue/";
    String[] command = {"curl", "-D-", "-u", username+":"+password, "-X", " --data {\"fields\": {\"project\":{\"key\": \"FT\"},\"summary\": \"REST ye merry gentlemen.\",\"description\": \"Creating of an issue using project keys and issue type names using the REST API\",\"issuetype\": {\"name\": \"Bug\"}}}", "-H", "Accept:application/json", url};
        ProcessBuilder process = new ProcessBuilder(command); 
        Process p;
        try
        {
            p = process.start();
             BufferedReader reader =  new BufferedReader(new InputStreamReader(p.getInputStream()));
                StringBuilder builder = new StringBuilder();
                String line = null;
                while ( (line = reader.readLine()) != null) {
                        builder.append(line);
                        builder.append(System.getProperty("line.separator"));
                }
                String result = builder.toString();
                System.out.print(result);

        }
        catch (IOException e)
        {   System.out.print("error");
            e.printStackTrace();
        }}  
}





我尝试了什么:



HTTP / 1.1 505 HTTP版本不支持

服务器:Apache-Coyote / 1.1

有没有其他方法可以远程创建项目以及jira问题。

谢谢



What I have tried:

HTTP/1.1 505 HTTP Version Not Supported
Server: Apache-Coyote/1.1
Date: Wed, 05 Oct 2016 12:05:18 GMT
Is there any other way to create a project as well as issue on jira remotely.
Thanks

推荐答案

而不是尝试重新发明轮子并为jira创建自己的java库。我建议你看一些已经构建的用于与JIRA通信的java库。



根据你的错误信息,它表明你没有正确拨打电话(HTTP版本不是支持)。



https://bitbucket.org / atlassian / jira-rest-java-client [ ^ ]



我在.net中为JIRA使用.net库做了同样的事情,它运行得很好所以我知道你是什么想做什么是可能的...至少在大多数情况下。
Instead of trying to reinvent the wheel and creating your own java library for jira. I would recommend you look at some java libraries already built to communicate with JIRA.

Based on your error message it is indicating your not making the call correctly (HTTP Version Not Supported).

https://bitbucket.org/atlassian/jira-rest-java-client[^]

I've done the same thing in .net using a .net library for JIRA and it works just fine so i know what you are wanting to do is possible...for the most part at least.


这篇关于我想在jira中使用rest创建一个问题。我需要使用rest.can远程创建一个项目。有人帮助我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆