Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm using Jira 6.4.11 and have written the following Java code:

C#
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();
        }}  
}


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
Posted
Updated 6-Oct-16 2:59am

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900