The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create Jira service desk issue using Jira Rest Client ?

Yogesh Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2019

Hi Team,

 I am trying to create /Update /Delete Jira service Desk Issue using Jira Rest Client But it failed to Authenticate. Can you please provide sample java code to create Java Service desk issue using Jira Rest Client .

Thanks in Advance !

 

Regards,

Yogesh

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Suresh Sakhare
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 18, 2019

Hi Yogesh,

You can try below code.

public static void main(String[] args) throws Exception {
        System.setProperty("javax.net.ssl.trustStore", "C:/Demo/myTrustStore");

        URI jiraServerUri = URI.create("https://local.jira.com/");

        AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

        AuthenticationHandler auth = new BasicHttpAuthenticationHandler("username", "password");
        JiraRestClient restClient = factory.create(jiraServerUri, auth);
        IssueRestClient issueClient = restClient.getIssueClient();

        try {
            IssueInputBuilder iib = new IssueInputBuilder();
            iib.setProjectKey("PROJECT-KEY");
            iib.setSummary("Test Summary");
            iib.setIssueType(getIssueType());
            iib.setDescription("Test Description");
            iib.setPriorityId(3L);
            iib.setAssigneeName("Purus");
            iib.setReporterName("Godwin");
            iib.setDueDate(new DateTime());

            iib.setFieldInput(new FieldInput("cust_field_5445", "Custom Value 1"));

            iib.setFieldInput(new FieldInput("cust_field_599", ComplexIssueInputFieldValue.with("value", "Testing")));

            iib.setFieldInput(new FieldInput(IssueFieldId.COMPONENTS_FIELD, "value"));

            IssueInput issue = iib.build();
            BasicIssue issueObj = issueClient.createIssue(issue).claim();

            System.out.println("Issue " + issueObj.getKey() + " created successfully");
        } finally {
            restClient.close();
        }

    }
TAGS
AUG Leaders

Atlassian Community Events