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

Add project roles in Jira via REST api in JAVA

Mark H_ Williams April 22, 2014

Hello,

I'm trying to use the REST Api to manage project roles in JIRA. I've been able to GET a list of the roles and "actors" and DELETE a role member. But I can't POST a new role member correctly. I keep getting a 400 or 405 error. I'm using HttpClient 4.3.2 and Jira 6.0.2. Here is my code:

// Set up ssl configuration as a user in JIRA instance

HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost("https://jira.install/rest/api/2/project/KEY/role/10000");

StringEntity input = new StringEntity("\"group\" : \"jira-users\" }");
input.setContentType("application/json");
post.setEntity(input);

client.execute(post);

Has anyone been able to do a similar call successfully?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Mark H_ Williams April 27, 2014

The problem was the capitilization for the ContentType. Application should be capitalized so it reads "Applicaton/json". This isn't explicitely shown in the REST API docs.

MattS
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 Leaders.
April 28, 2014

"Application/json" with an i

TAGS
AUG Leaders

Atlassian Community Events