plz give me step by step description.
Community moderators have prevented the ability to post new answers.
Try to get list of all project from brouser. Namely you need to go here: <JIRA base URL>/rest/api/2/project
You should get list of all projects into JSON format. Are you able to do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is my code to do this. Try it:
package ru.phosagro.jira.rest; import com.sun.org.apache.xml.internal.security.utils.Base64; import java.io.*; import java.net.*; import javax.json.*; public class testREST_CreateIssue { public static void main(String[] args) { try { URL jiraREST_URL = new URL("jiraURL/rest/api/2/issue/"); URLConnection urlConnection = jiraREST_URL.openConnection(); urlConnection.setDoInput(true); HttpURLConnection conn = (HttpURLConnection) jiraREST_URL.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); System.out.println(getJSON_Body()); conn.setRequestMethod("POST"); conn.setRequestProperty("Authorization", "Basic " + Base64.encode("user:password".getBytes(), 0)); conn.setRequestProperty("Content-Type", "application/json"); conn.getOutputStream().write(getJSON_Body().getBytes()); //conn.getOutputStream().write("{\"fields\":{\"project\":{\"id\":16512},\"summary\":\"Weekly report (12)\",\"duedate\":\"2016-03-25\",\"issuetype\":{\"id\":\"10903\"}}}".getBytes()); String toBeEncoded = "vzverev:Gromozavr"; System.out.println(toBeEncoded + ": " + Base64.encode(toBeEncoded.getBytes(),0)); System.out.println(toBeEncoded + ": " + new String(java.util.Base64.getEncoder().encode(toBeEncoded.getBytes()))); try { InputStream inputStream = conn.getInputStream(); for(int iByte = 0; iByte < inputStream.available(); ++iByte ){ } // System.out.print(inputStream.toString()); inputStream = conn.getInputStream(); } catch (IOException e){ System.out.println(e.getMessage()); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private static String getJSON_Body() { JsonObject createIssue = Json.createObjectBuilder() .add("fields", Json.createObjectBuilder().add("project", Json.createObjectBuilder().add("key", "IC38")) .add("summary", "Weekly report (11) А вот так") .add("duedate", "2016-03-18") .add("issuetype", Json.createObjectBuilder().add("id", "10903")) ).build(); return createIssue.toString(); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Its not working for me.
Some thing was wrong in my Project building steps.
Can you please share with me steps from the scrap.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First, are you able to create a plugin skeleton and add it into JIRA?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.