Using REST API to create a user account in "On demand JIRA".

srinivasan radhakrishnan
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.
August 7, 2013

HI,

My company purchased a "On demand JIRA", now i need to create a 400 user account. Hot to create a "On demand JIRA" account by using REST API.

Please share your knowledge.

Thanks.

12 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

7 votes
Answer accepted
Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2013

Dear Srinivasan,

JIRA REST API for user management is available.

The rest endpoint would be:

https://yourhostname.com/rest/api/2/user

 

HTTP POST method to be used with JSON in a request body:

{
"name": "< USER NAME >",
"password": "< USER PASSWORD >",
"emailAddress": "< USER EMAIL >",
"displayName": "< USER DISPLAY NAME >",
"notification" : "< true / false >" //whether to sent notification to given email address or not
}

 

You should receive HTTP 201 code if request is successful. You should use your admin credentials to execute this query.

 

Don't hesitate to reply in this thread if you have more questions.

 

--

Cheers, Ignat.

2 votes
Tora Infrastructure Services October 14, 2013

Hi Guys,

tryinhg thisn on on demand instance

user = dict()

     user['name'] = 'test102'

     user['password'] = 'Default1'

     user['emailAddress'] = 'email@domain'

     user['displayName'] = 'TestUser'

     user['notification'] = 'true'

     result = requests.post(user_url, data=json.dumps(user), auth=(jira_username, jira_password), headers = headers)

and i get

{"errorMessages":["Either the 'username' or the 'key' query parameters need to be provided"],"errors":{}}

any ideea why? something like this was working a while ago

Cheers,

Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2013

Hi Nicholas.

Could you add more logging and ensure the request parameter are sent as you expect them to?

From the error message it looks like empty request body have been received by JIRA.

--

Cheers,

Ignat.

Arun_Thundyill_Saseendran
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.
October 28, 2014

This error seems to happen because you have used a wrong rest handle. Use the handle '/rest/api/2/user'

1 vote
ArjunKumar Selvamani March 15, 2019

Is there an api to send invite to users?

1 vote
Aaron April 8, 2014

Hi Ignat,

Is there documentation for the OD REST API available at this time? We would like to query and manage group membership using the API.

Best regards,

Aaron

1 vote
Tora Infrastructure Services August 13, 2013

its there an API for adding groups?

Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 13, 2013

Hi Nicholas,

JIRA REST APIs for groups are not yet available. Group APIs are expected to be delivered with further OD releases. Stay tuned.

--

Cheers, Ignat.

0 votes
Fernando Boucquez (PPL) August 8, 2015

Does notification work? It's not in the API https://docs.atlassian.com/jira/REST/latest/#d2e3590 nor the rest browser. 
 

0 votes
Tora Infrastructure Services October 14, 2013

hmm,

this was an intresting one, i made a http post request, over plain http, but atlassian redirected this over https and the post became a get t some point , very strange

after switching to https it worked, thank you for your help

Cheers,

Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2013

Hi.

Yes, OD environment supports only https. If one uses http these are transformed as you have described.

--

Cheers, Ignat.

0 votes
Tora Infrastructure Services August 12, 2013

Thank you Ignat,

that was it, i'm using requests from python, settting this, made it work

headers = {'content-type': 'application/json'}
r = requests.post(user_url, data=json.dumps(user),auth=(jira_auth.username, jira_auth.password),headers=headers)

Cheers,

0 votes
Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 12, 2013

No problems, Nicholas.

--

Cheers, Ignat.

0 votes
Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 12, 2013

Nicholas,

Do you sent the proper content type? Content type "application/json" is the expected one.

Could you attach the code sample where do you get this error?

--

Cheers, Ignat.

0 votes
Tora Infrastructure Services August 12, 2013

Hi Guys,

dose this work for ondemand? i get a 415 <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Unsupported Media Type)

Cheers,

Cristi

0 votes
RambanamP
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.
August 7, 2013

You can add the users from a csv file using JCLI Please find more information at https://studio.plugins.atlassian.com/wiki/display/JCLI/JIRA+Command+Line+Interface

Steve Wolfe October 27, 2016

I was very disappointed that a CLI was not only not free but fairly expensive.  Hopefully we now can do what we need with the REST calls with version 7.2.x

Steve Wolfe October 27, 2016

I can add users and add them to a group via rest.  I don't know yet if I can add them to roles via REST.

Pritee Sanghavi August 17, 2019

Can you please provide link to REST API which can be used for adding users & assigning them to group? 

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events