Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

    }

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Asked in Jira Service Desk

Calling all Mindville Insight users, we need your help! (there might be swag involved)

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials and we want to hear from you!  ...

296 views 4 6
View question

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you