Forums

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

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

Michael Tan February 5, 2020

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
Michael Tan February 6, 2020

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