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

Jira Rest API call works on local program but not in plugin Edited

I am trying to build a jira plugin which involves Jira Rest API by using Java and Unirest library. 

I have a working Java program on my local computer, which successfully calls the Jira Rest APIs and creates a Issue. 

However, I am running into errors on create issue api call.

This is how I am calling the create issue API on both my local program and the plugin where api_url, payload, and authentication are all identical., The local program yields a 201 response, while my plugin gives a 500 response.

HttpResponse<JsonNode> createIssueResponse = Unirest.post(api_url+"issue")
.withObjectMapper(new JacksonObjectMapper())
.basicAuth(username, password)
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(payload)
.asJson();
public static String username = "admin";
public static String password = "admin";
public static String api_url = "http://localhost:2990/jira/rest/api/latest/";

Payload is 

{"fields":{"summary":"Test case of PLAT-2","issuetype":{"id":"10000"},"priority":{"id":"3"},"project":{"key":"PLAT"},"assignee":{"name":"admin"}}}

 

Side Note:

When I try to call Get Issue API, the plugin runs successfully, so it shouldn't be a problem with my authentication. However, I am using the exact same body as well, so I am really confused on what is actually causing the error.

 

Thanks

 

 

1 answer

1 accepted

0 votes
Answer accepted

Problem solved:

All I did was running atlas-mvn clean and atlas-mvn package. Somehow magically, I no longer get the same error response as I reconfigured the target files for my jira software.

Suggest an answer

Log in or Sign up to answer
TAGS

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